Compare commits

...

334 Commits

Author SHA1 Message Date
Andrius Štikonas c22e3dac66 Fix a typo in CFLAGS variable name. 2024-04-28 00:38:38 +01:00
Andrius Štikonas 0e6133eed2
Merge pull request #464 from Googulator/grub-reproducibility
Drop non-reproducible manpage from Grub package
2024-04-20 15:19:09 +01:00
Andrius Štikonas 5052c8ad76 Fix a typo reported by Hagfish. 2024-04-20 11:53:05 +01:00
Andrius Štikonas ca00dd635f
Merge pull request #458 from fosslinux/cleanup_weak_symbols_patch
Remove patch that is no longer needed.
2024-04-19 19:15:21 +01:00
Gábor Stefanik 8c67b9ee9c Drop non-reproducible manpage from Grub package
This embeds the type of the building system's firmware at build time,
causing different checksums on UEFI vs BIOS machines.

Fixes #463
2024-04-19 00:19:29 +02:00
Andrius Štikonas 71253f7f8c Remove patch that is no longer needed.
This fixed some issues with weak symbols but now tcc is properly patched.
2024-04-18 21:28:39 +01:00
Andrius Štikonas 3bbd639937
Merge pull request #461 from fosslinux/update-parts
Update parts.rst
2024-04-17 19:22:50 +01:00
Googulator cd74988efb
fix typos 2024-04-17 02:29:01 +02:00
Googulator 43f31ce543
Update parts.rst 2024-04-17 02:15:05 +02:00
Googulator 85026900ac
Fix formatting of Pythonless build instructions 2024-04-17 00:59:58 +02:00
Googulator 34a72584c1
Update Pythonless bootstrap instructions
* ``pre-network-sources`` is no more
* builder-hex0 stage1 is no longer precompiled, but instead needs to be generated from hex0 code (using POSIX tools or by hand)
2024-04-17 00:58:50 +02:00
Googulator 27b4f1c766
Merge pull request #460 from Googulator/after-extend
Add extension mechanism to execute .sh files dropped in /steps/after
2024-04-17 00:49:53 +02:00
Gábor Stefanik c73d8c9dc1 Add extension mechanism to execute .sh files dropped in /steps/after
These are executed at the end of the bootstrap, if /steps/after exists.
In interactive mode, they run before the interactive prompt is displayed.
2024-04-16 20:53:52 +02:00
Andrius Štikonas 5595a06ad9
Merge pull request #459 from Googulator/script-generator-checksum
Add checksum protection to script-generator
2024-04-16 19:25:45 +01:00
Gábor Stefanik c5eb402eeb Add checksum protection to script-generator 2024-04-16 10:20:39 +02:00
Gábor Stefanik 7f08661b6c Fix a missed amd64 checksum 2024-04-16 10:16:51 +02:00
Andrius Štikonas 0f91a466a1
Merge pull request #356 from Googulator/mes-0.26
Upgrade mes to 0.26
2024-04-16 06:59:39 +01:00
Gábor Stefanik aa3d36b934 Update checksums for x86, amd64 & riscv64
Also, add missing non-x86 checksums for simple-patch.
2024-04-16 00:24:44 +02:00
Gábor Stefanik e08f655cd6 Rebuild pregenerated files in nyacc 2024-04-15 22:11:44 +02:00
Gábor Stefanik c0494d9af8 Fix build of bash with mes-0.26
Since rename.c is now included in meslibc, we need -DHAVE_RENAME.
2024-04-15 22:11:44 +02:00
Gábor Stefanik 70fdbebd9c Upgrade mes to 0.26
This can successfully build a working tcc-mes, but then fails
creating unified-libc.c for subsequent tcc bootstrapping.
2024-04-15 22:11:39 +02:00
Andrius Štikonas 281f6e44d9
Merge pull request #455 from Googulator/linux-openela
Upgrade kernel to 4.14.341-openela
2024-04-15 19:41:59 +01:00
Googulator a5a689c954
Merge pull request #457 from fosslinux/byacc
Move heirloom lex and flex after musl, replace heirloom yacc with byacc
2024-04-15 10:17:13 +02:00
Gábor Stefanik 0c718aeece Update checksums for heirloom yacc -> byacc change 2024-04-15 02:17:59 +02:00
Gábor Stefanik 25443468ee Add files.bootstrapping.world mirrors for all Savannah snapshots 2024-04-15 02:11:05 +02:00
Gábor Stefanik e2a1df94a5 Add licensing information to byacc's makefile
This makefile was included in the byacc distribution as Makefile.old
It was slightly updated to fit our needs.

Berkeley yacc itself is in the public domain, but SPDX/REUSE provides
no good way to represent this. In keeping with that spirit, I chose
CC0 as the license for my modifications, which SPDX can represent.
2024-04-15 01:43:20 +02:00
Gábor Stefanik 02fb689ce1 Move heirloom lex and flex after musl, replace heirloom yacc with byacc
This way, heirloom-devtools is only linked to a libc with a CDDL-compatible
license, making it fully redistributable. Heirloom yacc doesn't work properly
with musl libc, but luckily byacc can do its job just fine, so we only need
heirloom lex now.

Thanks to the more complete libc, and bash being available, heirloom's
bootstrap is significantly simplified.
2024-04-15 01:22:50 +02:00
Gábor Stefanik 6567973a04 Make byacc actually work when compiled against meslibc
This replaces the previous sed hackery with a proper patch, and removes
a few more libc functions that meslibc is missing.
The binary name is changed to "byacc" so it doesn't get overwritten by
heirloom yacc.

The bsearch() replacement code comes from an earlier version of byacc.
2024-04-14 21:14:04 +02:00
Googulator 5ae504cb67
Merge pull request #453 from Googulator/openssl-upgrade
Upgrade OpenSSL to 3.0.13
2024-04-14 06:46:37 +02:00
Gábor Stefanik 3970ee7d1a Add byacc parser generator
This is meant to replace heirloom yacc for compiling pre-musl parsers.
Unlike heirloom yacc, it's in the public domain, and can be linked with
meslibc without licensing concerns.
2024-04-14 05:51:30 +02:00
Gábor Stefanik c75d609cf7 Upgrade kernel to 4.14.341-openela
This is a continuation of the 4.14 series by the Open Enterprise Linux
Alliance, ostensibly to the same maintenance standards as the now
discontinued kernel.org LTS.

This code is primarily offered as a Git repository, with gz tarballs
also available, but no xz versions. Switching back to a gzipped version
of the kernel source code would introduce too much srcfs growth, so we
use the last kernel.org tar.xz release (4.14.336), and apply OpenELA's
changes using a patch generated from the Git repository.
2024-04-14 05:04:24 +02:00
Googulator 29a029947c
Merge pull request #454 from Googulator/source-mirrors
Support multiple mirrors for each source file
2024-04-14 04:12:07 +02:00
Gábor Stefanik 89a4d18ff0 Support multiple mirrors for each source file
If multiple URLs are entered in a sources listing for the same file,
each will be tried in turn, until either one succeeds, or we fail
having run out of mirrors.
2024-04-14 00:17:41 +02:00
Gábor Stefanik 6017ae7a9f Add extra source URL for OpenSSL 3.0.13, to account for it being moved in the future
This will only be useful after #454 is merged.
2024-04-14 00:13:20 +02:00
Gábor Stefanik 637fa823f0 Upgrade OpenSSL to 3.0.13
Fixes #451
2024-04-13 23:43:41 +02:00
Googulator 86e1a5e7f6
Merge pull request #449 from pyy/master
update submodule stage0-posix to latest: updated unxz sources for amd64 aarch64 etc
2024-03-07 17:50:23 +01:00
pyy 5e11d2a592 update submodule stage0-posix to latest: updated unxz sources for amd64 aarch64 etc. 2024-03-07 17:09:31 +01:00
Andrius Štikonas 4737ab7481
Merge pull request #446 from Googulator/qemu-interactive
Use qemu's GUI support in interactive mode
2024-02-28 21:33:50 +00:00
Gábor Stefanik c1c6b278e6 Use qemu's GUI support in interactive mode
Previously, there was no way to access the additional consoles in
qemu mode, due to qemu running in -nographic mode with a serial
console. This is perfectly fine in non-interactive mode, but we can
make interactive mode more usable by using a graphical console like
on bare metal.

Also drop -no-reboot from interactive mode, since rebooting (e.g.
to load a newly compiled kernel) makes sense in this case.
2024-02-25 02:39:43 +01:00
fosslinux 2261098f98
Merge pull request #445 from fosslinux/check-substitutes
Check "substitutes"
2024-02-24 09:37:32 +00:00
fosslinux b80e1f6a57 Ensure that substituted files are equivalent to upstream 2024-02-24 20:36:12 +11:00
fosslinux d6e49c181c
Merge pull request #444 from Googulator/kconfig-update
Update Linux kernel configuration & patches
2024-02-20 10:37:14 +00:00
fosslinux 021574d2a9 Change diffutils-2.7 back to upstream gz tarball
The bz2 tarball we were using is a complete repack of the tarball,
including date & permission modifications. It adds an extra file
RPI-Configure too. This is not optimal as it impedes verification
ability.
2024-02-20 09:53:22 +11:00
Gábor Stefanik 60ec9ea80c Update Linux kernel configuration & patches
This updates the Linux kernel configuration, removing irrelevant
networking-related components, and switching framebuffer drivers to
the DRM-based ones. With this, we can finally bootstrap on systems
with newer NVIDIA cards, which would green screen with the nvidiafb
driver.

KVM is still disabled, see #443 - VIRTUALIZATION is also disabled,
as it's useless without KVM or any other suboption being enabled.

Additionally, we can now drop the bad-asm patch, since our newer
binutils has no problem supporting that syntax, and it doesn't look
quite innocuous to me, removing an offset from a memory access.

The kernel is now built in 2 stages: first, we build vmlinux only,
then, after cleaning up any intermediate .o files (except the ones
needed to build efistub), we convert it to a bzImage. This required
some creative use of the -o option to convince Make not to rebuild
all of the .o files we've just deleted as dependencies.
2024-02-18 17:54:25 +01:00
Gábor Stefanik ee3ab501da Add rootwait to grub command line to fix USB boot failures
Without this, one of my boards fails to reboot from USB drive due to
slow USB enumeration. Rootwait is not needed during the Fiwix -> Linux
jump, because we use an initramfs there, and the init scripts already
wait for USB drives to show up. Linux->Linux kexec, used with a custom
early kernel, might need it, so add it there as well to be safe.
2024-02-18 17:52:33 +01:00
Gábor Stefanik 11d3605b08 Upgrade Linux kernel to 4.14.336
This is the last LTS version buildable using GCC 4.0.x. The next one,
version 4.19, requires at least GCC 4.6.

Fortunately, this is also the first version of the Linux kernel
without firmware blobs being included in /firmware, so the FSFLA
deblob scripts aren't needed anymore to ensure a fully auditable
kernel - the 3 remaining drivers that do include blobs masquerading
as source code are removed via a patch, avoiding all the other side
effects of the deblob scripts.
This doesn't compromise the trustworthiness of the bootstrapped
environment, since all the other drivers deblob would remove use
the firmware loader mechanism, which does nothing when the actual
firmware blobs aren't installed on the system separately. Features
dependent on firmware still won't work, but many drivers that load
firmware do so only optionally. This includes r8169, the driver for
the Realtek gigabit NICs found on many x86 motherboards.

This kernel is considerably larger than 4.9.10, and we build more
of it (including drivers that would previously get stripped away by
the deblob script, such as r8169), so to accommodate that, Fiwix
initrd size is increased by 64MiB, while lowering kexec space by
the same amount to ensure enough userspace memory available in Fiwix.
Fiwix's maximum open file count is also bumped from 1.5K to 2.5K.

The Documentation folder is deleted before build, to further save
space in the ramdisk.
2024-02-17 15:37:33 +01:00
Gábor Stefanik 32138d13b9 Clean pre-Bash build artifacts before building the Linux kernel
All of these are archived, in a compressed form, in base.tar.bz2.
2024-02-17 15:32:02 +01:00
Gábor Stefanik 4e0a0f03dd Capture everything built before the repo system in a base tarball
Parts built before bash and the repo system are available aren't
stored in a clean repository tarball, so if any early file is
overwritten, it's lost. Fix this by creating a base.tar.bz2 right
after the repo is set up, to hold reference copies of early files.
This tarball isn't checksummed, since it varies considerably with
bootstrap options, but the binaries inside are protected by their
own checksums.
2024-02-17 15:32:02 +01:00
Gábor Stefanik 7dc9ebc71d Improve hygiene of kaem build scripts 2024-02-17 15:32:02 +01:00
fosslinux 9c1ae45bb8
Merge pull request #436 from Googulator/xz
Support early xz/lzma decompression, and use it wherever possible
2024-02-15 07:51:13 +00:00
Andrius Štikonas cfa178e8b5
Merge pull request #441 from Googulator/grub-resolution
Allow grub to autodetect screen resolution
2024-02-14 22:52:06 +00:00
Andrius Štikonas 3341de6d42
Merge pull request #439 from Googulator/seedless
Exclude bootstrap-seeds from kernel bootstrap images
2024-02-14 22:51:37 +00:00
Andrius Štikonas a3e7042aa2
Merge pull request #440 from Googulator/usb-fix
Update builder-hex0 with USB mass storage support fixes
2024-02-14 22:50:00 +00:00
Gábor Stefanik 4bc54d83cb Allow grub to autodetect screen resolution
With this, systems without a supported non-vesa FB driver in Linux
(such as Intel integrated graphics) get full resolution after reboot.
2024-02-14 16:02:28 +01:00
Gábor Stefanik 65953732a0 Support early xz/lzma decompression, and use it wherever possible 2024-02-14 14:34:16 +01:00
Gábor Stefanik 967f3f2bb8 Update builder-hex0 with USB mass storage support fixes 2024-02-13 19:53:43 +01:00
Gábor Stefanik 6ecd0a79ef Exclude bootstrap-seeds from kernel bootstrap images
In kernel bootstrap mode, the kernel (builder-hex0) includes the
ability to assemble hex0 source code, and to execute basic commands,
obviating the need for the bootstrap-seeds subdirectory.
With the bootstrap-seeds directory excluded, the image consists of
purely source code, with the exception of the boot sector, which is
assembled from hex0 code by rootfs.py, and delivered ready for BIOS
to boot.
2024-02-13 18:31:36 +01:00
fosslinux 34cb6758d2
Merge pull request #437 from Googulator/e820
Use e820 memory map from BIOS, if available
2024-02-13 10:08:37 +00:00
Gábor Stefanik f2aee4758e Use e820 memory map from BIOS, if available 2024-02-12 13:34:30 +01:00
Gábor Stefanik 9e4c17b68d Pass parameters to make_fiwix_initrd and kexec-fiwix
This extends make_fiwix_initrd and kexec-fiwix to support command
line parameters, instead of hardcoding relevant values within the
C sources. This way, it becomes possible to alter e.g. ramdisk size
without affecting checksums.

While we're at it, also support loading a memory map from file.
2024-02-12 13:34:00 +01:00
fosslinux bbb96a52d6
Merge pull request #432 from Googulator/fiwix-filelist-must-die
Replace Fiwix filelist with parsing builder-hex0's FS structures
2024-02-08 00:48:43 +00:00
fosslinux 54068851d8
Merge pull request #434 from fosslinux/m4
M4 alternative update
2024-02-07 22:11:58 +00:00
fosslinux 61cb7edf91
Merge pull request #435 from Googulator/grub
Fix typo in make_bootable.sh causing failure to reboot
2024-02-07 22:11:47 +00:00
fosslinux 6b4ec19e19 Add m4 1.4.19 2024-02-07 20:35:22 +11:00
fosslinux 068f7d8f40 Fix diffutils manpage reproducibility 2024-02-07 20:22:10 +11:00
Gábor Stefanik 009ec57835 Fix typo in make_bootable.sh causing failure to reboot 2024-02-06 19:22:35 +01:00
Gábor Stefanik 5945bdc1e8 Replace Fiwix filelist with parsing builder-hex0's FS structures
And while we're at it, use a more sustainable way of getting the
address of the next file to be written to.

Since builder-hex0 doesn't distinguish directories from zero-length
files, this has a limitation that it won't copy any zero-length
files or empty directories. Only one such file is important for the
bootstrap process (mes/config.h), which is recreated using an
improve step.
2024-02-06 12:30:24 +01:00
fosslinux ba9d182471 Revert "Update m4 to 1.4.10"
This reverts commit 6d8cf14998.
2024-02-06 18:06:46 +11:00
fosslinux 49f5520143
Merge pull request #429 from fosslinux/gawk
Add gawk 5.3.0
2024-02-06 07:06:16 +00:00
fosslinux f237d67b47
Merge pull request #433 from Googulator/better-early-bash-prompt
Improve pseudo-interactive prompts using the early bash
2024-02-06 06:11:05 +00:00
Gábor Stefanik d50ecd58e8 Improve pseudo-interactive prompts using the early bash
By wrapping $(cat) in an eval, redirections and other advanced
syntax can now work in the early prompts.
Also, since "set -E" is broken is the early bash, fall back to
using "set -e" and an EXIT trap, until we can upgrade to a bash
version that already has working "set -E", or perhaps backport
it to 2.05b.
2024-02-05 10:02:34 +01:00
fosslinux ffbdd8bc18 Add gawk 5.3.0 2024-02-05 18:51:49 +11:00
fosslinux 10d2a72d16
Merge pull request #415 from Googulator/grub
Support reboot in non-chroot modes using grub and an init script
2024-02-05 07:50:36 +00:00
Andrius Štikonas 50947ca61e Fix Fiwix file list and diffutils checksum.
Thanks to Googulator for spotting these.
2024-02-04 18:46:05 +00:00
Andrius Štikonas 0b6c8bfb94 Fix mismerge in parts.rst. 2024-02-04 16:01:30 +00:00
Gábor Stefanik 6d26855dc6 Support reboot in non-chroot modes using grub and an init script
We use grub-2.06 as 2.12 has some packaging issues, and can't be
built in live-bootstrap for now.
2024-02-04 16:54:13 +01:00
fosslinux eb3414c2da
Merge pull request #428 from fosslinux/diffutils
Diffutils 3.10
2024-02-04 03:57:57 +00:00
fosslinux 9c6e5d6406 Add diffutils 3.10 2024-02-04 14:57:46 +11:00
fosslinux 0f27c03ea4
Merge pull request #427 from fosslinux/gzip-newer
Add gzip 1.13
2024-02-04 03:56:07 +00:00
fosslinux cb4404029d Add gzip 1.13
Closes #369
2024-02-04 14:55:55 +11:00
fosslinux 6e05585ff9
Merge pull request #426 from fosslinux/opendoas
Opendoas (ie, sudo)
2024-02-04 03:52:25 +00:00
fosslinux bd303ada4a
Merge pull request #425 from fosslinux/m4-update
Update m4 to 1.4.10
2024-02-04 03:50:55 +00:00
fosslinux 3dee6eab1c
Merge pull request #424 from fosslinux/shadow
Shadow/Users
2024-02-04 03:50:36 +00:00
fosslinux 2188e8182a Add opendoas 2024-02-03 10:07:41 +11:00
fosslinux 75772adb91 Allow the use of setuid binaries
This also changes checksum of util-linux.
2024-02-03 10:07:41 +11:00
fosslinux 72dba439fd
Merge pull request #418 from Googulator/better-interactive
Better interactive mode support
2024-02-02 11:28:49 +00:00
fosslinux 6d8cf14998 Update m4 to 1.4.10 2024-02-02 18:05:02 +11:00
fosslinux bfd951ae51 Add shadow 2024-02-01 21:24:56 +11:00
fosslinux 0696018410 Add libbsd 2024-02-01 21:24:56 +11:00
fosslinux bbfab004c8 Add libmd 2024-02-01 21:24:56 +11:00
fosslinux 6c377de2f0 Add basic users and groups 2024-02-01 21:23:16 +11:00
fosslinux 3733956654
Merge pull request #423 from rick-masters/mkfs-no-prompt
Add -F flag to mkfs to avoid prompt to proceed.
2024-01-30 22:19:37 +00:00
fosslinux 8fe43f3103
Merge pull request #421 from Googulator/builder-hex0-submodule
Update builder-hex0 submodule (smaller stage1 code size)
2024-01-30 22:19:18 +00:00
Gábor Stefanik c748766fac Switch Fiwix's console to tty1 on bare metal
This is needed to make the monitoring/recovery shell on tty2 work,
as the default console is tty0, which will just print to whichever
virtual console is active at the moment, making the shell unusable.
2024-01-30 02:50:36 +01:00
Gábor Stefanik 221f2d0f8e Open shells on virtual terminals for monitoring in interactive mode
We spawn a shell:
- When Bash is first built, on tty2. This shell uses the old Bash,
  so interactive mode needs to be emulated using redirection. Thus,
  entering commands needs to be done using Enter followed by Ctrl+D,
  and certain redirection features are unavailable.
- After moving the system to disk, on tty2. Old Bash, same limitations.
- After 2nd Bash is built, on tty3. This is a fully functional shell.

This is disabled in chroot-like bootstrap modes, or when -i is not set.
2024-01-30 02:50:36 +01:00
Gábor Stefanik 8fca0973ab Fix "no job control in this shell" in final Bash prompt 2024-01-30 02:50:36 +01:00
rick-masters 5aa58e34e0 Add -F flag to mkfs to avoid prompt to proceed. 2024-01-29 23:51:52 +00:00
Gábor Stefanik 66887892bf Update builder-hex0 submodule
* Reduce stage1 footprint back to 192 bytes
* Fix execve without fork
2024-01-28 05:08:31 +01:00
Andrius Štikonas 3e2663b3bd
Merge pull request #419 from fosslinux/live-system-nochange
Live system nochange
2024-01-27 00:59:33 +00:00
Andrius Štikonas 64ec796314
Merge pull request #420 from Googulator/using-bash-bugfix
Fix typo in script-generator causing wrong traps in new Bash
2024-01-27 00:55:30 +00:00
fosslinux 438e01800c Update checksums 2024-01-26 10:29:57 +11:00
fosslinux 2182076773 Use a constant umask 2024-01-26 10:29:57 +11:00
fosslinux 67acb607f6 Never create pyc files on filesystem 2024-01-26 10:29:57 +11:00
fosslinux 1665723b70 Respect DESTDIR for lib-dynload directory in py 2.0.1 2024-01-26 10:29:57 +11:00
fosslinux 76217c6b0d Ensure sources are always cleaned the same
Otherwise, in --repo mode, sources are not cleaned identically to how
they are in non --repo mode
2024-01-26 10:29:57 +11:00
fosslinux b1e3da4e46 Move where DESTDIR is made 2024-01-26 10:29:57 +11:00
fosslinux 7f967fe2dc Cleanup the filesystem at end of bootstrap 2024-01-26 10:29:57 +11:00
fosslinux 8d9981772a Dont remove /usr/include
(lol, no idea how this ever worked)
2024-01-26 10:29:57 +11:00
fosslinux 62ce1b0c1e Remove old python versions 2024-01-26 10:29:53 +11:00
fosslinux fb35fcac4c Uninstall previous perl files using uninstall rather than src_install 2024-01-26 10:29:18 +11:00
fosslinux 0a98747dab Remove files unnecessarily kept around 2024-01-26 10:29:18 +11:00
fosslinux 718bccc7b2 Remove yacc using uninstall rather than in src_install of flex-2.6.4 2024-01-26 10:29:18 +11:00
fosslinux 6901877837 Remove unnecessary touching of live filesystem in flex-2.5.11 2024-01-26 10:29:18 +11:00
fosslinux c0485bce2f Remove unneccessary touching of live filesystem in coreutils-5.0 pass2 2024-01-26 10:29:18 +11:00
fosslinux 3669db9125 Use merged usr throughout the entire bootstrap 2024-01-26 10:29:18 +11:00
fosslinux 5b84cdd178 Don't touch live filesystem in bash-5.2.15
Rather, uninstall existing bash before bash is built
2024-01-26 10:29:18 +11:00
fosslinux bbe121f382 Add uninstall directive to manifest
Allows for removal of old files or packages
2024-01-26 10:29:18 +11:00
fosslinux 8cc26fa60a Remove old relic of "maint"
Never actually used in the manifest, and shouldn't have been there
2024-01-26 10:29:18 +11:00
Eduardo Sánchez Muñoz f995a749de Fix detection of device type (partition/full disk) in move_disk.sh
The version of stat available at that point does not support %Lr, so use instead its hexadecimal counterpar (%T)
2024-01-26 10:29:18 +11:00
Eduardo Sánchez Muñoz 2883225629 Only copy no-network distfiles to "init" when `--external-source` is passed (with kernel bootstrap)
All distfiles are still copied to "external"
2024-01-26 10:29:18 +11:00
Eduardo Sánchez Muñoz 679f73bbf1 Create disk images without root
`mke2fs` has a `-d` option that allows to populate the newly created filesystem without needing to temporarily mount it. That allows to use `parted` and `mkfs.ext3` on regular files without needing root access.
2024-01-26 10:29:18 +11:00
Gábor Stefanik 67aa2a4826 Fix the default build script used by "build <package name>"
Before the simplify refactor, the convention was to name the first
or default build script "<package name>.sh". The refactor changed
this default to "pass1.sh", with "pass2.sh" and so on used for
subsequent passes. This wasn't an issue when building usig scripts
generated by script-generator (which explicitly declares the build
script to use), but broke running "build <package name>" without
an explicit script name from the post-bootstrap bash prompt.

By deriving the script name from the current revision/pass number,
this commit restores that functionality.

An unfortunate blemish is that we number build scripts from 1, but
repo tarballs from 0 - it would be nice to standardize on a single
indexing convention.
2024-01-26 10:29:18 +11:00
Gábor Stefanik 46268e2882 Update builder-hex0 for USB boot support 2024-01-26 10:29:18 +11:00
fosslinux 9632f6af01 Update coreutils to 9.4 2024-01-26 10:29:18 +11:00
Gábor Stefanik 071f6c2d40 Fix typo in script-generator causing wrong traps in new Bash
When renaming using_bash to bash_build, I accidentally removed the
+ sign from the assignment, causing bash_build > 1 to never match,
resulting in old-style Ctrl+D traps even in the new Bash.

This patch restores the intended += behavior.
2024-01-24 10:29:51 +01:00
fosslinux 34e4bf9bcc
Merge pull request #381 from eduardosm/disk-images-without-root
Create disk images without root
2024-01-24 01:40:13 +00:00
Andrius Štikonas 04f6a2d204
Merge pull request #417 from Googulator/fix-default-buildscript
Fix the default build script used by "build <package name>"
2024-01-24 00:24:19 +00:00
Andrius Štikonas 458a65b1d0
Merge pull request #416 from Googulator/builder-hex0-submodule
Update builder-hex0 for USB boot support
2024-01-24 00:20:21 +00:00
Gábor Stefanik 177b58cc09 Fix the default build script used by "build <package name>"
Before the simplify refactor, the convention was to name the first
or default build script "<package name>.sh". The refactor changed
this default to "pass1.sh", with "pass2.sh" and so on used for
subsequent passes. This wasn't an issue when building usig scripts
generated by script-generator (which explicitly declares the build
script to use), but broke running "build <package name>" without
an explicit script name from the post-bootstrap bash prompt.

By deriving the script name from the current revision/pass number,
this commit restores that functionality.

An unfortunate blemish is that we number build scripts from 1, but
repo tarballs from 0 - it would be nice to standardize on a single
indexing convention.
2024-01-22 22:59:25 +01:00
Gábor Stefanik 25575b28b2 Update builder-hex0 for USB boot support 2024-01-22 22:57:42 +01:00
Andrius Štikonas 51dd19aadf
Merge pull request #382 from fosslinux/coreutils-9.4
Coreutils 9.4
2024-01-22 19:21:19 +00:00
fosslinux 06b40f3f00
Merge pull request #414 from Googulator/builder-hex0-submodule
Use builder-hex0 stages from submodule
2024-01-22 03:43:31 +00:00
Gábor Stefanik 2023432c5e Use builder-hex0 stages from submodule
This ends the reliance on the precompiled stage1 image in ootstrap-seeds,
and the locally committed copy of the stage2 hex0 code. Instead, both
stages are taken from the new builder-hex0 submodule, with stage1 compiled
by generator.py on the fly. The local copy of stage2 is dropped.

This way, updating to a newer builder-hex0 becomes much easier: just update
the submodule.
2024-01-21 19:18:21 +01:00
Gábor Stefanik 5d5eb5d73b Add builder-hex0 as a submodule 2024-01-21 19:04:56 +01:00
Andrius Štikonas 9ff2d1f0f1 Add abort.{s,o} to libc+tcc. 2024-01-20 22:07:31 +00:00
fosslinux c750c6f002 Update coreutils to 9.4 2024-01-21 08:47:34 +11:00
Andrius Štikonas 241f5431b0 Update amd64 checksums. 2024-01-20 18:07:38 +00:00
fosslinux 490bc621a5
Merge pull request #400 from Googulator/autogen-trap-fix
Upgrade autogen bootstrap tarball to fix trap issue
2024-01-13 01:07:00 +00:00
fosslinux f71445362e
Merge pull request #408 from Googulator/checksum-fix
Fix Python 3 checksum regression from 8341c4e
2024-01-13 01:06:31 +00:00
Eduardo Sánchez Muñoz 5243d3b3ce Fix detection of device type (partition/full disk) in move_disk.sh
The version of stat available at that point does not support %Lr, so use instead its hexadecimal counterpar (%T)
2024-01-12 22:39:44 +01:00
Eduardo Sánchez Muñoz 3f41cab6f7 Only copy no-network distfiles to "init" when `--external-source` is passed (with kernel bootstrap)
All distfiles are still copied to "external"
2024-01-12 22:39:21 +01:00
Eduardo Sánchez Muñoz 5dbaeaf19b Create disk images without root
`mke2fs` has a `-d` option that allows to populate the newly created filesystem without needing to temporarily mount it. That allows to use `parted` and `mkfs.ext3` on regular files without needing root access.
2024-01-12 22:39:20 +01:00
fosslinux e6185414db
Merge pull request #410 from rick-masters/populate-devices-for-kexec
Populate devices so kexec can read /proc/iomem.
2024-01-12 20:41:34 +00:00
fosslinux 1ddc0bc2e1
Merge pull request #409 from Googulator/fix-premature-shutdown
Fix panic due to after.sh prematurely quitting on shutdown
2024-01-12 20:41:08 +00:00
Gábor Stefanik 7e73fd25cb Fix Python 3 checksum regression from 8341c4e
The Linux kernel won't autocreate /dev/shm inside devtmpfs.
Without it, semaphores won't work properly in Python.

Previously, /dev/shm was set up in populate_device_nodes, but we
no longer run that after booting into Linux.
2024-01-12 19:58:40 +01:00
Gábor Stefanik 36c1925742 Fix panic due to after.sh prematurely quitting on shutdown
The sysrq shutdown trigger takes some time to fully shut down the system,
during which init is expected to continue running. Since after.sh is the
last step in our init, if it quits before shutdown is complete, Linux will
panic with "Attempted to kill init".

Add an infinite loop after shutdown is issued via sysrq to prevent this.
2024-01-12 19:55:10 +01:00
Gábor Stefanik 9ed4416940 Upgrade autogen bootstrap tarball to v1.0.1 to fix return code issue 2024-01-12 16:11:14 +01:00
rick-masters b2f4e3d129 Populate devices so kexec can read /proc/iomem. 2024-01-12 14:59:27 +00:00
Andrius Štikonas 754d967b29
Merge pull request #406 from rick-masters/fix-qemu-linux-str-concat
Account for int and NoneType in string concatenations.
2024-01-10 22:39:55 +00:00
Andrius Štikonas 969f42155b
Merge pull request #404 from rick-masters/add-curl-header-for-download
Add curl header to bypass suspected savannah throttling.
2024-01-10 22:36:48 +00:00
Andrius Štikonas 78a7a5e222
Merge pull request #403 from rick-masters/fix-download-error
Convert status_code to string for error message.
2024-01-10 22:36:29 +00:00
rick-masters 82235e5bd0 Account for int and NoneType in string concatenations. 2024-01-10 18:03:50 +00:00
rick-masters 7a0f03678c Add curl header to bypass suspected savannah throttling. 2024-01-10 17:46:15 +00:00
rick-masters 468aeb07a7 Convert status_code to string for error message. 2024-01-10 17:32:06 +00:00
fosslinux 5b7175de3e
Merge pull request #401 from stikonas/weak_symbols
Fix weak symbols to work in tcc.
2024-01-10 07:20:54 +00:00
fosslinux b2747cb6cf
Merge pull request #392 from Googulator/bare-metal-move-disk
Make move_disk work on bare metal
2024-01-10 07:16:32 +00:00
fosslinux f51fb080b1
Merge pull request #391 from Googulator/bare-metal-linux
Make the Linux kernel & Fiwix->Linux kexec more bare-metal-friendly
2024-01-10 07:16:20 +00:00
fosslinux 01a4f90378
Merge pull request #388 from Googulator/kernel-bootstrap-jobs
Restore multicore build support with kernel-bootstrap
2024-01-10 07:16:10 +00:00
fosslinux 31753cccb5
Merge pull request #386 from Googulator/debug-trap
Support interactive issue resolution prompts
2024-01-10 07:15:33 +00:00
Andrius Štikonas be15f9caca Fix weak symbols to work in tcc.
Fixes #322.
2024-01-09 22:52:43 +00:00
Andrius Štikonas 959ea69742
Merge pull request #398 from Googulator/after-fix
Fix spelling of sysrq-trigger in after.sh
2024-01-09 22:45:54 +00:00
Gábor Stefanik 50d1d68f99 Restore multicore build support with kernel-bootstrap
This was removed as part of the simplify refactor, severely slowing
down qemu and bare-metal builds. Restoring it brings us back to the
same build times that we saw before the refactor.
2024-01-08 12:56:15 +01:00
Gábor Stefanik a76fac4fa7 Allow update_env to incorporate runtime changes to bootstrap.cfg
Perform variable substitution at runtime, rather than at generation
time. This way, if bootstrap.cfg changes after update_env, the new
values there take effect immediately.
2024-01-08 12:55:19 +01:00
Gábor Stefanik a0f13c0ed2 Support interactive issue resolution prompts
This adds a new flag, -i / --interactive, which enables opening a
Bash prompt whenever something goes wrong in the bootstrap. This is
highly useful when developing or debugging live-bootstrap, but it
needs to be off by default, for use in automated processes.

In the future, asking for variables at runtime could (and perhaps
should) also be gated behind this flag.
2024-01-08 12:54:23 +01:00
Gábor Stefanik 82062143a4 Fix spelling of sysrq-trigger in after.sh 2024-01-08 12:43:31 +01:00
fosslinux 9ec45654cf
Merge pull request #390 from Googulator/devtmpfs
Use devtmpfs, and improve finalize_fhs.sh
2024-01-08 10:55:57 +00:00
fosslinux 4a822e231c
Merge pull request #389 from Googulator/after
After bootstrap, drop to a shell if needed, then shut down cleanly
2024-01-08 10:55:21 +00:00
fosslinux e44748cce1
Merge pull request #387 from Googulator/swap-support
Support swap files in qemu or bare-metal mode
2024-01-08 10:52:05 +00:00
fosslinux 0ffe5b5e71
Merge pull request #385 from Googulator/script-generator-uninit
Fix uninitialized variables in script-generator
2024-01-08 10:47:53 +00:00
Gábor Stefanik 2a095a3301 After bootstrap, drop to a shell if needed, then shut down cleanly 2024-01-08 05:19:19 +01:00
rick-masters 1bffe44154
Upgrade Fiwix to 1.5.0-lb1, pulling from upstream Mikaku repo. (#397) 2024-01-08 01:37:15 +00:00
Gábor Stefanik d5008f93a5 Support swap files in qemu or bare-metal mode
This can help alleviate memory pressure when bootstrapping
with high core counts.
2024-01-02 04:32:08 +01:00
Gábor Stefanik 82c570694a Make the Linux kernel & Fiwix->Linux kexec more bare-metal-friendly
* Enable additional hardware drivers in Linux for better bare metal
  display, network & input device compatibility
* Disable ATA-over-Ethernet support, because it spams the network
  with unnecessary packets, is basically useless for bootstrapping,
  and may even be a security risk
* Increase Fiwix initrd size to 1280MB to fit a larger Linux build
* Make the Fiwix kexec size configurable the same way as initrd
  (and reduce from 280MB to 256MB which is sufficient in my testing)
* Use a more conservative memory map for Fiwix & Linux
* Boot Linux with consoleblank=0 on bare metal, so the build won't
  go blind after 5 minutes
* Support kexec-fiwix with interrupts disabled (will be useful later
  when builder-hex0 is updated)
2024-01-02 01:33:09 +01:00
Gábor Stefanik 6c2144e50a Make move_disk work on bare metal
* Use -S32 -H64 --force to trick sfdisk into allowing MiB-aligned
  partitions on a drive that reports a CHS geometry
* Explicitly create partition at sector 2097152 (=1GiB)
* Force mkfs.ext4 to overwrite any existing filesystem it might find
* Wait up to 2 minutes for the disk to become readable (especially
  USB drives often show up with a delay)
2024-01-02 00:57:29 +01:00
Gábor Stefanik 8341c4e089 Use devtmpfs, and improve finalize_fhs.sh
With this, finalize_fhs.sh can be rerun as needed, e.g. when rebooting.
Also, the preferred nameserver will persist after DHCP.

Thanks to devtmpfs, we no longer need to manage /dev once Linux is up.
2024-01-02 00:15:32 +01:00
Gábor Stefanik 9384a5d432 Support "!=" comparisons in script-generator 2024-01-02 00:14:00 +01:00
Gábor Stefanik f9cf916e5e Fix uninitialized variables in script-generator 2024-01-02 00:11:29 +01:00
Andrius Štikonas 133c05426c
Merge pull request #384 from eduardosm/update-curl
Update curl to 8.5.0
2024-01-01 21:41:39 +00:00
Eduardo Sánchez Muñoz 5610998a4d Update curl to 8.5.0 2024-01-01 22:39:24 +01:00
Andrius Štikonas 43df581f68
Merge pull request #383 from fosslinux/ca-certificates-3.95
Update ca-certificates to 3.95
2024-01-01 20:09:51 +00:00
fosslinux fbb3e97149 Update ca-certificates to 3.95 2023-12-29 12:14:27 +11:00
fosslinux b59170519f
Merge pull request #371 from eduardosm/sysabc-refs
Update `parts.rst` to remove remaining references to sysa/sysb/sysc
2023-12-28 22:27:51 +00:00
fosslinux c1a1ef64e7
Merge pull request #378 from Googulator/message-fix
Fix "Bootstrapping" message being printed too late in bwrap runs
2023-12-28 22:26:36 +00:00
fosslinux 813ec9498a
Merge pull request #380 from eduardosm/patch-1
Change "tmp/" to "target/" in .gitignore
2023-12-28 22:25:51 +00:00
Eduardo Sánchez Muñoz c42dd53634 Update `parts.rst` to remove remaining references to sysa/sysb/sysc 2023-12-28 20:04:37 +01:00
Eduardo Sánchez Muñoz 18919e03f4
Change "tmp/" to "target/" in .gitignore 2023-12-28 12:57:06 +01:00
Gábor Stefanik bb067d2856 Fix "Bootstrapping" message being printed too late in bwrap runs
This should be printed at the beginning, but instead is only shown
at the end, due to output buffering - force an explicit flush.
2023-12-28 07:25:35 +01:00
fosslinux 9afe93298c
Merge pull request #373 from eduardosm/avoid-double-slash
Avoid double slash (`//`) in generated scripts
2023-12-27 23:10:54 +00:00
fosslinux f4c1b488d6
Merge pull request #372 from Googulator/automake-fix
Fix intermittent failure to build automake-1.15.1 in bwrap (#365)
2023-12-27 22:59:48 +00:00
fosslinux 51fe3f9991
Merge pull request #368 from Googulator/always-preserve
Rename tmpdir to target and always preserve it, dropping --preserve
2023-12-27 22:59:23 +00:00
fosslinux ca0e701ee8
Merge pull request #360 from eduardosm/fixes
Avoid deleting sources that will be needed in future builds and fix updating checksums with `--update-checksums`
2023-12-27 22:59:11 +00:00
Eduardo Sánchez Muñoz 45b635ef97 Do update checksums when building with `--update-checksums` 2023-12-27 12:36:46 +01:00
Eduardo Sánchez Muñoz 9042539165 Avoid deleting sources that will be needed in future builds 2023-12-27 12:36:46 +01:00
Eduardo Sánchez Muñoz fc6aee0c5f Avoid double slash (`//`) in generated scripts
e.g., put `bash /steps/1.sh` instead of `bash /steps//1.sh`
2023-12-27 12:32:55 +01:00
Gábor Stefanik c8837203c8 Fix intermittent failure to build automake-1.15.1 in bwrap (#365) 2023-12-27 08:06:51 +01:00
Gábor Stefanik 81e3123262 Rename tmpdir to target and always preserve it, dropping --preserve
There is nothing temporary about our "tmpdir" - its sole purpose is to
contain the final product of the bootstrap process. Thus, removing it
at the end of bootstrap amounts to doing the entire process for nothing.

To remedy this, --tmpdir is renamed --target, keeping the -t short form,
and defaulting to "target" instead of "tmp" to make its purpose clearer.
The --preserve option is removed, as the target is now always preserved.
2023-12-26 16:34:04 +01:00
fosslinux 9179f4bd01 Binutils 2.41 fix gprofng in pass2
A fix i forgot to include in the original PR
2023-12-26 22:50:18 +11:00
fosslinux 81790a3271
Merge pull request #361 from Googulator/fix-bwrap
Fix bubblewrap support & CI workflows after simplify
2023-12-26 05:22:30 +00:00
Gábor Stefanik fe9cb1222f Change pass2 -> pass3 transition to the same mechanism as pass1 -> pass2
Fixes pass3 prematurely reporting success and quitting, having built nothing.
2023-12-26 13:01:24 +11:00
Gábor Stefanik f67c7d1144 Tolerate externals/distfiles already existing (needed for CI) 2023-12-26 13:01:24 +11:00
Gábor Stefanik 896c618bd1 Re-copy distfiles on generator.reuse() 2023-12-26 13:01:24 +11:00
Gábor Stefanik 30fb367e7a Simplify bwrap setup code and support more than 3 passes 2023-12-26 13:01:24 +11:00
Gábor Stefanik 63c0a52067 Fix external & distfiles directory paths for CI 2023-12-26 13:01:24 +11:00
Gábor Stefanik 591959924f Re-acquire missing sources before each CI pass 2023-12-26 13:01:24 +11:00
Gábor Stefanik 2c6ac94974 Replace --clearenv with env - to support older bwrap
This makes bwrap work on Debian 10.
2023-12-26 13:01:24 +11:00
Gábor Stefanik 97f31072ce Add license information to break.sh
Not that it's exactly copyrightable, being just "exit 0", but linter complains about it.
2023-12-26 13:01:24 +11:00
Gábor Stefanik 2823e16325 Update CI workflows to match changes from simplify 2023-12-26 13:01:24 +11:00
Gábor Stefanik e9787b55c8 Add breakpoints between passes for INTERNAL_CI
These are implemented as dummy jumps with a script that just exits
with success. Since this script will be sourced, rather than called,
this causes the bootstrap process to exit at that point.
The breakpoints are conditional on INTERNAL_CI (we check for "pass1"
because that's the only pass when script-generator runs, but the
resulting effect is that each pass only bootstraps its own part of
the manifest).
2023-12-26 13:01:24 +11:00
Gábor Stefanik f66f9efa2c Update bwrap bootstrap code to match the simplify refactor 2023-12-26 13:01:24 +11:00
Gábor Stefanik 1481ad0d20 Do not try to create /dev nodes under chroot/bwrap 2023-12-26 13:01:24 +11:00
Gábor Stefanik 9ed4ae9a59 Support reusing existing directory for multipass bootstrapping 2023-12-26 13:01:24 +11:00
fosslinux 3fd101e70a
Merge pull request #359 from fosslinux/binutils-2.41
Update binutils to 2.41
2023-12-26 01:53:39 +00:00
fosslinux 6905852107
Merge pull request #354 from Googulator/script-fixes
Python script fixes and improvements
2023-12-26 00:59:34 +00:00
fosslinux 7d0e1c0e75
Merge pull request #366 from Googulator/reproducible-linux
Fix non-reproducible Linux kernel build due to timestamps
2023-12-26 00:22:32 +00:00
Gábor Stefanik 47711cfea9 Fix non-reproducible Linux kernel build due to timestamps
Linux's KBUILD doesn't follow SOURCE_DATE_EPOCH, but rather it
uses its own variable, KBUILD_BUILD_TIMESTAMP.

While we are at it, also update kexec-linux's checksum, which
didn't match either. (This one was reproducible, it was just
out of date.)
2023-12-25 10:16:17 +01:00
Gábor Stefanik 529ea4cae1 Explain significance of build-bash and improve-network directives 2023-12-22 13:12:40 +01:00
Gábor Stefanik ab9455f918 Fix warnings in existing code revealed by newer pylint 2023-12-22 13:08:23 +01:00
Gábor Stefanik be1333ee8b Make tmpdir a method parameter of prepare()
Fixes pylint errors.
2023-12-22 13:08:20 +01:00
Gábor Stefanik b45e1f81ae Fix failure with --external-sources 2023-12-22 13:07:45 +01:00
Gábor Stefanik 32dc4c702b More verbose error message on HTTP errors 2023-12-22 13:07:45 +01:00
Gábor Stefanik 55d3c36e09 Move kernel-bootstrap source image out of the directory it's generated from
This way, an incomplete version of the image itself won't get included
in srcfs anymore.
2023-12-22 13:07:45 +01:00
Gábor Stefanik 3305f2a41b Use manifest to deduce pre-network sources list
No need to maintain a separate pre-network-sources file anymore,
the list is instead derived from the bootstrap manifest via the
source manifest.
2023-12-22 13:07:04 +01:00
Gábor Stefanik a68ae62f9e Download distfiles only when needed, based on manifest
Unless --external-sources is given, only download distfiles that
need to be included in srcfs. The rest will be downloaded anyway
by the bootstrap system once it gets network access.

To accomplish this, instead of searching steps for sources files,
we now parse steps/manifest. As a side effect, source_manifest.py
now outputs source files in the order they appear in the manifest.
2023-12-22 13:07:04 +01:00
Gábor Stefanik 8d193df823 Fix printed image paths for bare-metal bootstrap 2023-12-22 13:06:59 +01:00
Gábor Stefanik faad907fba Fix source_manifest.py in light of the recent refactor
There's no sysa or sysc anymore.
2023-12-22 13:06:19 +01:00
Gábor Stefanik c188185ad4 Remove residual references to sysa/sysb/sysc from rootfs.py 2023-12-22 13:06:19 +01:00
Gábor Stefanik b4d9c5e7cb Disk creation improvements
* Support specifying the size of the target disk image for qemu
* For bare metal, only pad the image to the next megabyte
* Use truncate() to extend images, instead of writing zeros (faster)
* Return None from get_disk() with nonexistent name
* Leave 1MiB on non-boot disks, or 1GiB on boot disks, unpartitioned
  (for proper 4K alignment and to help preserve the srcfs or boot
  partition creation)
* Fix qemu invocation when an external.img is not used
* Make -qr work with kernel bootstrap (will need kexec-fiwix fix)
2023-12-22 13:06:19 +01:00
Gábor Stefanik dc62d8242c Create external.img only when needed 2023-12-22 12:10:09 +01:00
fosslinux 191c013e23 Update binutils to 2.41 2023-12-21 11:03:15 +11:00
Andrius Štikonas 55ad47acd7
Merge pull request #357 from Googulator/amd64-archdir-fix
AMD64 archdir fix
2023-12-19 21:11:28 +00:00
Gábor Stefanik abca1a4b15 Fix ARCH vs ARCH_DIR confusion causing amd64 breakage 2023-12-19 18:32:59 +01:00
fosslinux 545bb42ca8
Merge pull request #334 from fosslinux/simplify
Simplify + Sustainability
2023-12-15 11:54:29 +00:00
fosslinux ac4a8c7e79 Install heirloom-devtools utility files to /usr/lib
Before they were just in / for no real reason
2023-12-15 22:51:00 +11:00
fosslinux ab47483a51 Linters & CI updates 2023-12-15 21:44:43 +11:00
fosslinux ff4f97ab8f Update all checksums 2023-12-15 21:44:27 +11:00
fosslinux ee77ef837d Update docs with new changes 2023-12-15 21:43:21 +11:00
fosslinux e06a19f9e2 Create a proper Linux kernel package 2023-12-15 21:43:21 +11:00
fosslinux 05c13dd64e Modify rootfs.py infrastructure to support the new layout 2023-12-15 21:43:21 +11:00
fosslinux 6ed2e09f3a Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
2023-12-15 21:43:19 +11:00
fosslinux 0907cfd073 Add script-generator 2023-12-15 21:41:42 +11:00
fosslinux d13320dbfa
Merge pull request #344 from fosslinux/simplify-kexec-prepare
Simplify - kexec preparations
2023-12-15 10:40:04 +00:00
fosslinux 93682cbb92 Expand kexec fiwix initramfs 2023-12-15 21:38:09 +11:00
fosslinux 08bd0ef495 Support command execution in kexec linux arg
! means execute the argument as a command
2023-12-15 21:37:27 +11:00
fosslinux cef781a9f6
Merge pull request #343 from fosslinux/coreutils-stat
Build stat for coreutils
2023-12-15 10:36:16 +00:00
fosslinux d4e0fc9911
Merge pull request #341 from fosslinux/early-tools
Early tools in subdirectories
2023-12-15 10:35:59 +00:00
fosslinux 829f18d604 Rename sysa.ext2 to fiwix.ext2 2023-12-15 21:35:12 +11:00
fosslinux a0d4598028 Move checksum-transcriber to a subdirectory 2023-12-15 21:35:12 +11:00
fosslinux ddd8c8d380 Move simple-patch into a subdirectory
Add a checksum as well.

Closes #323
2023-12-15 21:35:12 +11:00
fosslinux 341a4681f5 Give kexec-fiwix a version number 2023-12-15 21:35:12 +11:00
fosslinux 73c4985aba
Merge pull request #340 from fosslinux/kaem-improv
Kaem-era improvements
2023-12-15 10:34:55 +00:00
fosslinux acddacbe6d
Merge pull request #337 from fosslinux/tarball-unify
Use Linux headers 4.9.10
2023-12-15 10:34:41 +00:00
fosslinux bb6fda569f Build stat for coreutils as well 2023-12-05 15:53:14 +11:00
Andrius Štikonas 70b7bc7f83
Merge pull request #342 from MaxHearnden/sysa-comma 2023-11-29 22:58:05 +00:00
MaxHearnden 773cc5405c add comma to list in sysa.py 2023-11-28 22:50:47 +00:00
fosslinux fc5fc39569 Use (/usr/lib/mes, /usr/include/mes), (/usr/lib, /usr/include)
Mes is now self-contained in;
/usr/lib/mes
/usr/include/mes
/usr/lib/x86-mes

musl adheres to FHS
/usr/include
/usr/lib
2023-11-28 16:56:04 +11:00
fosslinux 1b47720cbc Use uppercase variables in kaem-era
lowercase variables are inconsistent, bring them into line with rest of
live-bootstrap
2023-11-28 16:56:04 +11:00
fosslinux f7c028b588 Nit: simple-patch line length 2023-11-28 16:40:13 +11:00
fosslinux fcaaad8105 Change linux headers to 4.9.10 instead of 5.10.41
Unifies tarball distfiles.
2023-11-28 16:35:41 +11:00
fosslinux fb408c17dd
Merge pull request #338 from MaxHearnden/openssl-1.1.1l
change openssl source in sysc/python-3.11/sources
2023-11-28 05:34:44 +00:00
MaxHearnden 9c8c262f24 change openssl source in sysc/python-3.11/sources 2023-11-28 04:54:46 +00:00
fosslinux 28461d7890 Fix handling of extract 2023-11-28 12:02:50 +11:00
fosslinux fee6175504 Nit: add set -ex to kexec-fiwix 2023-11-28 12:02:19 +11:00
Googulator ed9f268bc8 Change openssl source URL because the old one redirects to HTTPS 2023-11-28 11:41:27 +11:00
fosslinux 1aa0b2103c
Merge pull request #336 from rick-masters/fix-run-as-root
Return process from run_as_root.
2023-11-27 22:01:50 +00:00
rick-masters 4cf2b860ef Fix lint warning for unnecessary else block. 2023-11-27 14:10:37 +00:00
rick-masters 4d20284f85 Return process from run_as_root. 2023-11-27 13:55:05 +00:00
Andrius Štikonas ca2ba18b60 Build simple-patch for rather than hardcoded x86. 2023-11-24 00:58:24 +00:00
fosslinux eb6cbad712
Merge pull request #333 from fosslinux/tinycc_upgrade
Update to newer bootstrappable tcc snapshot.
2023-11-20 05:26:00 +00:00
Andrius Štikonas f98161581c Update to newer bootstrappable tcc snapshot. 2023-11-19 15:49:59 +00:00
Andrius Štikonas c38a58e474
Merge pull request #331 from fosslinux/mes-0.25
Mes 0.25
2023-11-15 19:18:40 +00:00
Andrius Štikonas 737bf61a26 Add amd64 and riscv64 checksums. 2023-11-15 09:56:22 +00:00
Andrius Štikonas 9b81f13714
Merge pull request #326 from nanonyme/sudo-helper
Add a wrapper for commmands needing sudo that checks if you are euid 0
2023-11-14 23:29:52 +00:00
Andrius Štikonas abb46a27b3 Update to mes-0.25. 2023-11-14 00:37:11 +00:00
Andrius Štikonas aae7c4a672 Update stage0-posix to 1.6.0 2023-11-12 20:31:17 +00:00
Seppo Yli-Olli f893df52fe Add a wrapper for commmands needing sudo that checks if you are euid 0 2023-11-08 17:34:56 +02:00
fosslinux 7747e86834
Merge pull request #325 from nanonyme/python2.5
Fix Python 2.5.6 for parallel pgen invocation
2023-11-07 23:44:31 +00:00
Seppo Yli-Olli f9ed2d7a42 Fix Python 2.5.6 for parallel pgen invocation
Backported from 9828b56347.patch
2023-11-07 09:08:34 +02:00
fosslinux 47feb75b08 Move to a different HTTP source for pkg-config 2023-11-07 10:54:13 +11:00
Andrius Štikonas 493ddfa829 Fix a typo.
Closes #318
2023-08-20 01:43:13 +01:00
fosslinux 80e65b7c23
Merge pull request #315 from ajherchenroder/Add-dev-nodes-to-sysc
Add dev nodes to sysc
2023-08-09 22:23:04 +00:00
ajherchenroder 7be4933ab1 Update after.sh to add dev nodes for 3 disks and 3 NVME drives with 3 partitions each.
Update after.sh to add dev nodes for 3 disks and 3 NVME drives with 3 partitions each
fix HD and NVME device major and minor numbers add cd drive
correct indentation
2023-08-09 08:23:35 -04:00
fosslinux fd9e8d547f
Merge pull request #314 from pder/gcc-13-disable-ssp
gcc 13.1.0: don't enable default ssp or pie
2023-07-29 00:21:28 +00:00
Paul Dersey 184535e2df gcc 13.1.0: don't enable default ssp or pie and remove libssp_nonshared.patch 2023-07-24 10:08:26 -04:00
fosslinux 46d80b8605
Merge pull request #313 from stikonas/meslibc+tcc
Build libc+tcc with mes rather than mes-m2.
2023-07-24 06:29:36 +00:00
Andrius Štikonas 10fd92f9c7 Build libc+tcc with mes rather than mes-m2. 2023-07-23 17:03:32 +01:00
Andrius Štikonas 8d96234d22
Merge pull request #311 from doraskayo/missing-dev-nodes
Mount a few missing device nodes in chroot bootstrap modes
2023-07-16 20:55:40 +01:00
Dor Askayo 2227a2053a Mount a few missing device nodes in chroot bootstrap modes
The gap between the chroot and non-chroot bootstrap modes started in,
7ecad37 because BuildStream's sandbox was missing some device nodes.

With the latest version of buildbox-run-bubblewrap, a few of the
missing devices were made available to BuildStream's sandbox and
there is no longer a need to keep this gap. In fact, compatibilty
with newer BuildStream versions now requires these devices to be
present.

This change also partially reverts d0a5221, which had to remove
/dev/ptmx as a consequence of the aforementioned gap.
2023-07-16 01:41:01 +03:00
Andrius Štikonas b3ffe8bb19
Merge pull request #310 from doraskayo/avoid-variable-export-2
Avoid exporting variables
2023-07-14 20:05:27 +01:00
Andrius Štikonas 9638a796e9
Merge pull request #309 from doraskayo/clean-run-env 2023-07-14 08:52:59 +01:00
Dor Askayo 7123b48876 Use "declare -x" to export variables in openssl-1.1.1l.sh
This avoid polluting the environment of every package build that
follows.
2023-07-14 09:57:18 +03:00
Dor Askayo 5b058a2b81 Use "declare -x" to export variables in autogen-5.18.16
Using the "declare -x" build-in instead of "export" allows variables
to be exported only to child processes that are executed in the scope
of the function in which the variables are declared, including nested
function calls.

This avoid polluting the environment of every package build that
follows.
2023-07-14 09:57:18 +03:00
Dor Askayo 6276da59cd Avoid exporting base_dir in linux-headers-5.10.41
It's not expected to be used by child processes.
2023-07-14 09:57:18 +03:00
Dor Askayo 1026440104 Avoid exporting the DISK variable
It's not expected to be used by child processes.
2023-07-14 09:57:18 +03:00
Dor Askayo 3da50962fd Run run.sh with a clean environment
All expected environment variables are passed through the .env file.
Any other variable passed from /init and the environment in which it
is executed only "pollutes" the build environment.

No change in package hashes.
2023-07-13 20:56:36 +03:00
Dor Askayo b58c513e8f Define PATH in the sysb .env file 2023-07-13 20:56:36 +03:00
Dor Askayo 3479d65f58 Remove unnecessary definition of environment variables
These are already made available to run2.sh through the .env file.
2023-07-13 18:42:56 +03:00
Dor Askayo 5899991961 Avoid defining environment variables twice
No change in behavior.
2023-07-13 18:42:56 +03:00
fosslinux 49a2676551
Merge pull request #308 from rick-masters/fix-collect2-faults-with-new-fiwix
Update Fiwix to v1.4.0-lb3 to pull in timestamp improvements
2023-07-07 23:21:08 +00:00
rick-masters 5e5f309db7 Update Fiwix to v1.4.0-lb3 to pull in timestamp improvements and other fixes. 2023-07-06 23:29:37 +00:00
Andrius Štikonas 83013cea5e
Merge pull request #305 from pder/bare-metal-no-serial-console
Boot Fiwix and Linux without serial console on bare metal
2023-06-25 14:01:19 +01:00
Paul Dersey 5b9fd08dc0 Don't use serial console with bare metal option and user provided kernel 2023-06-19 09:24:55 -04:00
Paul Dersey c61b4afd8a Boot Fiwix and Linux without serial console on bare metal 2023-06-15 11:18:51 -04:00
Andrius Štikonas 7a31257eaa
Merge pull request #302 from eduardosm/reuse-cleanup
Clean up reuse information of files that do not exist any longer
2023-06-13 19:44:58 +01:00
Eduardo Sánchez Muñoz d75114d4a4 Clean up reuse information of files that do not exist any longer 2023-06-13 18:03:23 +02:00
fosslinux 48df095226
Merge pull request #301 from stikonas/musl-1.2.4
Update to musl 1.2.4.
2023-06-13 08:03:24 +00:00
Andrius Štikonas 914b84377a Update to musl 1.2.4. 2023-06-12 19:31:30 +01:00
Andrius Štikonas f531e1cc5f Remove -nostdlib when linking mes. 2023-06-09 23:22:30 +01:00
fosslinux e3a2ca1b3f
Merge pull request #299 from pder/gzip-regen-crc
gzip: Regenerate crc table in util.c using makecrc
2023-06-06 07:49:32 +00:00
Paul Dersey 247b2a2a89 gzip: Regenerate crc table in util.c using makecrc 2023-06-05 10:50:57 -04:00
Paul Dersey 87601931b2 Write simple-patch binary to ${bindir} and remove hard coded paths 2023-06-05 10:50:57 -04:00
fosslinux 82f2204f91
Merge pull request #298 from rick-masters/fix-baremetal-config
Generate bootstrap.cfg for bare metal.
2023-05-27 23:25:36 +00:00
rick-masters d2870cf17a Generate bootstrap.cfg for bare metal. 2023-05-26 12:16:06 +00:00
fosslinux 9dffcd7c8a
Merge pull request #296 from emilytrau/uniq-fopen
Backport `uniq` fopen patch
2023-05-22 21:38:00 +00:00
Emily Trau a8752029f6 Backport `uniq` fopen patch 2023-05-22 21:30:22 +10:00
Andrius Štikonas 87e9d7db9d
Merge pull request #295 from rick-masters/kernel-bootstrap-phase2-v1
Kernel bootstrap phase2 v1
2023-05-21 01:26:04 +01:00
rick-masters ef08891401 Convert file size to 32-bit type before writing. 2023-05-21 00:11:37 +00:00
rick-masters 1603b81602 Fix printf calls and use puts when possible. 2023-05-20 15:20:01 +00:00
rick-masters 0d4394aa0d Build kexec-linux later as a package for musl lib calls instead of asm. 2023-05-20 15:16:27 +00:00
Andrius Štikonas 26552a928f Increase disk size to 16G. 2023-05-20 12:46:22 +01:00
rick-masters 8604871997 Pull builder-hex0-x86-stage1 from updated stage0-posix and lint fixes. 2023-05-18 10:59:46 +00:00
rick-masters 68429917c0 Use code blocks and capitalize consistently and other improvements. 2023-05-18 10:58:53 +00:00
rick-masters 12026cb100 Document the new builder-hex0-x86 boot stages.
Describe the kernel bootstrap steps first to avoid confusion because
we do not actually start with the stage0-posix binary seeds if the default
kernel bootstrap option is used.
2023-05-10 17:21:16 +00:00
rick-masters a2fcf1ced9 Complete the kernel bootstrap by adding kexec of Linux from Fiwix.
A tiny bootloader bootstrap has been added to compile the builder-hex0 kernel from hex0 source.
The boot compiler is builder-hex0-x86-stage1.hex0 and builder-hex0-x86-stage1.bin.
The builder-hex0 kernel is now named builder-hex0-x86-stage2.hex0.
The inclusion of a binary seed resolves the problem with the previous strategy which used an
architecture-specific hex0 compiler.

If sysb detects a full disk (i.e. DISK=sda) it now partitions the disk unconditionally because
previously fdisk was reporting existing but empty partitions which resulted in no
parititions being created.

e2fsprogs is now built with --disable-tls because musl was built on Fiwix without full threading
support and mkfs.ext4 was crashing without disabling thread local storage.

kexec-linux writes the linux kernel and initramfs to a RAM drive on Fiwix which ensure
a pre-allocated contiguous memory block. The following is written to the ram drive:
a 32-bit number which is the size of the kernel in bytes, a 32-bit number which is the size
of the initramfs in bytes, followed by the Linux kernel image, followed by the initramfs.

kexec-fiwix invokes a sync syscall to ensure all writes are flushed to
the ram drive and then initiates the kexec by shutting down Fiwix with a reboot syscall.
Fiwix knows whether and how to perform the kexec based on kernel parameters passed to it.
2023-05-10 14:33:42 +00:00
fosslinux e86db47b6e
Merge pull request #286 from fosslinux/ci-length
split CI into three (as a temporary solution)
2023-05-10 07:30:52 +00:00
fosslinux 724c6cca13
Merge pull request #293 from fosslinux/gcc-13
GCC 13
2023-05-10 07:30:40 +00:00
fosslinux a4e5829971
Merge pull request #290 from emilytrau/coreutils-pass-1
Enable additional tools in coreutils-5.0 phase 1
2023-05-09 12:45:01 +00:00
fosslinux aa2d6c4137 Update to GCC 13
The latest version of GCC.

Luckily this allows for a bunch of patches to be dropped - apart from
that, no significant change.
2023-05-09 22:41:45 +10:00
fosslinux e2ceb13e57 Expand sysc disk 2023-05-09 22:41:04 +10:00
fosslinux ce33a6e9f9 Actually, split into 3, sysc is too long 2023-05-04 22:15:35 +10:00
fosslinux f124bc86be Work around GH actions time limit
by splitting sysa and sysc into 2
2023-05-04 07:33:17 +10:00
Emily Trau 7a13158e79 Enable additional tools in coreutils-5.0 phase 1
These utilities can be enabled with only a small amount of additional
patches. In particular sort, expr, uniq,and hostname are used by some
./configure.sh scripts.
2023-05-02 23:21:46 +10:00
fosslinux dd7905c05c
Merge pull request #289 from rick-masters/fix-sysc-dhcpcd
Fix dhcpd version in sysc/init.
2023-05-01 21:39:22 +00:00
rick-masters 9b37fa2ed7 Fix dhcpd version in sysc/init. 2023-05-01 21:06:40 +00:00
fosslinux 3723747562 Add internal-ci argument for ci passes to rootfs.py 2023-05-01 20:53:48 +10:00
684 changed files with 32625 additions and 9304 deletions

View File

@ -12,8 +12,8 @@ on:
- master
jobs:
run:
name: Run under bubblewrap
pass1:
name: Run up to Linux build under bubblewrap
runs-on: ubuntu-latest
steps:
- name: Install bubblewrap
@ -30,9 +30,8 @@ jobs:
uses: actions/cache/restore@v3
with:
path: |
sysa/distfiles
sysc/distfiles
key: cache-${{ hashFiles('sys*/*/sources') }}
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Get sources
if: steps.cache.outputs.cache-hit != 'true'
run: ./download-distfiles.sh
@ -41,15 +40,119 @@ jobs:
uses: actions/cache/save@v3
with:
path: |
sysa/distfiles
sysc/distfiles
key: cache-${{ hashFiles('sys*/*/sources') }}
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap
id: bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --preserve --cores 2
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1
- name: Archive created packages
if: always() # archive failed builds
if: failure() # archive failed builds progress
uses: actions/upload-artifact@v3
with:
name: packages
path: tmp/sysa/sysc_image/usr/src/repo/**
path: target/external/repo/**
- name: Tar pass1 image
run: tar -cf pass1_image.tar target
- name: Archive pass1_image
uses: actions/upload-artifact@v3
with:
name: internal_pass1_image
path: pass1_image.tar
pass2:
name: Run up to Python bootstrap under bubblewrap
needs: pass1
runs-on: ubuntu-latest
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
# There is a strange bug(?) in nongnu, when you clone a git repository
# against a commit != HEAD with depth=1, it errors out.
fetch-depth: 0
- name: Get pass1_image
uses: actions/download-artifact@v3
with:
name: internal_pass1_image
- name: Extract pass1_image
run: tar -xf pass1_image.tar
- name: Query cache for sources
id: cache
uses: actions/cache/restore@v3
with:
path: |
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Get sources
if: steps.cache.outputs.cache-hit != 'true'
run: ./download-distfiles.sh
- name: Cache sources
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass2
- name: Archive created packages
if: failure() # archive failed builds progress
uses: actions/upload-artifact@v3
with:
name: internal_packages_pass2
path: target/external/repo/**
- name: Tar pass2 image
run: tar -cf pass2_image.tar target
- name: Archive pass2_image
uses: actions/upload-artifact@v3
with:
name: internal_pass2_image
path: pass2_image.tar
pass3:
name: Run remaining builds under bubblewrap
needs: pass2
runs-on: ubuntu-latest
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
# There is a strange bug(?) in nongnu, when you clone a git repository
# against a commit != HEAD with depth=1, it errors out.
fetch-depth: 0
- name: Get pass2_image
uses: actions/download-artifact@v3
with:
name: internal_pass2_image
- name: Extract pass2_image
run: tar -xf pass2_image.tar
- name: Query cache for sources
id: cache
uses: actions/cache/restore@v3
with:
path: |
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Get sources
if: steps.cache.outputs.cache-hit != 'true'
run: ./download-distfiles.sh
- name: Cache sources
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3
- name: Archive created packages
if: always() # archive both failed and successful builds
uses: actions/upload-artifact@v3
with:
name: packages
path: target/external/repo/**

View File

@ -21,7 +21,7 @@ jobs:
- name: Install pylint
run: sudo pip3 install pylint
- name: pylint
run: pylint rootfs.py sysa.py sysc.py lib/utils.py lib/sysgeneral.py lib/tmpdir.py --disable=duplicate-code
run: pylint rootfs.py lib/utils.py lib/generator.py lib/target.py check_substitutes.py --disable=duplicate-code
shellcheck:
name: Lint shell files
@ -30,7 +30,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3
- name: shellcheck
run: shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh
run: shellcheck steps/helpers.sh download-distfiles.sh
reuse:
name: Lint reuse information
@ -42,3 +42,12 @@ jobs:
run: sudo pip3 install reuse
- name: reuse
run: reuse lint
substitutes:
name: Check validity of substituted tarballs
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Check validity of substitutes
run: ./check_substitutes.py

7
.gitignore vendored
View File

@ -3,9 +3,8 @@
#
# SPDX-License-Identifier: MIT
tmp/
target/
kernel
sysa/distfiles/
sysc/distfiles/
distfiles/
__pycache__
sysa/bootstrap.cfg
steps/bootstrap.cfg

9
.gitmodules vendored
View File

@ -2,7 +2,10 @@
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: MIT
[submodule "seed/stage0-posix"]
path = seed/stage0-posix
url = https://github.com/oriansj/stage0-posix
[submodule "sysa/stage0-posix/src"]
path = sysa/stage0-posix/src
url = https://github.com/oriansj/stage0-posix/
[submodule "builder-hex0"]
path = builder-hex0
url = https://github.com/ironmeld/builder-hex0

View File

@ -9,6 +9,6 @@ Source: https://github.com/fosslinux/live-bootstrap
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
Files: sys*/*/sources sys*/SHA256SUMS.sources sysa/checksum-transcriber.*.SHA256SUM sysa/pre-sha.sha256sums sysa/*/*.checksums sysa/SHA256SUMS.pkgs sysc/musl-1.2.3/ld-musl-i386.path sysa/*/simple-patches/*
Files: steps/*/sources steps/*/*.checksums steps/SHA256SUMS.pkgs steps/*/simple-patches/* seed/*.checksums
Copyright: none
License: MIT

View File

@ -14,31 +14,40 @@ and that a full build completes.
## Structure
Each system corresponds to a reboot of the live environment. There is only one
appropriate structure as shown below (eg for sysa):
```
sysa
├── any-global-files.sh
seed
├── seed.kaem
├── script-generator.c
├── ...
└── stage0-posix
steps
├── manifest
├── any-global-files
├── jump
│   └── linux.sh
├── improve
│   └── x.sh
├── somepackage-version
│   ├── somepackage-version.kaem (or .sh)
│   ├── pass1.kaem
│   ├── pass2.sh
│   ├── files
│   ├── simple-patches
│   ├── mk
│   └── patches
└── tmp
```
Global scripts that drive the entire system go directly under `sysx`. `tmp`
contains the temporary system used for QEMU or a chroot.
The `seed` directory contains everything required for `script-generator` to be
run.
Then, each package is in its own specific directory, named `package-version`.
It then diverges based upon which driver is being used:
- `kaem`: A file named `package-version.kaem` is called by the master script.
- `bash`: The `build` function from helper.sh is called from the master script.
There are default functions run which can be overridden by an optional script
`package-version.sh` within the package-specific directory.
In the `steps` directory, the bootstrap process is defined in `manifest`.
Each package to be built is named `package-version`.
Each subsequent build of a package is the nth pass. Scripts are named
accordingly; eg, the first build would be called `pass1.sh`, the second would be
`pass2.sh`, etc.
Scripts run in kaem era should be denoted as such in their filename;
`pass1.kaem`, for example. Pass numbers do not reset after kaem, ie, you cannot
have both `pass1.kaem` and `pass1.sh`.
In this folder, there are other folders/files. `*.checksums` are
required for early packages that are build with kaem, others are optional.
@ -51,21 +60,16 @@ Permissible folders/files:
- `simple-patches`: patches for the source that use the before/after convention of simple-patch.c
- `*.checksums`: files containing the checksums for the resulting binaries and
libraries that are compiled and installed.
- Up to and including `coreutils-6.10`, `sha256sum` from `stage0-posix`
is used for the checksumming. Later we switch to GNU version.
- To extract checksums of the binaries, use of qemu mode is recommended
(i.e. `./rootfs.py -q -qk $kernel --update-checksums`).
- compilation script
The directory m2-functions is used for M2-Planet functions (currently).
- Otherwise, the package's checksum is in SHA256SUMS.pkgs.
- compilation script(s)
## Conventions
- **Patches:**
- all patches are `-p0`
- all patches begin with a patch header
- **README:**
- all stages are explained in README
- **parts.rst:**
- all packages are explained in `parts.rst`
- **General:**
- Where possible, all blocks of text should be limited to a length of 80
characters.
@ -79,9 +83,3 @@ The directory m2-functions is used for M2-Planet functions (currently).
- Patches are licensed under the license of the project which they are
patching.
- All files (excluding files within submodules) must comply with REUSE v3.0.
## git
All changes must be submitted as PRs. Pushing to master is disallowed, even if
push access is granted to a user. Only pushes to master should be merging of
patches into master.

121
LICENSES/CC0-1.0.txt Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@ -1,298 +0,0 @@
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
Version 1.0
1. Definitions.
1.1. “Contributor” means each individual or entity that creates or contributes
to the creation of Modifications.
1.2. “Contributor Version” means the combination of the Original Software,
prior Modifications used by a Contributor (if any), and the Modifications
made by that particular Contributor.
1.3. “Covered Software” means (a) the Original Software, or (b) Modifications,
or (c) the combination of files containing Original Software with files containing
Modifications, in each case including portions thereof.
1.4. “Executable” means the Covered Software in any form other than Source
Code.
1.5. “Initial Developer” means the individual or entity that first makes Original
Software available under this License.
1.6. “Larger Work” means a work which combines Covered Software or portions
thereof with code not governed by the terms of this License.
1.7. “License” means this document.
1.8. “Licensable” means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently acquired, any and
all of the rights conveyed herein.
1.9. “Modifications” means the Source Code and Executable form of any of the
following:
A. Any file that results from an addition to, deletion from or modification
of the contents of a file containing Original Software or previous Modifications;
B. Any new file that contains any part of the Original Software or previous
Modification; or
C. Any new file that is contributed or otherwise made available under the
terms of this License.
1.10. “Original Software” means the Source Code and Executable form of computer
software code that is originally released under this License.
1.11. “Patent Claims” means any patent claim(s), now owned or hereafter acquired,
including without limitation, method, process, and apparatus claims, in any
patent Licensable by grantor.
1.12. “Source Code” means (a) the common form of computer software code in
which modifications are made and (b) associated documentation included in
or with such code.
1.13. “You” (or “Your”) means an individual or a legal entity exercising rights
under, and complying with all of the terms of, this License. For legal entities,
“You” includes any entity which controls, is controlled by, or is under common
control with You. For purposes of this definition, “control” means (a) the
power, direct or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such entity.
2. License Grants.
2.1. The Initial Developer Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third
party intellectual property claims, the Initial Developer hereby grants You
a world-wide, royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable
by Initial Developer, to use, reproduce, modify, display, perform, sublicense
and distribute the Original Software (or portions thereof), with or without
Modifications, and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using or selling of Original
Software, to make, have made, use, practice, sell, and offer for sale, and/or
otherwise dispose of the Original Software (or portions thereof).
(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date
Initial Developer first distributes or otherwise makes the Original Software
available to a third party under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1)
for code that You delete from the Original Software, or (2) for infringements
caused by: (i) the modification of the Original Software, or (ii) the combination
of the Original Software with other software or devices.
2.2. Contributor Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third
party intellectual property claims, each Contributor hereby grants You a world-wide,
royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable
by Contributor to use, reproduce, modify, display, perform, sublicense and
distribute the Modifications created by such Contributor (or portions thereof),
either on an unmodified basis, with other Modifications, as Covered Software
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or selling of Modifications
made by that Contributor either alone and/or in combination with its Contributor
Version (or portions of such combination), to make, use, sell, offer for sale,
have made, and/or otherwise dispose of: (1) Modifications made by that Contributor
(or portions thereof); and (2) the combination of Modifications made by that
Contributor with its Contributor Version (or portions of such combination).
(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the
date Contributor first distributes or otherwise makes the Modifications available
to a third party.
(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1)
for any code that Contributor has deleted from the Contributor Version; (2)
for infringements caused by: (i) third party modifications of Contributor
Version, or (ii) the combination of Modifications made by that Contributor
with other software (except as part of the Contributor Version) or other devices;
or (3) under Patent Claims infringed by Covered Software in the absence of
Modifications made by that Contributor.
3. Distribution Obligations.
3.1. Availability of Source Code.
Any Covered Software that You distribute or otherwise make available in Executable
form must also be made available in Source Code form and that Source Code
form must be distributed only under the terms of this License. You must include
a copy of this License with every copy of the Source Code form of the Covered
Software You distribute or otherwise make available. You must inform recipients
of any such Covered Software in Executable form as to how they can obtain
such Covered Software in Source Code form in a reasonable manner on or through
a medium customarily used for software exchange.
3.2. Modifications.
The Modifications that You create or to which You contribute are governed
by the terms of this License. You represent that You believe Your Modifications
are Your original creation(s) and/or You have sufficient rights to grant the
rights conveyed by this License.
3.3. Required Notices.
You must include a notice in each of Your Modifications that identifies You
as the Contributor of the Modification. You may not remove or alter any copyright,
patent or trademark notices contained within the Covered Software, or any
notices of licensing or any descriptive text giving attribution to any Contributor
or the Initial Developer.
3.4. Application of Additional Terms.
You may not offer or impose any terms on any Covered Software in Source Code
form that alters or restricts the applicable version of this License or the
recipients rights hereunder. You may choose to offer, and to charge a fee
for, warranty, support, indemnity or liability obligations to one or more
recipients of Covered Software. However, you may do so only on Your own behalf,
and not on behalf of the Initial Developer or any Contributor. You must make
it absolutely clear that any such warranty, support, indemnity or liability
obligation is offered by You alone, and You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty, support, indemnity
or liability terms You offer.
3.5. Distribution of Executable Versions.
You may distribute the Executable form of the Covered Software under the terms
of this License or under the terms of a license of Your choice, which may
contain terms different from this License, provided that You are in compliance
with the terms of this License and that the license for the Executable form
does not attempt to limit or alter the recipients rights in the Source Code
form from the rights set forth in this License. If You distribute the Covered
Software in Executable form under a different license, You must make it absolutely
clear that any terms which differ from this License are offered by You alone,
not by the Initial Developer or Contributor. You hereby agree to indemnify
the Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such terms You
offer.
3.6. Larger Works.
You may create a Larger Work by combining Covered Software with other code
not governed by the terms of this License and distribute the Larger Work as
a single product. In such a case, You must make sure the requirements of this
License are fulfilled for the Covered Software.
4. Versions of the License.
4.1. New Versions.
Sun Microsystems, Inc. is the initial license steward and may publish revised
and/or new versions of this License from time to time. Each version will be
given a distinguishing version number. Except as provided in Section 4.3,
no one other than the license steward has the right to modify this License.
4.2. Effect of New Versions.
You may always continue to use, distribute or otherwise make the Covered Software
available under the terms of the version of the License under which You originally
received the Covered Software. If the Initial Developer includes a notice
in the Original Software prohibiting it from being distributed or otherwise
made available under any subsequent version of the License, You must distribute
and make the Covered Software available under the terms of the version of
the License under which You originally received the Covered Software. Otherwise,
You may also choose to use, distribute or otherwise make the Covered Software
available under the terms of any subsequent version of the License published
by the license steward.
4.3. Modified Versions.
When You are an Initial Developer and You want to create a new license for
Your Original Software, You may create and use a modified version of this
License if You: (a) rename the license and remove any references to the name
of the license steward (except to note that the license differs from this
License); and (b) otherwise make it clear that the license contains terms
which differ from this License.
5. DISCLAIMER OF WARRANTY.
COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN “AS IS” BASIS, WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT
FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY
AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE
PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER
CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION.
THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
6. TERMINATION.
6.1. This License and the rights granted hereunder will terminate automatically
if You fail to comply with terms herein and fail to cure such breach within
30 days of becoming aware of the breach. Provisions which, by their nature,
must remain in effect beyond the termination of this License shall survive.
6.2. If You assert a patent infringement claim (excluding declaratory judgment
actions) against Initial Developer or a Contributor (the Initial Developer
or Contributor against whom You assert such claim is referred to as “Participant”)
alleging that the Participant Software (meaning the Contributor Version where
the Participant is a Contributor or the Original Software where the Participant
is the Initial Developer) directly or indirectly infringes any patent, then
any and all rights granted directly or indirectly to You by such Participant,
the Initial Developer (if the Initial Developer is not the Participant) and
all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon
60 days notice from Participant terminate prospectively and automatically
at the expiration of such 60 day notice period, unless if within such 60 day
period You withdraw Your claim with respect to the Participant Software against
such Participant either unilaterally or pursuant to a written agreement with
Participant.
6.3. In the event of termination under Sections 6.1 or 6.2 above, all end
user licenses that have been validly granted by You or any distributor hereunder
prior to termination (excluding licenses granted to You by any distributor)
shall survive termination.
7. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER
OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION,
DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE
OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF
SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION
MAY NOT APPLY TO YOU.
8. U.S. GOVERNMENT END USERS.
The Covered Software is a “commercial item,” as that term is defined in 48
C.F.R. 2.101 (Oct. 1995), consisting of “commercial computer software” (as
that term is defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer
software documentation” as such terms are used in 48 C.F.R. 12.212 (Sept.
1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
(June 1995), all U.S. Government End Users acquire Covered Software with only
those rights set forth herein. This U.S. Government Rights clause is in lieu
of, and supersedes, any other FAR, DFAR, or other clause or provision that
addresses Government rights in computer software under this License.
9. MISCELLANEOUS.
This License represents the complete agreement concerning subject matter hereof.
If any provision of this License is held to be unenforceable, such provision
shall be reformed only to the extent necessary to make it enforceable. This
License shall be governed by the law of the jurisdiction specified in a notice
contained within the Original Software (except to the extent applicable law,
if any, provides otherwise), excluding such jurisdictions conflict-of-law
provisions. Any litigation relating to this License shall be subject to the
jurisdiction of the courts located in the jurisdiction and venue specified
in a notice contained within the Original Software, with the losing party
responsible for costs, including, without limitation, court costs and reasonable
attorneys fees and expenses. The application of the United Nations Convention
on Contracts for the International Sale of Goods is expressly excluded. Any
law or regulation which provides that the language of a contract shall be
construed against the drafter shall not apply to this License. You agree that
You alone are responsible for compliance with the United States export administration
regulations (and the export control laws and regulation of any other countries)
when You use, distribute or otherwise make available any Covered Software.
10. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is responsible
for claims and damages arising, directly or indirectly, out of its utilization
of rights under this License and You agree to work with Initial Developer
and Contributors to distribute such responsibility on an equitable basis.
Nothing herein is intended or shall be deemed to constitute any admission
of liability.

View File

@ -12,94 +12,91 @@ An attempt to provide a reproducible, automatic, complete end-to-end
bootstrap from a minimal number of binary seeds to a supported fully
functioning operating system.
Get me started!
---------------
How do I use this?
------------------
Quick start:
See ``./rootfs.py --help`` and follow the instructions given there.
This uses a variety of userland tools to prepare the bootstrap.
(*Currently, there is no way to perform the bootstrap without external
preparations! This is a currently unsolved problem.*)
Without using Python:
1. ``git clone https://github.com/fosslinux/live-bootstrap``
2. ``git submodule update --init --recursive``
3. Provide a kernel (vmlinuz file) as the name ``kernel`` in the root of the
repository. **This must be a 32-bit kernel.**
4. ``./rootfs.py --qemu`` - ensure your account has kvm privileges and qemu
installed.
a. Alternatively, run ``./rootfs.py --chroot`` to run it in a chroot.
b. Alternatively, run ``./rootfs.py --bwrap`` to run it in a bubblewrap
sandbox. When user namespaces are supported, this mode is rootless.
c. Alternatively, run ``./rootfs.py`` but dont run the actual
virtualization and instead copy sysa/tmp/initramfs to a USB or
some other device and boot from bare metal. NOTE: we now require
a hard drive. This is currently hardcoded as sda. You also need
to put ``sysc/tmp/disk.img`` onto your sda on the bootstrapping
machine.
d. Alternatively, do not use python at all, see "Python-less build"
below.
5. Wait.
6. If you can, observe the many binaries in ``/usr/bin``! When the
bootstrap is completed ``bash`` is launched providing a shell to
explore the system.
3. Consider whether you are going to run this in a chroot, in QEMU, or on bare
metal. (All of this *can* be automated, but not in a trustable way. See
further below.)
a. **chroot:** Create a directory where the chroot will reside, run
``./download-distfiles.sh``, and copy:
* The entire contents of ``seed/stage0-posix`` into that directory.
* All other files in ``seed`` into that directory.
* ``steps/`` and ``distfiles/`` into that directory.
* At least all files listed in ``steps/pre-network-sources`` must be
copied in. All other files will be obtained from the network.
* Run ``/bootstrap-seeds/POSIX/x86/kaem-optional-seed`` in the chroot.
(Eg, ``chroot rootfs /bootstrap-seeds/POSIX/x86/kaem-optional-seed``).
b. **QEMU:** Create two blank disk images.
* Generate ``builder-hex0-x86-stage1.img`` from hex0 source:
``sed 's/[;#].*$//g' builder-hex0/builder-hex0-x86-stage1-hex0 | xxd -r -p``
* On the first image, write ``builder-hex0-x86-stage1.img`` to it, followed
by ``kernel-bootstrap/builder-hex0-x86-stage2.hex0``, followed by zeros
padding the disk to the next sector.
* distfiles can be obtained using ``./download-distfiles.sh``.
* See the list in part a. For every file within that list, write a line to
the disk ``src <size-of-file> <path-to-file>``, followed by the contents
of the file.
* *Only* copy distfiles listed in ``sources`` files for ``build:`` steps
manifested before ``improve: get_network`` into this disk.
* Optionally (if you don't do this, distfiles will be network downloaded):
* On the second image, create an MSDOS partition table and one ext3
partition.
* Copy ``distfiles/`` into this disk.
* Run QEMU, with 4+G RAM, optionally SMP (multicore), both drives (in the
order introduced above), a NIC with model E1000 (``-nic
user,model=e1000``), and ``-machine kernel-irqchip=split``.
c. **Bare metal:** Follow the same steps as QEMU, but the disks need to be
two different *physical* disks, and boot from the first disk.
Background
----------
This project is a part of the bootstrappable project, a project that
aims to be able to build complete computing platforms through the use of
source code. When you build a compiler like GCC, you need another C
compiler to compile the compiler - turtles all the way down. Even the
first GCC compiler was written in C. There has to be a way to break the
chain…
Problem statement
=================
There has been significant work on this over the last 5 years, from
Jeremiah Orians stage0, hex2 and M2-Planet to jannekes Mes. We have a
currently, fully-functioning chain of bootstrapping from the 357-byte
hex0 seed to a complete GCC compiler and hence a full Linux operating
system. From there, it is trivial to move to other UNIXes. However,
there is only currently one vector through which this can be
automatically done, GNU Guix.
live-bootstrap's overarching problem statement is;
While the primary author of this project does not believe Guix is a bad
project, the great reliance on Guile, the complexity of many of the
scripts and the rather steep learning curve to install and run Guix make
it a very non plug-and-play solution. Furthermore, there is currently
(Jan 2021) no possible way to run the bootstrap from outside of a
pre-existing Linux environment. Additionally, Guix uses many scripts and
distributed files that cannot be considered source code.
> How can a usable Linux system be created with only human-auditable, and
wherever possible, human-written, source code?
(NOTE: Guix is working on a Full Source Bootstrap, but Im not
completely sure what that entails).
Clarifications:
Furthermore, having an alternative bootstrap automation tool allows
people to have greater trust in the bootstrap procedure.
* "usable" means a modern toolchain, with appropriate utilities, that can be
used to expand the amount of software on the system, interactively, or
non-interactively.
* "human-auditable" is discretionary, but is usually fairly strict. See
"Specific things to be bootstrapped" below.
Comparison between GNU Guix and live-bootstrap
----------------------------------------------
Why is this difficult?
======================
+----------------------+----------------------+----------------------+
| Item | Guix | live-bootstrap |
+======================+======================+======================+
| Total size of seeds | ~30MB (Reduced | ~1KB |
| [1] | Source Bootstrap) | |
| | [2] | |
+----------------------+----------------------+----------------------+
| Use of kernel | Linux-Libre Kernel | Any Linux Kernel |
| | | (2.6+) [3] |
+----------------------+----------------------+----------------------+
| Implementation | Yes | No (in development) |
| complete | | |
+----------------------+----------------------+----------------------+
| Automation | Almost fully | Optional user |
| | automatic | customization |
+----------------------+----------------------+----------------------+
The core of a modern Linux system is primarily written in C and C++. C and C++
are **self-hosting**, ie, nearly every single C compiler is written in C.
[1]: Both projects only use software licensed under a FSF-approved
free software license. Kernel is excluded from seed.
[2]: Reiterating that Guix is working on a full source bootstrap,
although that still uses guile (~12 MB). [3]: Work is ongoing to use
other, smaller POSIX kernels.
Every single version of GCC was written in C. To avoid using an existing
toolchain, we need some way to be able to compile a GCC version without C. We
can use a less well-featured compiler, TCC, to do this. And so forth, until we
get to a fairly primitive C compiler written in assembly, ``cc_x86``.
Why would I want bootstrapping?
-------------------------------
Going up through this process requires a bunch of other utilities as well; the
autotools suite, guile and autogen, etc. These also have to be matched
appropriately to the toolchain available.
Why should I care?
------------------
That is outside of the scope of this README. Heres a few things you can
look at:
@ -117,7 +114,7 @@ bootstrapping. However, there are a number of non-auditable files used
in many of their packages. Here is a list of file types that we deem
unsuitable for bootstrapping.
1. Binaries (apart from seed hex0, kaem, kernel).
1. Binaries (apart from seed hex0, kaem, builder-hex0).
2. Any pre-generated configure scripts, or Makefile.ins from autotools.
3. Pre-generated bison/flex parsers (identifiable through a ``.y``
file).
@ -131,56 +128,18 @@ How does this work?
**For a more in-depth discussion, see parts.rst.**
sysa
~~~~
Firstly, ``builder-hex0`` is launched. ``builder-hex0`` is a minimal kernel that is
written in ``hex0``, existing in 3 self-bootstrapping stages.
sysa is the first system used in live-bootstrap. We move to a new
system after a reboot, which often occurs after the movement to a new
kernel. It is run by the seed Linux kernel provided by the user. It
compiles everything we need to be able to compile our own Linux kernel.
It runs fully in an initramfs and does not rely on disk support in the
seed Linux kernel.
This is capable of executing the entirety of ``stage0-posix``, (see
``seed/stage0-posix``), which produces a variety of useful utilities and a basic
C language, ``M2-Planet``.
sysb
~~~~
``stage0-posix`` runs a file called ``after.kaem``. This is a shell script that
builds and runs a small program called ``script-generator``. This program reads
``steps/manifest`` and converts it into a series of shell scripts that can be
executed in sequence to complete the bootstrap.
sysb is the second 'system' of live-bootstrap. This uses the Linux 4.9.10
kernel compiled within sysa. As we do not rely on disk support in sysa, we
need this intermediate system to be able to add the missing binaries to sysc
before moving into it. This is executed through kexec from sysa. At this point,
a SATA disk IS required.
sysc
~~~~
sysc is the (current) last 'system' of live-bootstrap. This is a continuation
from sysb, executed through util-linux's ``switch_root`` command which moves
the entire rootfs without a reboot. Every package from here on out is compiled
under this system, taking binaries from sysa. Chroot and bubblewrap modes skip
sysb, as it is obviously irrelevant to them.
Python-less build
-----------------
Python is no longer a requirement to set up the build system. The
repository is almost completely in a form where it can be used as the
source of a build.
1. Download required tarballs into ``sysa/distfiles`` and ``sysc/distfiles``.
You can use the ``download-distfiles.sh`` script.
2. Copy sysa/stage0-posix/src/* to the root of the repository.
3. Copy sysa/stage0-posix/src/bootstrap-seeds/POSIX/x86/kaem-optional-seed
to init in the root of the repository.
4. Copy sysa/after.kaem to after.kaem
5. Create a CPIO archive (eg, ``cpio --format newc --create --directory . > ../initramfs``).
6. Boot your initramfs and kernel.
chroot builds
~~~~~~~~~~~~~
For chroot based bootstraps you can skip creation of initramfs and instead start bootstrap with
``sudo chroot . bootstrap-seeds/POSIX/x86/kaem-optional-seed``
It is also recommended to copy everything to a new directory as bootstrapping messes up with files
in git repository and cannot be re-run again.
From this point forward, ``steps/manifest`` is effectively self documenting.
Each package built exists in ``steps/<pkg>``, and the build scripts can be seen
there.

1
builder-hex0 Submodule

@ -0,0 +1 @@
Subproject commit a2781242d19e6be891b453d8fa827137ab5db31a

162
check_substitutes.py Executable file
View File

@ -0,0 +1,162 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
"""Check that substituted files are the same."""
import bz2
import filecmp
import gzip
import itertools
import lzma
import shutil
import tarfile
import tempfile
import sys
import os
from lib.generator import Generator
# Get a temporary directory to work in
working = tempfile.mkdtemp()
# Colour constants
# pylint: disable=too-few-public-methods
class Colors():
"""ANSI Color Codes"""
GREY = "\033[90m"
RED = "\033[91m"
GREEN = "\033[92m"
ORANGE = "\033[91m\033[93m"
YELLOW = "\033[93m"
END = "\033[0m"
def traverse_path(base_root):
"""Takes a path and returns a set of all directories and files in that path."""
all_dirs = set()
all_files = set()
for root, directories, files in os.walk(base_root, topdown=True):
for d in directories:
all_dirs.add(os.path.join(root, d).lstrip(base_root))
for f in files:
all_files.add(os.path.join(root, f).lstrip(base_root))
return (all_dirs, all_files)
class Distfile():
"""Represents one distfile and operations performed on it."""
def __init__(self, i, url):
self.i = i
self.url = url
self.out_file = f"{i}-{os.path.basename(url)}"
self.filepath = ""
def download(self):
"""Downloads the distfile."""
Generator.download_file(self.url, working, self.out_file, silent=True)
self.filepath = os.path.join(working, self.out_file)
def decompress(self):
"""Decompresses the distfile."""
compression = self.out_file.split('.')[-1]
decompress_func = {
"gz": gzip.open,
"tgz": gzip.open,
"bz2": bz2.open,
"xz": lzma.open,
"lzma": lzma.open
}
if compression not in decompress_func:
# No decompression needed
return
# Remove the compression extension
new_path = '.'.join(self.filepath.split('.')[:-1])
# tgz -> .tar
if compression == "tgz":
new_path = f"{new_path}.tar"
# Move the decompressed binary stream to a new file
with decompress_func[compression](self.filepath, 'rb') as fin:
with open(new_path, 'wb') as fout:
shutil.copyfileobj(fin, fout)
self.filepath = new_path
def extract(self):
"""Extracts the distfile."""
# Sanity check
if not tarfile.is_tarfile(self.filepath):
return
out_dir = os.path.join(working, f"{self.i}")
os.mkdir(out_dir)
with tarfile.open(self.filepath, 'r') as f:
f.extractall(path=out_dir)
self.filepath = out_dir
# It makes more sense here to label them d1 and d2 rather than have one be self.
# pylint: disable=no-self-argument
def compare(d1, d2):
"""Compares the distfile to another distfile."""
if not os.path.isdir(d1.filepath):
# Compare files
return filecmp.cmp(d1.filepath, d2.filepath, shallow=False)
if not os.path.isdir(d2.filepath):
# Then, d2 is a file and d1 is a directory
return False
# Otherwise it's two directories
dirnames1, filenames1 = traverse_path(d1.filepath)
dirnames2, filenames2 = traverse_path(d2.filepath)
if dirnames1 != dirnames2:
return False
if filenames1 != filenames2:
return False
return filecmp.cmpfiles(d1.filepath, d2.filepath, filenames1, shallow=False)
def check(*args):
"""Check if a list of distfiles are equivalent."""
notequiv = []
# Find all pairs that are not equivalent
for pair in itertools.combinations(args, 2):
if pair[0].compare(pair[1]):
print(f"{Colors.GREY}DEBUG: {pair[0].url} is equivalent to {pair[1].url}{Colors.END}")
else:
notequiv.append(pair)
# Decompress all, and check again
for d in {y for x in notequiv for y in x}:
d.decompress()
for pair in notequiv.copy():
if pair[0].compare(pair[1]):
# pylint: disable=line-too-long
print(f"{Colors.YELLOW}NOTE: {pair[0].url} is equivalent to {pair[1].url} when decompressed{Colors.END}")
notequiv.remove(pair)
# Extract all, and check again
for d in {y for x in notequiv for y in x}:
d.extract()
has_error = False
for pair in notequiv:
if pair[0].compare(pair[1]):
# pylint: disable=line-too-long
print(f"{Colors.ORANGE}WARN: {pair[0].url} is equivalent to {pair[1].url} when extracted{Colors.END}")
else:
has_error = True
# pylint: disable=line-too-long
print(f"{Colors.RED}ERROR: {pair[0].url} is not equivalent to {pair[1].url}!{Colors.END}")
return has_error
def main():
"""Main function."""
has_error = False
with open("substitutes", 'r', encoding="utf-8") as f:
for line in f.readlines():
urls = line.strip().split(' ')
distfiles = []
for i, url in enumerate(urls):
distfiles.append(Distfile(i, url))
for distfile in distfiles:
distfile.download()
if check(*distfiles):
has_error = True
sys.exit(has_error)
if __name__ == "__main__":
main()

View File

@ -15,32 +15,47 @@ download_source() {
local dest_path="${distfiles}/${fname}"
if ! [ -e "${dest_path}" ]; then
echo "Downloading ${fname}"
curl --fail --location "${url}" --output "${dest_path}"
curl --fail --location "${url}" --output "${dest_path}" || true
fi
}
check_source() {
local distfiles="${1}"
local url="${2}"
local checksum="${3}"
local fname="${4}"
# Default to basename of url if not given
fname="${fname:-$(basename "${url}")}"
local dest_path="${distfiles}/${fname}"
echo "${checksum} ${dest_path}" | sha256sum -c
}
download_for_sys() {
local sysdir="${1}"
local distfiles="${sysdir}/distfiles"
mkdir -p "${distfiles}"
local entry
for entry in "${sysdir}"/*; do
[ -e "${entry}/sources" ] || continue
local line
# shellcheck disable=SC2162
while read line; do
# This is intentional - we want to split out ${line} into separate arguments.
# shellcheck disable=SC2086
download_source "${distfiles}" ${line}
done < "${entry}/sources"
done
}
set -e
cd "$(dirname "$(readlink -f "$0")")"
download_for_sys sysa
download_for_sys sysc
mkdir -p distfiles
# First, try to download anything missing - ignore failing mirrors
for entry in steps/*; do
[ -e "${entry}/sources" ] || continue
# shellcheck disable=SC2162
while read line; do
# This is intentional - we want to split out ${line} into separate arguments.
# shellcheck disable=SC2086
download_source distfiles ${line}
done < "${entry}/sources"
done
# Then, check if everything has been obtained at least once
for entry in steps/*; do
[ -e "${entry}/sources" ] || continue
# shellcheck disable=SC2162
while read line; do
# This is intentional - we want to split out ${line} into separate arguments.
# shellcheck disable=SC2086
check_source distfiles ${line}
done < "${entry}/sources"
done

File diff suppressed because it is too large Load Diff

357
lib/generator.py Executable file
View File

@ -0,0 +1,357 @@
#!/usr/bin/env python3
"""
This file contains all code required to generate the boot image for live-bootstrap
"""
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
import hashlib
import os
import shutil
import tarfile
import traceback
import requests
# pylint: disable=too-many-instance-attributes
class Generator():
"""
Class responsible for generating the basic media to be consumed.
"""
git_dir = os.path.join(os.path.dirname(os.path.join(__file__)), '..')
distfiles_dir = os.path.join(git_dir, 'distfiles')
def __init__(self, arch, external_sources, early_preseed, repo_path):
self.arch = arch
self.early_preseed = early_preseed
self.external_sources = external_sources
self.repo_path = repo_path
self.source_manifest = self.get_source_manifest(not self.external_sources)
self.early_source_manifest = self.get_source_manifest(True)
self.target_dir = None
self.external_dir = None
def reuse(self, target):
"""
Reuse a previously prepared bwrap environment for further stages.
"""
self.target_dir = target.path
self.external_dir = os.path.join(self.target_dir, 'external')
self.distfiles()
def prepare(self, target, using_kernel=False, kernel_bootstrap=False, target_size=0):
"""
Prepare basic media of live-bootstrap.
/steps -- contains steps to be built
/ -- contains seed to allow steps to be built, containing custom
scripts and stage0-posix
"""
self.target_dir = target.path
self.external_dir = os.path.join(self.target_dir, 'external')
# We use ext3 here; ext4 actually has a variety of extensions that
# have been added with varying levels of recency
# Linux 4.9.10 does not support a bunch of them
# Attempting to disable extensions that a particular e2fsprogs
# is *unaware* of causes the filesystem creation to fail
# We could hypothetically detect e2fsprogs version and create an
# argument matrix ... or we could just use ext3 instead which
# is effectively universally the same
if kernel_bootstrap:
self.target_dir = os.path.join(self.target_dir, 'init')
os.mkdir(self.target_dir)
if not self.repo_path and not self.external_sources:
self.external_dir = os.path.join(self.target_dir, 'external')
elif using_kernel:
self.target_dir = os.path.join(self.target_dir, 'disk')
self.external_dir = os.path.join(self.target_dir, 'external')
os.makedirs(self.external_dir)
if self.early_preseed:
# Extract tar containing preseed
with tarfile.open(self.early_preseed, "r") as seed:
seed.extractall(self.target_dir)
shutil.copy2(os.path.join(self.git_dir, 'seed', 'preseeded.kaem'),
os.path.join(self.target_dir, 'kaem.x86'))
else:
self.stage0_posix(kernel_bootstrap)
self.seed()
self.steps()
self.distfiles()
if self.repo_path:
repo_dir = os.path.join(self.external_dir, 'repo-preseeded')
shutil.copytree(self.repo_path, repo_dir)
if kernel_bootstrap:
self.create_builder_hex0_disk_image(self.target_dir + '.img', target_size)
if self.repo_path or self.external_sources:
mkfs_args = ['-d', os.path.join(target.path, 'external')]
target.add_disk("external", filesystem="ext3", mkfs_args=mkfs_args)
elif using_kernel:
mkfs_args = ['-F', '-d', os.path.join(target.path, 'disk')]
target.add_disk("disk",
filesystem="ext3",
size=(str(target_size) + "M") if target_size else "16G",
bootable=True,
mkfs_args=mkfs_args)
def steps(self):
"""Copy in steps."""
self.get_packages()
shutil.copytree(os.path.join(self.git_dir, 'steps'), os.path.join(self.target_dir, 'steps'))
def stage0_posix(self, kernel_bootstrap=False):
"""Copy in all of the stage0-posix"""
stage0_posix_base_dir = os.path.join(self.git_dir, 'seed', 'stage0-posix')
for entry in os.listdir(stage0_posix_base_dir):
if kernel_bootstrap and entry == 'bootstrap-seeds':
continue
orig = os.path.join(stage0_posix_base_dir, entry)
target = os.path.join(self.target_dir, entry)
if os.path.isfile(orig):
shutil.copy2(orig, target)
else:
shutil.copytree(orig, target)
if not kernel_bootstrap:
arch = stage0_arch_map.get(self.arch, self.arch)
kaem_optional_seed = os.path.join(self.git_dir, 'seed', 'stage0-posix',
'bootstrap-seeds', 'POSIX', arch,
'kaem-optional-seed')
shutil.copy2(kaem_optional_seed, os.path.join(self.target_dir, 'init'))
def seed(self):
"""Copy in extra seed files"""
seed_dir = os.path.join(self.git_dir, 'seed')
for entry in os.listdir(seed_dir):
if os.path.isfile(os.path.join(seed_dir, entry)):
shutil.copy2(os.path.join(seed_dir, entry), os.path.join(self.target_dir, entry))
def distfiles(self):
"""Copy in distfiles"""
def copy_no_network_distfiles(out, early):
# Note that "no disk" implies "no network" for kernel bootstrap mode
manifest = self.early_source_manifest if early else self.source_manifest
for file in manifest:
file = file[3].strip()
shutil.copy2(os.path.join(self.distfiles_dir, file),
os.path.join(out, file))
early_distfile_dir = os.path.join(self.target_dir, 'external', 'distfiles')
main_distfile_dir = os.path.join(self.external_dir, 'distfiles')
if early_distfile_dir != main_distfile_dir:
os.makedirs(early_distfile_dir, exist_ok=True)
copy_no_network_distfiles(early_distfile_dir, True)
if self.external_sources:
shutil.copytree(self.distfiles_dir, main_distfile_dir, dirs_exist_ok=True)
else:
os.mkdir(main_distfile_dir)
copy_no_network_distfiles(main_distfile_dir, False)
@staticmethod
def output_dir(srcfs_file, dirpath):
"""Add a directory to srcfs file system"""
srcline = f"src 0 {dirpath}\n"
srcfs_file.write(srcline.encode())
@staticmethod
def output_file(srcfs_file, filepath):
"""Add a file to srcfs file system"""
srcline = f"src {os.path.getsize(filepath)} {filepath}\n"
srcfs_file.write(srcline.encode())
with open(filepath, 'rb') as srcfile:
srcfs_file.write(srcfile.read())
def output_tree(self, srcfs_file, treepath):
"""Add a tree of files to srcfs file system"""
self.output_dir(srcfs_file, treepath)
for root, dirs, files in os.walk(treepath):
if ".git" in root:
continue
for dirpath in dirs:
if ".git" in dirpath:
continue
self.output_dir(srcfs_file, os.path.join(root, dirpath))
for filepath in files:
if ".git" in filepath:
continue
self.output_file(srcfs_file, os.path.join(root, filepath))
def append_srcfs(self, image_file):
"""Append srcfs file system to disk image"""
save_cwd = os.getcwd()
os.chdir(self.target_dir)
self.output_tree(image_file, '.')
# Add commands to kick off stage0-posix
cmd = ' '.join(['src',
'0',
'/bootstrap-seeds\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['src',
'0',
'/bootstrap-seeds/POSIX\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['src',
'0',
'/bootstrap-seeds/POSIX/x86\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['hex0',
'/x86/hex0_x86.hex0',
'/bootstrap-seeds/POSIX/x86/hex0-seed\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['hex0',
'/x86/kaem-minimal.hex0',
'/bootstrap-seeds/POSIX/x86/kaem-optional-seed\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['hex0',
'/x86/kaem-minimal.hex0',
'/init\n'])
image_file.write(cmd.encode())
cmd = ' '.join(['/bootstrap-seeds/POSIX/x86/kaem-optional-seed', '/kaem.x86\n'])
image_file.write(cmd.encode())
os.chdir(save_cwd)
def create_builder_hex0_disk_image(self, image_file_name, size):
"""Create builder-hex0 disk image"""
with open(image_file_name, 'ab') as image_file:
# Compile and write stage1 binary seed
with open(os.path.join('builder-hex0', 'builder-hex0-x86-stage1.hex0'),
encoding="utf-8") as infile:
for line in infile:
image_file.write(bytes.fromhex(line.split('#')[0].split(';')[0].strip()))
# Append stage2 hex0 source
with open(os.path.join('builder-hex0', 'builder-hex0-x86-stage2.hex0'),
encoding="utf-8") as infile:
image_file.write(infile.read().encode())
# Pad to next sector
current_size = os.stat(image_file_name).st_size
while current_size % 512 != 0:
image_file.write(b'\0')
current_size += 1
self.append_srcfs(image_file)
current_size = os.stat(image_file_name).st_size
megabyte = 1024 * 1024
# fill file with zeros up to next megabyte
extra = current_size % megabyte
round_up = megabyte - extra
with open(image_file_name, 'ab') as image_file:
image_file.write(b'\0' * round_up)
current_size += round_up
# extend file up to desired size
if current_size < size * megabyte:
with open(image_file_name, 'ab') as image_file:
image_file.truncate(size * megabyte)
@staticmethod
def check_file(file_name, expected_hash):
"""Check hash of downloaded source file."""
with open(file_name, "rb") as downloaded_file:
downloaded_content = downloaded_file.read() # read entire file as bytes
readable_hash = hashlib.sha256(downloaded_content).hexdigest()
if expected_hash == readable_hash:
return
raise ValueError(f"Checksum mismatch for file {os.path.basename(file_name)}:\n\
expected: {expected_hash}\n\
actual: {readable_hash}\n\
When in doubt, try deleting the file in question -- it will be downloaded again when running \
this script the next time")
@staticmethod
def download_file(url, directory, file_name, silent=False):
"""
Download a single source archive.
"""
abs_file_name = os.path.join(directory, file_name)
# Create a directory for downloaded file
if not os.path.isdir(directory):
os.mkdir(directory)
# Actually download the file
headers = {
"Accept-Encoding": "identity",
"User-Agent": "curl/7.88.1"
}
if not os.path.isfile(abs_file_name):
if not silent:
print(f"Downloading: {file_name}")
response = requests.get(url, allow_redirects=True, stream=True,
headers=headers, timeout=20)
if response.status_code == 200:
with open(abs_file_name, 'wb') as target_file:
target_file.write(response.raw.read())
else:
raise requests.HTTPError("Download failed: HTTP " +
str(response.status_code) + " " + response.reason)
return abs_file_name
def get_packages(self):
"""Prepare remaining sources"""
for line in self.source_manifest:
try:
path = self.download_file(line[2], line[1], line[3])
except requests.HTTPError:
print(traceback.format_exc())
for line in self.source_manifest:
path = os.path.join(line[1], line[3])
self.check_file(path, line[0])
@classmethod
def get_source_manifest(cls, pre_network=False):
"""
Generate a source manifest for the system.
"""
entries = []
directory = os.path.relpath(cls.distfiles_dir, cls.git_dir)
# Find all source files
steps_dir = os.path.join(cls.git_dir, 'steps')
with open(os.path.join(steps_dir, 'manifest'), 'r', encoding="utf_8") as file:
for line in file:
if pre_network and line.strip().startswith("improve: ") and "network" in line:
break
if not line.strip().startswith("build: "):
continue
step = line.split(" ")[1].split("#")[0].strip()
sourcef = os.path.join(steps_dir, step, "sources")
if os.path.exists(sourcef):
# Read sources from the source file
with open(sourcef, "r", encoding="utf_8") as sources:
for source in sources.readlines():
source = source.strip().split(" ")
if len(source) > 2:
file_name = source[2]
else:
# Automatically determine file name based on URL.
file_name = os.path.basename(source[0])
entry = (source[1], directory, source[0], file_name)
if entry not in entries:
entries.append(entry)
return entries
stage0_arch_map = {
"amd64": "AMD64",
}

View File

@ -1,132 +0,0 @@
#!/usr/bin/env python3
"""
This file contains a few functions to be shared by all Sys* classes
"""
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import hashlib
import glob
import subprocess
import requests
class SysGeneral:
"""
A class from which all Sys* class are extended.
Contains functions used in all Sys*
"""
# All of these are variables defined in the individual Sys* classes
cache_dir = None
base_dir = None
git_dir = None
sys_dir = None
initramfs_path = None
tmp_dir = None
def check_file(self, file_name, expected_hash):
"""Check hash of downloaded source file."""
with open(file_name, "rb") as downloaded_file:
downloaded_content = downloaded_file.read() # read entire file as bytes
readable_hash = hashlib.sha256(downloaded_content).hexdigest()
if expected_hash == readable_hash:
return
raise ValueError(f"Checksum mismatch for file {os.path.basename(file_name)}:\n\
expected: {expected_hash}\n\
actual: {readable_hash}\n\
When in doubt, try deleting the file in question -- it will be downloaded again when running \
this script the next time")
def download_file(self, url, directory, file_name):
"""
Download a single source archive.
"""
abs_file_name = os.path.join(directory, file_name)
# Create a directory for downloaded file
if not os.path.isdir(directory):
os.mkdir(directory)
# Actually download the file
headers = {
"Accept-Encoding": "identity"
}
if not os.path.isfile(abs_file_name):
print(f"Downloading: {file_name}")
response = requests.get(url, allow_redirects=True, stream=True,
headers=headers, timeout=20)
if response.status_code == 200:
with open(abs_file_name, 'wb') as target_file:
target_file.write(response.raw.read())
else:
raise requests.HTTPError("Download failed.")
return abs_file_name
def get_packages(self, source_manifest):
"""Prepare remaining sources"""
for line in source_manifest.split("\n"):
line = line.strip().split(" ")
path = self.download_file(line[2], line[1], line[3])
self.check_file(path, line[0])
@classmethod
def get_source_manifest(cls):
"""
Generate a source manifest for the system.
"""
manifest_lines = []
directory = os.path.relpath(cls.cache_dir, cls.git_dir)
# Find all source files
for file in os.listdir(cls.sys_dir):
if os.path.isdir(os.path.join(cls.sys_dir, file)):
sourcef = os.path.join(cls.sys_dir, file, "sources")
if os.path.exists(sourcef):
# Read sources from the source file
with open(sourcef, "r", encoding="utf_8") as sources:
for line in sources.readlines():
line = line.strip().split(" ")
if len(line) > 2:
file_name = line[2]
else:
# Automatically determine file name based on URL.
file_name = os.path.basename(line[0])
manifest_lines.append(f"{line[1]} {directory} {line[0]} {file_name}")
return "\n".join(manifest_lines)
def make_initramfs(self):
"""Package binary bootstrap seeds and sources into initramfs."""
self.initramfs_path = os.path.join(self.tmp_dir, 'initramfs')
# Create a list of files to go within the initramfs
file_list = glob.glob(os.path.join(self.tmp_dir, '**'), recursive=True)
# Use built-in removeprefix once we can use Python 3.9
def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text # or whatever
file_list = [remove_prefix(f, self.tmp_dir + os.sep) for f in file_list]
# Create the initramfs
with open(self.initramfs_path, "w", encoding="utf_8") as initramfs:
# pylint: disable=consider-using-with
cpio = subprocess.Popen(
["cpio", "--format", "newc", "--create",
"--directory", self.tmp_dir],
stdin=subprocess.PIPE, stdout=initramfs)
cpio.communicate(input='\n'.join(file_list).encode())
stage0_arch_map = {
"amd64": "AMD64",
}

61
lib/target.py Normal file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Contains a class that represents a target directory
"""
import enum
import os
from lib.utils import mount, create_disk
class TargetType(enum.Enum):
"""Different types of target dirs we can have"""
NONE = 0
TMPFS = 1
class Target:
"""
Represents a target directory
"""
_disks = {}
_mountpoints = {}
def __init__(self, path="target"):
self.path = os.path.abspath(path)
self._type = TargetType.NONE
if not os.path.exists(self.path):
os.mkdir(self.path)
def tmpfs(self, size="8G"):
"""Mount a tmpfs"""
print(f"Mounting tmpfs on {self.path}")
mount("tmpfs", self.path, "tmpfs", f"size={size}")
self._type = TargetType.TMPFS
# pylint: disable=too-many-arguments
def add_disk(self,
name,
size="16G",
filesystem="ext4",
tabletype="msdos",
bootable=False,
mkfs_args=None):
"""Add a disk"""
disk_path = os.path.join(self.path, f"{name}.img")
create_disk(disk_path,
tabletype,
filesystem,
size,
bootable,
mkfs_args)
self._disks[name] = disk_path
def get_disk(self, name):
"""Get the path to a device of a disk"""
return self._disks.get(name)

View File

@ -1,99 +0,0 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Contains a class that represents a tmpdir
"""
import enum
import getpass
import os
import shutil
from lib.utils import mount, umount, create_disk, run
class TmpType(enum.Enum):
"""Different types of tmpdirs we can have"""
NONE = 0
TMPFS = 1
class Tmpdir:
"""
Represents a tmpdir
"""
_syses = {}
_disks = {}
_disk_filesystems = {}
_mountpoints = {}
def __init__(self, preserve, path="tmp"):
self.path = os.path.abspath(path)
self.preserve = preserve
self._type = TmpType.NONE
if not os.path.exists(self.path):
os.mkdir(self.path)
def __del__(self):
for path in self._mountpoints:
print(f"Unmounting {path}")
umount(path)
if not self.preserve:
for disk in self._disks.values():
print(f"Detaching {disk}")
run("sudo", "losetup", "-d", disk)
if self._type == TmpType.TMPFS:
print(f"Unmounting tmpdir from {self.path}")
umount(self.path)
print(f"Removing {self.path}")
shutil.rmtree(self.path, ignore_errors=True)
def tmpfs(self, size="8G"):
"""Mount a tmpfs"""
print(f"Mounting tmpfs on {self.path}")
mount("tmpfs", self.path, "tmpfs", f"size={size}")
self._type = TmpType.TMPFS
def add_sys(self, name, subdir=None):
"""Create a subdirectory and register a sys"""
if subdir is None:
subdir = name
sys_path = os.path.join(self.path, name)
if not os.path.exists(sys_path):
os.mkdir(sys_path)
return sys_path
def add_disk(self, name, size="8G", filesystem="ext4"):
"""Add a disk"""
disk_path = os.path.join(self.path, f"{name}.img")
self._disks[name] = create_disk(disk_path, "msdos", filesystem, size)
self._disk_filesystems[name] = filesystem
# Allow executing user to access it
run("sudo", "chown", getpass.getuser(), self._disks[name])
def mount_disk(self, name, mountpoint=None):
"""Mount the disk"""
if mountpoint is None:
mountpoint = f"{name}_mnt"
mountpoint = os.path.join(self.path, mountpoint)
os.mkdir(mountpoint)
mount(self._disks[name] + "p1", mountpoint, self._disk_filesystems[name])
# Allow executing user to access it
run("sudo", "chown", getpass.getuser(), mountpoint)
self._mountpoints[name] = mountpoint
return mountpoint
def umount_disk(self, name):
"""Unmount a disk"""
umount(self._mountpoints[name])
del self._mountpoints[name]
def get_disk(self, name):
"""Get the path to a device of a disk"""
return self._disks[name]

View File

@ -25,27 +25,33 @@ def run(*args, **kwargs):
print("Bootstrapping failed")
sys.exit(1)
def create_disk(image, disk_type, fs_type, size):
def run_as_root(*args, **kwargs):
"""A helper for run that invokes sudo when unprivileged"""
if os.geteuid() != 0:
return run("sudo", *args, **kwargs)
return run(*args, **kwargs)
# pylint: disable=too-many-arguments
def create_disk(image, disk_type, fs_type, size, bootable=False, mkfs_args=None):
"""Create a disk image, with a filesystem on it"""
if mkfs_args is None:
mkfs_args = []
run('truncate', '-s', size, image)
# First find the device we will use, then actually use it
loop_dev = run('sudo', 'losetup', '-f', capture_output=True).stdout.decode().strip()
run('sudo', 'losetup', '-P', loop_dev, image)
# Create the partition
if disk_type != "none":
run('sudo', 'parted', '--script', image, 'mklabel', disk_type, 'mkpart',
'primary', 'ext4', '0%', '100%')
run('sudo', 'partprobe', loop_dev)
run('sudo', 'mkfs.' + fs_type, loop_dev + "p1")
return loop_dev
# 1 GiB if bootable, 1 MiB otherwise
offset = str(1024 * 1024 * (1024 if bootable else 1))
run('parted', '--script', image, 'mklabel', disk_type, 'mkpart',
'primary', fs_type, offset + 'B', '100%')
run('mkfs.' + fs_type, image, '-E', 'offset=' + offset, *mkfs_args)
def mount(source, target, fs_type, options='', **kwargs):
"""Mount filesystem"""
run('sudo', 'mount', source, target, '-t', fs_type, '-o', options, **kwargs)
run_as_root('mount', source, target, '-t', fs_type, '-o', options, **kwargs)
def umount(target, **kwargs):
"""Unmount filesystem"""
run('sudo', 'umount', '--recursive', target, **kwargs)
run_as_root('umount', '--recursive', target, **kwargs)
def copytree(src, dst, ignore=shutil.ignore_patterns('*.git*')):
"""Copy directory tree into another directory"""

498
parts.rst

File diff suppressed because one or more lines are too long

237
rootfs.py
View File

@ -12,40 +12,49 @@ you can run bootstap inside chroot.
# SPDX-FileCopyrightText: 2021 Bastian Bittorf <bb@npl.de>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2023-24 Gábor Stefanik <netrolller.3d@gmail.com>
import argparse
import os
from sysa import SysA
from sysc import SysC
from lib.utils import run
from lib.sysgeneral import stage0_arch_map
from lib.tmpdir import Tmpdir
from lib.utils import run, run_as_root
from lib.target import Target
from lib.generator import Generator, stage0_arch_map
def create_configuration_file(args):
"""
Creates bootstrap.cfg file which would contain options used to
customize bootstrap.
"""
config_path = os.path.join('sysa', 'bootstrap.cfg')
config_path = os.path.join('steps', 'bootstrap.cfg')
with open(config_path, "w", encoding="utf_8") as config:
config.write(f"ARCH={args.arch}\n")
config.write(f"ARCH_DIR={stage0_arch_map.get(args.arch, args.arch)}\n")
config.write(f"FORCE_TIMESTAMPS={args.force_timestamps}\n")
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
config.write(f"CHROOT_ONLY_SYSA={args.bwrap}\n")
config.write(f"UPDATE_CHECKSUMS={args.update_checksums}\n")
config.write(f"JOBS={args.cores}\n")
config.write("DISK=sda1\n")
config.write(f"SWAP_SIZE={args.swap}\n")
config.write(f"FINAL_JOBS={args.cores}\n")
config.write(f"INTERNAL_CI={args.internal_ci or False}\n")
config.write(f"INTERACTIVE={args.interactive}\n")
config.write(f"BARE_METAL={args.bare_metal or (args.qemu and args.interactive)}\n")
if (args.bare_metal or args.qemu) and not args.kernel:
if args.repo or args.external_sources:
config.write("DISK=sdb1\n")
else:
config.write("DISK=sda\n")
config.write("KERNEL_BOOTSTRAP=True\n")
else:
config.write("DISK=sda1\n")
config.write("KERNEL_BOOTSTRAP=False\n")
config.write(f"BUILD_KERNELS={args.update_checksums or args.build_kernels}\n")
# pylint: disable=too-many-statements
# pylint: disable=too-many-statements,too-many-branches
def main():
"""
A few command line arguments to customize bootstrap.
This function also creates SysA object which prepares directory
This function also creates object which prepares directory
structure with bootstrap seeds and all sources.
"""
parser = argparse.ArgumentParser()
@ -55,11 +64,9 @@ def main():
action="store_true")
parser.add_argument("-bw", "--bwrap", help="Run inside a bwrap sandbox",
action="store_true")
parser.add_argument("-p", "--preserve", help="Do not remove temporary dir",
action="store_true")
parser.add_argument("-t", "--tmpdir", help="Temporary directory",
default="tmp")
parser.add_argument("--tmpfs", help="Use a tmpfs on tmpdir",
parser.add_argument("-t", "--target", help="Target directory",
default="target")
parser.add_argument("--tmpfs", help="Use a tmpfs on target",
action="store_true")
parser.add_argument("--tmpfs-size", help="Size of the tmpfs",
default="8G")
@ -69,21 +76,27 @@ def main():
help="Force all files timestamps to be 0 unix time",
action="store_true")
parser.add_argument("--update-checksums",
help="Update checksum files.",
help="Update checksum files",
action="store_true")
parser.add_argument("--external-sources",
help="Download sources externally from live-bootstrap.",
help="Download sources externally from live-bootstrap",
action="store_true")
parser.add_argument("--build-kernels",
help="Also build kernels in chroot and bwrap builds.",
help="Also build kernels in chroot and bwrap builds",
action="store_true")
parser.add_argument("--no-create-config",
help="Do not automatically create config file",
action="store_true")
parser.add_argument("-i", "--interactive",
help="Use interactive prompts to resolve issues during bootstrap",
action="store_true")
parser.add_argument("-r", "--repo",
help="Path to prebuilt binary packages.", nargs=None)
help="Path to prebuilt binary packages", nargs=None)
parser.add_argument("--early-preseed",
help="Skip early stages of live-bootstrap.", nargs=None)
help="Skip early stages of live-bootstrap", nargs=None)
parser.add_argument("--internal-ci", help="INTERNAL for github CI")
parser.add_argument("-s", "--swap", help="Swap space to allocate in Linux",
default=0)
# QEMU arguments
parser.add_argument("-q", "--qemu", help="Use QEMU",
@ -92,7 +105,9 @@ def main():
default="qemu-system-x86_64")
parser.add_argument("-qr", "--qemu-ram", help="Memory (in megabytes) allocated to QEMU VM",
default=4096)
parser.add_argument("-qk", "--kernel", help="Custom sysa kernel to use")
parser.add_argument("-qs", "--target-size", help="Size of the target image (for QEMU only)",
default="16G")
parser.add_argument("-qk", "--kernel", help="Custom early kernel to use")
parser.add_argument("-b", "--bare-metal", help="Build images for bare metal",
action="store_true")
@ -120,9 +135,9 @@ def main():
# Arch validation
if args.arch != "x86":
raise ValueError("Only x86 is supported at the moment.")
print("Only x86 is supported at the moment, other arches are for development only.")
# Tmp validation
# Tmpfs validation
if args.bwrap and args.tmpfs:
raise ValueError("tmpfs cannot be used with bwrap.")
@ -130,129 +145,151 @@ def main():
if int(args.cores) < 1:
raise ValueError("Must use one or more cores.")
# bootstrap.cfg
if args.bare_metal:
args.no_create_config = True
# Target image size validation
if args.qemu:
if int(str(args.target_size).rstrip('gGmM')) < 1:
raise ValueError("Please specify a positive target size for qemu.")
args.target_size = (int(str(args.target_size).rstrip('gGmM')) *
(1024 if str(args.target_size).lower().endswith('g') else 1))
else:
args.target_size = 0
# Swap file size validation
if args.qemu or args.bare_metal:
args.swap = (int(str(args.swap).rstrip('gGmM')) *
(1024 if str(args.swap).lower().endswith('g') else 1))
else:
args.swap = 0
# Set constant umask
os.umask(0o022)
# bootstrap.cfg
try:
os.remove(os.path.join('sysa', 'bootstrap.cfg'))
os.remove(os.path.join('steps', 'bootstrap.cfg'))
except FileNotFoundError:
pass
if not args.no_create_config:
create_configuration_file(args)
else:
with open(os.path.join('sysa', 'bootstrap.cfg'), 'a', encoding='UTF-8'):
with open(os.path.join('steps', 'bootstrap.cfg'), 'a', encoding='UTF-8'):
pass
# tmpdir
tmpdir = Tmpdir(path=args.tmpdir, preserve=args.preserve)
# target
target = Target(path=args.target)
if args.tmpfs:
tmpdir.tmpfs(size=args.tmpfs_size)
target.tmpfs(size=args.tmpfs_size)
# sys
system_c = SysC(arch=args.arch, tmpdir=tmpdir,
external_sources=args.external_sources)
system_a = SysA(arch=args.arch, early_preseed=args.early_preseed,
tmpdir=tmpdir, external_sources=args.external_sources,
repo_path=args.repo)
generator = Generator(arch=args.arch,
external_sources=args.external_sources,
repo_path=args.repo,
early_preseed=args.early_preseed)
bootstrap(args, system_a, system_c, tmpdir)
bootstrap(args, generator, target, args.target_size)
def bootstrap(args, system_a, system_c, tmpdir):
def bootstrap(args, generator, target, size):
"""Kick off bootstrap process."""
print(f"Bootstrapping {args.arch} -- SysA")
print(f"Bootstrapping {args.arch}", flush=True)
if args.chroot:
find_chroot = """
import shutil
print(shutil.which('chroot'))
"""
chroot_binary = run('sudo', 'python3', '-c', find_chroot,
capture_output=True).stdout.decode().strip()
chroot_binary = run_as_root('python3', '-c', find_chroot,
capture_output=True).stdout.decode().strip()
system_c.prepare(create_disk_image=False)
system_a.prepare(create_initramfs=False)
generator.prepare(target, using_kernel=False)
arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
run('sudo', 'env', '-i', 'PATH=/bin', chroot_binary, system_a.tmp_dir, init)
run_as_root('env', '-i', 'PATH=/bin', chroot_binary, generator.target_dir, init)
elif args.bwrap:
system_c.prepare(create_disk_image=False)
system_a.prepare(create_initramfs=False)
init = '/init'
if not args.internal_ci or args.internal_ci == "pass1":
generator.prepare(target, using_kernel=False)
arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
run('bwrap', '--unshare-user',
'--uid', '0',
'--gid', '0',
'--unshare-net',
'--clearenv',
'--setenv', 'PATH', '/usr/bin',
'--bind', system_a.tmp_dir, '/',
'--dir', '/dev',
'--dev-bind', '/dev/null', '/dev/null',
'--dev-bind', '/dev/zero', '/dev/zero',
'--dev-bind', '/dev/random', '/dev/random',
'--dev-bind', '/dev/urandom', '/dev/urandom',
init)
arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
else:
generator.reuse(target)
run('bwrap', '--unshare-user',
'--uid', '0',
'--gid', '0',
'--unshare-net' if args.external_sources else None,
'--clearenv',
'--setenv', 'PATH', '/usr/bin',
'--bind', system_a.tmp_dir + "/sysc_image", '/',
'--dir', '/dev',
'--dev-bind', '/dev/null', '/dev/null',
'--dev-bind', '/dev/zero', '/dev/zero',
'--dev-bind', '/dev/random', '/dev/random',
'--dev-bind', '/dev/urandom', '/dev/urandom',
'--tmpfs', '/dev/shm',
'--proc', '/proc',
'--bind', '/sys', '/sys',
'--tmpfs', '/tmp',
'/init')
run('env', '-i', 'bwrap', '--unshare-user',
'--uid', '0',
'--gid', '0',
'--unshare-net' if args.external_sources else None,
'--setenv', 'PATH', '/usr/bin',
'--bind', generator.target_dir, '/',
'--dir', '/dev',
'--dev-bind', '/dev/null', '/dev/null',
'--dev-bind', '/dev/zero', '/dev/zero',
'--dev-bind', '/dev/random', '/dev/random',
'--dev-bind', '/dev/urandom', '/dev/urandom',
'--dev-bind', '/dev/ptmx', '/dev/ptmx',
'--dev-bind', '/dev/tty', '/dev/tty',
'--tmpfs', '/dev/shm',
'--proc', '/proc',
'--bind', '/sys', '/sys',
'--tmpfs', '/tmp',
init)
elif args.bare_metal:
if args.kernel:
system_c.prepare(create_disk_image=True)
system_a.prepare(create_initramfs=True)
generator.prepare(target, using_kernel=True, target_size=size)
path = os.path.join(args.target, os.path.relpath(generator.target_dir, args.target))
print("Please:")
print(" 1. Take tmp/sysa/initramfs and your kernel, boot using this.")
print(" 2. Take tmp/sysc/disk.img and put this on a writable storage medium.")
print(f" 1. Take {path}/initramfs and your kernel, boot using this.")
print(f" 2. Take {path}/disk.img and put this on a writable storage medium.")
else:
system_a.prepare(create_initramfs=True, kernel_bootstrap=True)
generator.prepare(target, kernel_bootstrap=True, target_size=size)
path = os.path.join(args.target, os.path.relpath(generator.target_dir, args.target))
print("Please:")
print(" 1. Take tmp/sysa/sysa.img and write it to a boot drive and then boot it.")
print(f" 1. Take {path}.img and write it to a boot drive and then boot it.")
else:
if args.kernel:
system_c.prepare(create_disk_image=True)
system_a.prepare(create_initramfs=True)
generator.prepare(target, using_kernel=True, target_size=size)
run(args.qemu_cmd,
arg_list = [
'-enable-kvm',
'-m', str(args.qemu_ram) + 'M',
'-smp', str(args.cores),
'-no-reboot',
'-hda', tmpdir.get_disk("sysc"),
'-drive', 'file=' + target.get_disk("disk") + ',format=raw'
]
if target.get_disk("external") is not None:
arg_list += [
'-drive', 'file=' + target.get_disk("external") + ',format=raw',
]
arg_list += [
'-nic', 'user,ipv6=off,model=e1000',
'-kernel', args.kernel,
'-initrd', system_a.initramfs_path,
'-nographic',
'-append', 'console=ttyS0')
'-append',
]
if args.interactive:
arg_list += ['consoleblank=0 earlyprintk=vga root=/dev/sda1 '
'rootfstype=ext3 init=/init rw']
else:
arg_list += ['console=ttyS0 earlycon=uart8250,io,0x3f8,115200n8 '
'root=/dev/sda1 rootfstype=ext3 init=/init rw']
else:
system_a.prepare(create_initramfs=True, kernel_bootstrap=True)
run(args.qemu_cmd,
generator.prepare(target, kernel_bootstrap=True, target_size=size)
arg_list = [
'-enable-kvm',
'-m', "4G",
'-m', str(args.qemu_ram) + 'M',
'-smp', str(args.cores),
'-no-reboot',
'-drive', 'file=' + os.path.join(system_a.tmp_dir, 'sysa.img') + ',format=raw',
'-drive', 'file=' + generator.target_dir + '.img' + ',format=raw'
]
if target.get_disk("external") is not None:
arg_list += [
'-drive', 'file=' + target.get_disk("external") + ',format=raw',
]
arg_list += [
'-machine', 'kernel-irqchip=split',
'-nic', 'user,ipv6=off,model=e1000',
'-nographic')
'-nic', 'user,ipv6=off,model=e1000'
]
if not args.interactive:
arg_list += ['-no-reboot', '-nographic']
run(args.qemu_cmd, *arg_list)
if __name__ == "__main__":
main()

View File

@ -9,17 +9,7 @@
set -ex
# Set commonly used variables
sysa=/sysa
distfiles=/sysa/distfiles
prefix=/usr
bindir=${prefix}/bin
libdir=${libdir}/mes
incdir=${prefix}/include
srcdir=${prefix}/src
TMPDIR=/tmp # tmpdir is needed for patch to work
PATH=${bindir}
PATH=/${ARCH_DIR}/bin
cd ${sysa}
exec bash run.sh
catm seed-full.kaem /steps/bootstrap.cfg /steps/env seed.kaem
kaem --file seed-full.kaem

8
seed/preseeded.kaem Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
/script-generator /steps/manifest
/usr/bin/kaem --file /preseed-jump.kaem

View File

@ -0,0 +1 @@
1927a357c893d60952616146e788af25e637635b2862650914bf895d27f556a6 script-generator

641
seed/script-generator.c Normal file
View File

@ -0,0 +1,641 @@
/*
* SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define MAX_TOKEN 64
#define MAX_STRING 2048
#include <bootstrappable.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Token {
char *val;
struct Token *next;
};
typedef struct Token Token;
#define TYPE_BUILD 1
#define TYPE_IMPROVE 2
#define TYPE_DEFINE 3
#define TYPE_JUMP 4
#define TYPE_UNINSTALL 5
struct Directive {
Token *tok;
struct Directive *next;
int type;
char *arg; /* The primary argument */
};
typedef struct Directive Directive;
/* Tokenizer. */
/* Skip over a comment. */
char consume_comment(FILE *in) {
/* Discard the rest of the line. */
char c = fgetc(in);
while (c != -1 && c != '\n')
c = fgetc(in);
return c;
}
char consume_line(FILE *in, Directive *directive) {
char c = fgetc(in);
/* Short-circuit if whole line is comment or blank line. */
if (c == '#') {
c = consume_comment(in);
return c;
} else if (c == '\n' || c == -1) {
return c;
}
/* Ok, we will have something to put here. */
directive->next = calloc(1, sizeof(Directive));
directive = directive->next;
Token *head = calloc(1, sizeof(Token));
Token *cur = head;
char *out;
int i = 0;
while (c != -1 && c != '\n') {
/* Initialize next token. */
cur->next = calloc(1, sizeof(Token));
cur = cur->next;
cur->val = calloc(MAX_TOKEN, sizeof(char));
out = cur->val;
/* Copy line to token until a space (or EOL/EOF) or comment is found. */
while (c != -1 && c != '\n' && c != ' ' && c != '#') {
out[0] = c;
out += 1;
c = fgetc(in);
}
/* Go to start of next token. */
if (c == ' ') {
c = fgetc(in);
}
/* Handle comment. */
if (c == '#') {
c = consume_comment(in);
}
}
/* Add information to directive. */
directive->tok = head->next;
return c;
}
Directive *tokenizer(FILE *in) {
Directive *head = calloc(1, sizeof(Directive));
Directive *cur = head;
char c;
while (c != -1) {
/*
* Note that consume_line fills cur->next, not cur.
* This avoids having an empty last Directive.
*/
c = consume_line(in, cur);
if (cur->next != NULL) {
cur = cur->next;
}
}
return head->next;
}
/* Config variables. */
struct Variable {
char *name;
char *val;
struct Variable *next;
};
typedef struct Variable Variable;
Variable *variables;
Variable *load_config() {
FILE *config = fopen("/steps/bootstrap.cfg", "r");
/* File does not exist check. */
if (config == NULL) {
return NULL;
}
char *line = calloc(MAX_STRING, sizeof(char));
Variable *head = calloc(1, sizeof(Variable));
Variable *cur = head;
/* For each line... */
char *equals;
while (fgets(line, MAX_STRING, config) != 0) {
/* Weird M2-Planet behaviour. */
if (*line == 0) {
break;
}
cur->next = calloc(1, sizeof(Variable));
cur = cur->next;
/* Split on the equals. First half is name, second half is value. */
equals = strchr(line, '=');
if (equals == 0) {
fputs("bootstrap.cfg should have the format var=val on each line.", stderr);
exit(1);
}
cur->name = calloc(equals - line + 1, sizeof(char));
strncpy(cur->name, line, equals - line);
equals += 1;
cur->val = calloc(strlen(equals), sizeof(char));
strncpy(cur->val, equals, strlen(equals) - 1);
line = calloc(MAX_STRING, sizeof(char));
}
variables = head->next;
fclose(config);
}
void output_config(FILE *out) {
Variable *variable;
for (variable = variables; variable != NULL; variable = variable->next) {
fputs(variable->name, out);
fputs("=", out);
fputs(variable->val, out);
fputs("\n", out);
}
}
char *get_var(char *name) {
/* Search through existing variables. */
Variable *var;
Variable *last = NULL;
for (var = variables; var != NULL; var = var->next) {
if (strcmp(name, var->name) == 0) {
return var->val;
}
last = var;
}
/* If the variable is unset, prompt the user. */
if (variables == NULL) {
variables = calloc(1, sizeof(Variable));
var = variables;
} else {
last->next = calloc(1, sizeof(Variable));
var = last->next;
}
var->name = calloc(strlen(name) + 1, sizeof(char));
strcpy(var->name, name);
var->val = calloc(MAX_STRING, sizeof(char));
fputs("You have not set a value for ", stdout);
fputs(name, stdout);
fputs(" in bootstrap.cfg. Please set it now:\n", stdout);
while (fgets(var->val, MAX_STRING, stdin) == 0 || var->val[0] == '\n') {
fputs("Error inputting, try again:\n", stdout);
}
if (var->val[0] == 0) {
fputs("You put in an EOF!\n", stderr);
exit(1);
}
/* Trim the newline. */
var->val[strlen(var->val)] = 0;
return var->val;
}
/* Recursive descent interpreter. */
Token *fill(Token *tok, Directive *directive, int type) {
directive->type = type;
directive->arg = tok->val;
return tok->next;
}
Token *logic(Token *tok, char **val) {
/* logic = "("
* (name |
* (name "==" value) |
* (name "!=" value) |
* (logic "||" logic) |
* (logic "&&" logic))
* ")"
*/
char *lhs = tok->val;
char *rhs;
tok = tok->next;
if (strcmp(tok->val, ")") == 0) {
/* Case where it's just a constant. */
*val = lhs;
return tok;
} else if (strcmp(tok->val, "==") == 0) {
/* Case for equality. */
rhs = tok->next->val;
tok = tok->next->next;
if (strcmp(get_var(lhs), rhs) == 0) {
lhs = "True";
} else {
lhs = "False";
}
} else if (strcmp(tok->val, "!=") == 0) {
/* Case for inequality. */
rhs = tok->next->val;
tok = tok->next->next;
if (strcmp(get_var(lhs), rhs) == 0) {
lhs = "False";
} else {
lhs = "True";
}
} else {
fputs("Expected == or != after ", stderr);
fputs(lhs, stderr);
fputs(" in logic\n", stderr);
exit(1);
}
if (strcmp(tok->val, ")") == 0) {
*val = lhs;
return tok;
} else if (strcmp(tok->val, "||") == 0) {
/* OR */
tok = logic(tok->next, &rhs);
if (strcmp(lhs, "True") == 0 || strcmp(rhs, "True") == 0) {
lhs = "True";
} else {
lhs = "False";
}
} else if (strcmp(tok->val, "&&") == 0) {
/* AND */
tok = logic(tok->next, &rhs);
if (strcmp(lhs, "True") == 0 && strcmp(rhs, "True") == 0) {
lhs = "True";
} else {
lhs = "False";
}
} else {
fputs("Expected || or && in logic\n", stderr);
exit(1);
}
*val = lhs;
return tok;
}
Token *primary_logic(Token *tok, char **val) {
/* Starting ( */
if (strcmp(tok->val, "(") != 0) {
fputs("Expected logic to begin with (\n", stderr);
exit(1);
}
tok = tok->next;
tok = logic(tok, val);
if (strcmp(tok->val, ")") != 0) {
fputs("Expected logic to end with )\n", stderr);
exit(1);
}
return tok;
}
int eval_predicate(Token *tok) {
char *result;
tok = primary_logic(tok, &result);
return strcmp(result, "True") == 0;
}
Token *define(Token *tok, Directive *directive) {
/* define = name "=" (logic | constant) */
char *name = tok->val;
tok = tok->next;
if (strcmp(tok->val, "=") != 0) {
fputs("define of ", stderr);
fputs(name, stderr);
fputs(" has a missing equals\n", stderr);
exit(1);
}
tok = tok->next;
char *val = calloc(MAX_STRING, sizeof(char));
if (strcmp(tok->val, "(") == 0) {
/* It is a logic. */
tok = primary_logic(tok, &val);
} else {
/* It is a constant. */
strcpy(val, tok->val);
}
/* Check for predicate. */
tok = tok->next;
if (tok != NULL) {
if (!eval_predicate(tok)) {
/* Nothing more to do. */
return tok;
}
}
/* Update existing variable, or else, add to the end of variables. */
/* Special case: empty variables. */
if (variables == NULL) {
variables = calloc(1, sizeof(Variable));
variables->name = name;
variables->val = val;
}
Variable *var;
for (var = variables; var->next != NULL; var = var->next) {
if (strcmp(var->next->name, name) == 0) {
var->next->val = val;
break;
}
}
if (var->next == NULL) {
/* We did not update an existing variable. */
var->next = calloc(1, sizeof(Variable));
var->next->name = name;
var->next->val = val;
}
return tok;
}
int interpret(Directive *directive) {
/* directive = (build | improve | define | jump | uninstall) predicate? */
Token *tok = directive->tok;
if (strcmp(tok->val, "build:") == 0) {
tok = fill(tok->next, directive, TYPE_BUILD);
} else if (strcmp(tok->val, "improve:") == 0) {
tok = fill(tok->next, directive, TYPE_IMPROVE);
} else if (strcmp(tok->val, "jump:") == 0) {
tok = fill(tok->next, directive, TYPE_JUMP);
} else if (strcmp(tok->val, "define:") == 0) {
tok = define(tok->next, directive);
return 1; /* There is no codegen for a define. */
} else if (strcmp(tok->val, "uninstall:") == 0) {
tok = fill(tok->next, directive, TYPE_UNINSTALL);
while (tok != NULL) {
if (strcmp(tok->val, "(") == 0) {
break;
}
if (strlen(directive->arg) + strlen(tok->val) + 1 > MAX_STRING) {
fputs("somehow you have managed to have too many uninstall arguments.\n", stderr);
exit(1);
}
directive->arg = strcat(directive->arg, " ");
directive->arg = strcat(directive->arg, tok->val);
tok = tok->next;
}
}
if (tok != NULL) {
return !eval_predicate(tok);
}
return 0;
}
Directive *interpreter(Directive *directives) {
Directive *directive;
Directive *last = NULL;
for (directive = directives; directive != NULL; directive = directive->next) {
if (interpret(directive)) {
/* This means this directive needs to be removed from the linked list. */
if (last == NULL) {
/* First directive. */
directives = directive->next;
} else {
last->next = directive->next;
}
} else {
last = directive;
}
}
return directives;
}
/* Script generator. */
FILE *start_script(int id, int bash_build) {
/* Create the file /steps/$id.sh */
char *filename = calloc(MAX_STRING, sizeof(char));
strcpy(filename, "/steps/");
strcat(filename, int2str(id, 10, 0));
strcat(filename, ".sh");
FILE *out = fopen(filename, "w");
if (out == NULL) {
fputs("Error opening output file ", stderr);
fputs(filename, stderr);
fputs("\n", stderr);
exit(1);
}
if (bash_build) {
fputs("#!/bin/bash\n", out);
if (strcmp(get_var("INTERACTIVE"), "True") == 0) {
if (bash_build != 1) {
fputs("set -E\ntrap 'env PS1=\"[TRAP] \\w # \" bash -i' ERR\n", out);
} else {
/* FIXME early bash has buggy ERR trap handling */
fputs("set -e\ntrap 'bash -c '\"'\"'while true; do printf \""
"[TRAP - use Ctrl+D] $(pwd) # \"; eval \"$(cat)\"; done'\"'\"'' EXIT\n",
out);
}
} else {
fputs("set -e\n", out);
}
fputs("cd /steps\n", out);
fputs(". ./bootstrap.cfg\n", out);
fputs(". ./env\n", out);
fputs(". ./helpers.sh\n", out);
} else {
fputs("set -ex\n", out);
fputs("cd /steps\n", out);
output_config(out);
FILE *env = fopen("/steps/env", "r");
char *line = calloc(MAX_STRING, sizeof(char));
while (fgets(line, MAX_STRING, env) != 0) {
/* Weird M2-Planet behaviour. */
if (*line == 0) {
break;
}
fputs(line, out);
line = calloc(MAX_STRING, sizeof(char));
}
fclose(env);
}
return out;
}
void output_call_script(FILE *out, char *type, char *name, int bash_build, int source) {
if (bash_build) {
if (source) {
fputs(". ", out);
} else {
fputs("bash ", out);
}
} else {
fputs("kaem --file ", out);
}
fputs("/steps/", out);
if (strlen(type) != 0) {
fputs(type, out);
fputs("/", out);
}
fputs(name, out);
fputs(".sh\n", out);
}
void output_build(FILE *out, Directive *directive, int pass_no, int bash_build) {
if (bash_build) {
fputs("build ", out);
fputs(directive->arg, out);
fputs(" pass", out);
fputs(int2str(pass_no, 10, 0), out);
fputs(".sh\n", out);
} else {
fputs("pkg=", out);
fputs(directive->arg, out);
fputs("\n", out);
fputs("cd ${pkg}\n", out);
fputs("kaem --file pass", out);
fputs(int2str(pass_no, 10, 0), out);
fputs(".kaem\n", out);
fputs("cd ..\n", out);
}
}
void generate_preseed_jump(int id) {
FILE *out = fopen("/preseed-jump.kaem", "w");
fputs("set -ex\n", out);
fputs("PATH=/usr/bin\n", out);
fputs("bash /steps/", out);
fputs(int2str(id, 10, 0), out);
fputs(".sh\n", out);
fclose(out);
}
void generate(Directive *directives) {
/*
* We are separating the stages given in the mainfest into a bunch of
* smaller scripts. The following conditions call for the creation of
* a new script:
* - a jump
* - build of bash
*/
int counter = 0;
/* Initially, we use kaem, not bash. */
int bash_build = 0;
FILE *out = start_script(counter, bash_build);
counter += 1;
Directive *directive;
Directive *past;
char *filename;
int pass_no;
for (directive = directives; directive != NULL; directive = directive->next) {
if (directive->type == TYPE_BUILD) {
/* Get what pass number this is. */
pass_no = 1;
for (past = directives; past != directive; past = past->next) {
if (strcmp(past->arg, directive->arg) == 0) {
pass_no += 1;
}
}
output_build(out, directive, pass_no, bash_build);
if (strncmp(directive->arg, "bash-", 5) == 0) {
if (!bash_build) {
/*
* We are transitioning from bash to kaem, the point at which "early
* preseed" occurs. So generate the preseed jump script at this point.
*/
generate_preseed_jump(counter);
}
bash_build += 1;
/* Create call to new script. */
output_call_script(out, "", int2str(counter, 10, 0), bash_build, 0);
fclose(out);
out = start_script(counter, bash_build);
counter += 1;
}
} else if (directive->type == TYPE_IMPROVE) {
output_call_script(out, "improve", directive->arg, bash_build, 1);
} else if (directive->type == TYPE_JUMP) {
/*
* Create /init to call new script.
* We actually do this by creating /init.X for some number X, and then
* moving that to /init at the appropriate time.
*/
filename = calloc(MAX_STRING, sizeof(char));
if (bash_build) {
fputs("mv /init /init.bak\n", out);
/* Move new init to /init. */
strcpy(filename, "/init.");
strcat(filename, int2str(counter, 10, 0));
fputs("cp ", out);
fputs(filename, out);
fputs(" /init\n", out);
fputs("chmod 755 /init\n", out);
} else {
strcpy(filename, "/kaem.run.");
strcat(filename, int2str(counter, 10, 0));
fputs("cp ", out);
fputs(filename, out);
fputs(" /kaem.run\n", out);
fputs("cp /usr/bin/kaem /init\n", out);
fputs("chmod 755 /init\n", out);
}
output_call_script(out, "jump", directive->arg, bash_build, 1);
fclose(out);
if (bash_build) {
out = fopen(filename, "w");
if (out == NULL) {
fputs("Error opening /init\n", stderr);
exit(1);
}
fputs("#!/bin/bash\n", out);
} else {
out = fopen(filename, "w");
if (out == NULL) {
fputs("Error opening /kaem.run\n", stderr);
exit(1);
}
fputs("set -ex\n", out);
}
output_call_script(out, "", int2str(counter, 10, 0), bash_build, 0);
fclose(out);
out = start_script(counter, bash_build);
counter += 1;
} else if (directive->type == TYPE_UNINSTALL) {
fputs("uninstall ", out);
fputs(directive->arg, out);
fputs("\n", out);
}
}
fclose(out);
}
void main(int argc, char **argv) {
if (argc != 2) {
fputs("Usage: script-generator <script>\n", stderr);
exit(1);
}
FILE *in = fopen(argv[1], "r");
if (in == NULL) {
fputs("Error opening input file\n", stderr);
exit(1);
}
Directive *directives = tokenizer(in);
fclose(in);
load_config();
directives = interpreter(directives);
generate(directives);
FILE *config = fopen("/steps/bootstrap.cfg", "w");
output_config(config);
fclose(config);
}

View File

@ -0,0 +1 @@
1aa31b29ce0999b6a9cace93bc584020ec78059b9ad37d9aa3da9ad6c3d9af59 script-generator

View File

@ -0,0 +1 @@
dc6106dbc02839cdc9e3e2348432242eb6d33d840ab74badfd63c3c9997462b9 script-generator

75
seed/seed.kaem Executable file
View File

@ -0,0 +1,75 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2020-2022 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
mkdir -p ${PREFIX} ${BINDIR} ${LIBDIR} ${INCDIR} ${SRCDIR} ${TMPDIR} /dev
# Temporarily change PATH
PATH=/${ARCH_DIR}/bin
# Remove remaining dependencies on /bin (stage0-posix directory)
cp /${ARCH_DIR}/bin/blood-elf ${BINDIR}/blood-elf
cp /${ARCH_DIR}/bin/catm ${BINDIR}/catm
cp /${ARCH_DIR}/bin/chmod ${BINDIR}/chmod
cp /${ARCH_DIR}/bin/get_machine ${BINDIR}/get_machine
cp /${ARCH_DIR}/bin/hex2 ${BINDIR}/hex2
cp /${ARCH_DIR}/bin/kaem ${BINDIR}/kaem
cp /${ARCH_DIR}/bin/match ${BINDIR}/match
cp /${ARCH_DIR}/bin/M1 ${BINDIR}/M1
cp /${ARCH_DIR}/bin/M2-Mesoplanet ${BINDIR}/M2-Mesoplanet
cp /${ARCH_DIR}/bin/M2-Planet ${BINDIR}/M2-Planet
cp /${ARCH_DIR}/bin/mkdir ${BINDIR}/mkdir
cp /${ARCH_DIR}/bin/sha256sum ${BINDIR}/sha256sum
cp /${ARCH_DIR}/bin/unbz2 ${BINDIR}/unbz2
cp /${ARCH_DIR}/bin/ungz ${BINDIR}/ungz
cp /${ARCH_DIR}/bin/untar ${BINDIR}/untar
cp /${ARCH_DIR}/bin/unxz ${BINDIR}/unxz
cp /${ARCH_DIR}/bin/cp ${BINDIR}/cp
cp /${ARCH_DIR}/bin/replace ${BINDIR}/replace
cp /${ARCH_DIR}/bin/rm ${BINDIR}/rm
chmod 755 ${BINDIR}/blood-elf
chmod 755 ${BINDIR}/catm
chmod 755 ${BINDIR}/chmod
chmod 755 ${BINDIR}/cp
chmod 755 ${BINDIR}/get_machine
chmod 755 ${BINDIR}/hex2
chmod 755 ${BINDIR}/kaem
chmod 755 ${BINDIR}/match
chmod 755 ${BINDIR}/M1
chmod 755 ${BINDIR}/M2-Mesoplanet
chmod 755 ${BINDIR}/M2-Planet
chmod 755 ${BINDIR}/mkdir
chmod 755 ${BINDIR}/sha256sum
chmod 755 ${BINDIR}/unbz2
chmod 755 ${BINDIR}/ungz
chmod 755 ${BINDIR}/untar
chmod 755 ${BINDIR}/unxz
chmod 755 ${BINDIR}/replace
chmod 755 ${BINDIR}/rm
PATH=${BINDIR}
M2LIBC_PATH=/M2libc
# mes envars
NYACC_PKG=nyacc-1.00.2
MES_PKG=mes-0.26
MES_PREFIX=${SRCDIR}/${MES_PKG}/build/${MES_PKG}
GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${SRCDIR}/${MES_PKG}/build/${NYACC_PKG}/module
M2-Mesoplanet --architecture ${ARCH} -f script-generator.c -o script-generator
# Checksums
if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o script-generator.${ARCH}.checksums script-generator
else
sha256sum -c script-generator.${ARCH}.checksums
fi
./script-generator /steps/manifest
kaem --file /steps/0.sh

1
seed/stage0-posix Submodule

@ -0,0 +1 @@
Subproject commit 779e5424d4b55fe9b7faea2285ae8b6486df0433

View File

@ -9,27 +9,11 @@ for the bootstrapping process.
import argparse
from sysa import SysA
from sysc import SysC
from lib.generator import Generator
def main():
"""Generate a source manifest for a system"""
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--system",
help="Generate source manifest for the specified systems",
choices=["sysa", "sysc"],
nargs="+",
action="extend",
required=True)
args = parser.parse_args()
if "sysa" in args.system:
print(SysA.get_source_manifest())
if "sysc" in args.system:
print(SysC.get_source_manifest())
print('\n'.join(map(' '.join, Generator.get_source_manifest())))
if __name__ == "__main__":
main()

128
steps/SHA256SUMS.pkgs Normal file
View File

@ -0,0 +1,128 @@
2dac610769286171ca81e736d729f5227938596cf44a0a8a764009715c55d23b autoconf-2.52_0.tar.bz2
7345a49227ed69774e01097c514f1ebd3abaeed0b2b9136b7f5ee1b0fe573390 autoconf-2.53_0.tar.bz2
22418f18b0dbf0476efb1823dcebdf70d7619113ca10076ba9b078ab3597a578 autoconf-2.54_0.tar.bz2
8e74f93f12599f883ba62fe2bf4f69c70270ce368f71aa782f8f42a36a752d19 autoconf-2.55_0.tar.bz2
1bd66ca8cc6300e192afe06cd90b1250f02ca64539a4f3e98a872333ec04f44b autoconf-2.57_0.tar.bz2
83235c739887f0d801e410e922553a6fd7723cbd0c9b2e96106e20538abb3a3b autoconf-2.59_0.tar.bz2
8912ae2a24ea40a7cd3ccab5e97dd109db7be4a86f40458ac836568aa7437b6a autoconf-2.61_0.tar.bz2
d5fcce4baea5e11f983a7e4b7148545ab6720bb4e010898c73387f6711be67f4 autoconf-2.64_0.tar.bz2
298dcf17a439adb306237b308e3c4ed3d376cb863ae0f0f08bfdf1f3199a548b autoconf-2.69_0.tar.bz2
8c2401edf1c68910005bbcb8b8e84727a46f7d9643d2ad1267bd0259078dadc4 autoconf-2.71_0.tar.bz2
6ff691e3ddd4f3d1796d28b07a2a96691dbd9801844c99ccbe660da59dabd74b autoconf-archive-2021.02.19_0.tar.bz2
439fc68ab7d0a9a46caca2c7cbefbdb6ffe906f927e07d150e102bb76b393c37 autogen-5.18.16_0.tar.bz2
02a426e82a52d4a2cd7e73fe3dc5a2c58b3ed100f24a92c57e42511fd86e247c automake-1.10.3_0.tar.bz2
34925adeaa2876a5e068adeb17b71fe7c7105244c3cb5439d33f7406310674da automake-1.11.2_0.tar.bz2
7e36e9e4b3957c95b6de8ff475c9b37aa007e2f9735b01c0eaf14b711fdd112f automake-1.15.1_0.tar.bz2
57100612d902537b72ee2fd3dfecc903f2ea3959f1a480af87c6a1ef9a9d7c03 automake-1.16.3_0.tar.bz2
1c7e09ac08f156960420fca1f6e8560c1855bf01b001a0648b56153d6ceb9c28 automake-1.6.3_0.tar.bz2
444131776779d1f27628088a817bfb8c9aa85f4b036b934794a71e484ec9bd70 automake-1.6.3_1.tar.bz2
e8ff13753943e43972a8cf1672819f001718ed38e5497cf7b554c21a507ba22b automake-1.7.8_0.tar.bz2
ef08694bf8e78ffcf56f9c8a63b0f189e301c06f02ab240e15e4c7fe354c2a0d automake-1.7_0.tar.bz2
9922651b64ad2e29b944082f26db223008220155048f25d64df1f6d82071ff1c automake-1.8.5_0.tar.bz2
c5807850a377e4bb9aa4121d9781d145bdd80327626a9419630a75ce2c8d9c71 automake-1.9.6_0.tar.bz2
f8a55bf656f950ee3c5cea48af03f552166f6db9926b78c78843f3cc52a6e22d bash-5.2.15_0.tar.bz2
ebc631ee8e9382650005984ec5f3910492ccb6fb2656b4c0af0f4afc16998906 bc-1.07.1_0.tar.bz2
90009c7a2232fce68ad628d6afe1f474d57874462b3ea2c50ab1a3e6c60a5a36 binutils-2.30_0.tar.bz2
da658346866061324b92a6b734561257acfdb981783ad5794d67a0cd56e14e58 binutils-2.41_0.tar.bz2
026447a32ab08a8a5150bab82a2f150af4a2ed90c47cfde631e1460eaed019aa binutils-2.41_1.tar.bz2
f0bb18831983493b82fde53917e8d16c6a380761ac5e71e14769a82193fee788 bison-2.3_0.tar.bz2
e4a3c9466d95c58bb072159da3473d71b40eb069b756acefba293588c4495a6f bison-3.4.1_0.tar.bz2
fd3a3b855c3cbc42d719a0cbbae773d27e0e12b563641124ba2870b7103da1f8 bison-3.4.1_1.tar.bz2
5232f6f8f3864b5827a015ce0414d484bb8aeb9f34ba66ceb7093da0a79561a8 bison-3.4.1_2.tar.bz2
6d5e4debdec03aee096dbcefcad878fb5c6a069f895ee7ade878d9eeb97fb83e bison-3.4.2_0.tar.bz2
727b0f28369b78f171dce4e227b05cea474dcb638c357387429c125f0d80fbc8 bzip2-1.0.8_0.tar.bz2
543214998317d764595d3dd247a1fb2e0803ad77978b8474bd24d64c161b9530 ca-certificates-3.95_0.tar.bz2
da3a3c7e0e6ce94ccb3d39885bc44207eb94c912b324a4c7669b5a752648b02d coreutils-5.0_0.tar.bz2
56b84ab2035847524d595bb417c2b91c290174965550be321cd3d5d1f77aa2e5 coreutils-6.10_0.tar.bz2
9fa31a4aeaa5132205efb796c8f546c94c1cfef6b5c27e64f6ebe06ca0360e67 coreutils-9.4_0.tar.bz2
abd629e5675196c39dae00afbe23e2116bbd277be1d82214e2ec557a3b03994f curl-8.5.0_0.tar.bz2
db8757b5fe77f56073caa034bfe9b3af6076d7299db966c4348e06f01a34415f curl-8.5.0_1.tar.bz2
9534d834b018343b8335d0ef0b5faff3ee18e4ecbecf43a2a80deb972283f5d6 dhcpcd-10.0.1_0.tar.bz2
e6372051f90c40d1f4a5cca2f8930187b363dfc916bcb973c72bca6c0aba3cd5 diffutils-2.7_0.tar.bz2
41e3129b974391fe4ace69914fdef9b0fe72c6f5d87d495750fb89bdd999fa01 diffutils-3.10_0.tar.bz2
bda6afcd3a390a34a57443269a4857ccc470129f7a557981778c145fd841cbd1 dist-3.5-236_0.tar.bz2
26c0835a8b9be115082a2866e906363947528169c7274bd3b82752df77e99f11 e2fsprogs-1.45.7_0.tar.bz2
9c6f7e156f299f1d0948537e28f00d40e727a3debae3cce158e9bce827136214 ed-1.4_0.tar.bz2
0061d240f9bb2bb534db7003ddcc4eae9981954ad72e8f41ff1d76dc449ebd37 file-5.44_0.tar.bz2
eec07e0d710ed3dd8d0ba6a1ec6ca9f1fa3a611bbb225195435679175317bf90 findutils-4.2.33_0.tar.bz2
80798628ccb38521f42e1ca1abe4f0244e4b283e6f662cd354ab70e61a9b4675 flex-2.5.11_0.tar.bz2
b3a8d59229289ca5a1de6a24c9c828d2847144f6662e0d5b7f41e7ff6e57abaa flex-2.5.33_0.tar.bz2
e10060b55e2378a065cf8590cae17400c8befc6b3bb0cbbb7093f1b9f46ec4cc flex-2.6.4_0.tar.bz2
5619cf9a893902491a9d8a8f8da4d39efb3606d7d0a72cb4aaa9d1ff798b5495 gawk-3.0.4_0.tar.bz2
62e90abe883f6ccd679adf42d00c2c18a9809bbab599411c81b6c4ac4d446452 gawk-5.3.0_0.tar.bz2
6de1c1380026ef9948387e665610185b6014f47a80453177a6c81898c95cbbd3 gc-8.0.4_0.tar.bz2
c99d080cf17ac3f75cbae67095cb76220a92d96d877c92c896a7f05c9c94e92d gcc-10.4.0_0.tar.bz2
e0c9e7f4f0cd0d5027f2a38eb262f883133c31ac9ec93ee6afa5abc028096bc0 gcc-13.1.0_0.tar.bz2
27bb77077559b6c0f8dd7b8790ac48f70410ecc8816b5c493988ad5556da65e2 gcc-4.0.4_0.tar.bz2
c1bf792e90df13bf7a24d3f8ce3939fd96ff61b8117e4dcef75605974f3fcf25 gcc-4.0.4_1.tar.bz2
7ac087bf006188154c28401d0c875ede56076c19d41bc54ffa0d7cc18ce40800 gcc-4.7.4_0.tar.bz2
dc67fc1b132fa3945349efe74c5b2197bd0b6babf4d29d2deddd04f09d9af680 gettext-0.21_0.tar.bz2
309282ba840f80b5e10897b1221f3ff3329b9e05b982c788d03652f411974524 gmp-6.2.1_0.tar.bz2
62edfa633f64202b2d29199d11d56a897654a441c7ae39a4d59ca5fe75199f61 gperf-3.1_0.tar.bz2
c1989fc2855dbb0350c4e5b677028306614a9f4b5cb6c01fd459c5e1abf592b9 grep-2.4_0.tar.bz2
8e612afb9a439aa8bf5db0fc2589eec890a6017690412d5c8e88a5838730b42c grep-3.7_0.tar.bz2
ed16ffe92f50bca0dac71145adc07c08043837457dee46bb3a5f5d0a6dc99221 grub-2.06_0.tar.bz2
e2a85aad6d51e52c9a30afeed058f95172fde1215f77243549274672990f6237 guile-3.0.9_0.tar.bz2
6585ae3bc8149ec0e3fba766278fa30e2d7f0e7d1b9a9a4a457e0afa15b109c9 gzip-1.13_0.tar.bz2
29a1603101cfbe2660e2d695f5b9c08dc9eefd8e3389405a6530c479e271821b heirloom-devtools-070527_0.tar.bz2
8d2015b87337abbf287f7a39ee4cf53514120b5d3e90a93fe7d533dcc43f14fa help2man-1.36.4_0.tar.bz2
ea5639dc6198c5f243362a1a7adfbea0cb779e085975712a1b410e82d7e0cf84 kbd-1.15_0.tar.bz2
50a0f881161c68fe7c9ec6836b11a905b0d54e08e99b2476e8d1f5ac3212769e kexec-linux-1.0.0_0.tar.bz2
fc784d2c46ffe91e7d54150022c9d2687140e90e3019c1d6799f875f22d99d2e kexec-tools-2.0.22_0.tar.bz2
e4dcdabf540a9e51a555616abff8ec2fdee5bb40bb05ce702b5410239dd5d7d8 libarchive-3.5.2_0.tar.bz2
36550df491767bb24d2ccab304ce70a3b4956e7c0c0e0c343d922fd57cdafbdd libatomic_ops-7.6.10_0.tar.bz2
fea96776b929569b98bc1740a9977cf8c0eff1d999a08d766bcc0f40c7b1380c libbsd-0.11.8_0.tar.bz2
b39826742e236890f3562cdf19492e7ef4224b271f3e75ddeab1f07982b03ebe libffi-3.3_0.tar.bz2
0f6aefeb587b3d14d8ea73d7750f946a23d3e59a76a0ee5cdcdcc8132bccf73d libmd-1.1.0_0.tar.bz2
daae709e98d2df2190d1d13b4e86f7f3fe90fa7a975282fe0bb03289b6539f29 libtool-2.2.4_0.tar.bz2
6cefa575362149620f8008a32c8af54f0198a18bc6ab910bd3cead196c1507d7 libtool-2.4.7_0.tar.bz2
503007bbcddcf4e49d26514c59b4c9501f8b42f0c994a59dfdc388b1ae6b7900 libunistring-0.9.10_0.tar.bz2
5787f84a49e1d22560d0398e4f9075d6021017eb2a757697dc2877e7565d0199 linux-4.14.341-openela_0.tar.bz2
c97644d0db5b3de127b048683afee6d31453441d97ba5dea71df5838b13542a4 linux-headers-4.14.341-openela_0.tar.bz2
78b0cf6d9312e53c613186cbddd5f747310f375c1f322f33a6ac33682d2f3389 m4-1.4.19_0.tar.bz2
0e3c21b0a1d8ca0c3f74a98ebe268809def62778ff4a486ff20c1d6e8247dc49 m4-1.4.7_0.tar.bz2
e69554b0a77b419ddd5d0a0e418ba4005ecd0f6784c92a6928a0270bd929a098 make-3.82_0.tar.bz2
6d24960d6a987f68a7e0e3abf6edb52d2e0fe4c86f6ba45327e9634dbf7d40b4 make-4.2.1_0.tar.bz2
17cd976bc0f6e897c6fffe43dd7c55d93ce0adadf1b4dc72925b80e2d266519f mpc-1.2.1_0.tar.bz2
98a9f55c01ed375fae21913284e7fa07ff434c0810f34d791f3fbaa1df221302 mpfr-4.1.0_0.tar.bz2
40fc3497fa8cdd96ac338a10e78504c6dc942e7f4fa459550fb953d52bd53aa7 musl-1.1.24_0.tar.bz2
20285055d84ac6106965a9d343ba8ebd19209f62782efb8ed863318c0b7d5e7d musl-1.1.24_1.tar.bz2
d58d85c4be26d90f111f273929a4998d05294fe5aa37c4842d5aecaa593e6079 musl-1.1.24_2.tar.bz2
81f79a0faf58e105c5f12d9f538d3ea7578a3b361e633ab8f47324ec23ec9de6 musl-1.2.4_0.tar.bz2
6dc5e763b747b66f72692c6820d7f46b7f4cf2e2fe05229a1d01c03919c1c936 musl-1.2.4_1.tar.bz2
820203286127e7c22cee9f1b3cff664431f10d14c3f22f00b3e771fd849fd449 musl-1.2.4_2.tar.bz2
a18c4b2e5de2bfe5bb3ee9d360484fcfebad3df042f1859d4aa333dd60f55e56 opendoas-6.8.2_0.tar.bz2
67b536b2f2a6c56e4673e462a3dbe2f42e8a4a5cb0b61b6bc1fdc14adea33f63 openssl-3.0.13_0.tar.bz2
71864d042cdc564b65eab21360902c714e9b43f80a19689c5600589529b267e7 patch-2.7.6_0.tar.bz2
287b0a8c0de14a2817e68ab023bfc502a0880d8c34386162351d5ffaf942da70 perl-5.000_0.tar.bz2
9617799cdc9d4be39d31af54b9bcae47941d68416e9cc9c92cbc2ed08785dbc1 perl-5.003_0.tar.bz2
74d64a8af080022432fa94dba449090419d25b103d247710dc0b6102a4ad86a6 perl-5.10.1_0.tar.bz2
d381e910532061ac97e48ff09906bddbcb0956b37fc47d8c666f56a56b50c589 perl-5.32.1_0.tar.bz2
d63d2fda752759778ae2d0dd08e6c023a81afbfc63ce11db860fc6858ae26c7f perl-5.6.2_0.tar.bz2
c39ab70bce0bd09f013109ad7370085e90d77ef2b55abcfdc922d7832524c9cf perl5.004-05_0.tar.bz2
2ac211ad3cf966dd89434c175970e10699c363b66228abc1642766aeafe2766a perl5.005-03_0.tar.bz2
1b9d4260edf7b2241d10e4c4ad17d0f90047bd4bf42f2487a7133902529e9dfe pkg-config-0.29.2_0.tar.bz2
2f7198009e4d021d52ee4ce86241b4936fb88349c20cc8b6c286261368878c3c python-2.0.1_0.tar.bz2
b5d86ddc98cfbc684b03f1c84c786caaad810d5e4c7be38089f324eb3c276ad9 python-2.0.1_1.tar.bz2
396577cdd0cc61d76420a1771c64156e49e8f9d00430c82feb88ad933b341632 python-2.3.7_0.tar.bz2
2499cb7f10f292c3506fbf1b6a876195179ec98edfe7b8c357140137a1449492 python-2.3.7_1.tar.bz2
80d8fcaf68c82238ddffb120b62fbc20d58bd9e2416cba080547a9f442e9e229 python-2.5.6_0.tar.bz2
3508248f299b73c50e3607c4c294d40face05170476a5026b0821aed69025863 python-3.1.5_0.tar.bz2
12b1ffc7ec98ba8f807160b93ba69a694d5395567c3bcac1e49e8f8d1d50de43 python-3.1.5_1.tar.bz2
d6a7d3a109f63cd5ed4feaa772c33e272e570e216346ee90f6ca365d3a951615 python-3.11.1_0.tar.bz2
60b93253a2078f849f81e7e1ed6233e30702f03b1893640eee95671d814f5514 python-3.3.7_0.tar.bz2
da7c8ec579dd225c0d8bee63d95aeeb27ac2d5a60d4eefe298508cbf86bf506c python-3.4.10_0.tar.bz2
af7a8334045fed8bd610b19194c0b46aa670070fc4738c34449ba5e93e49db8a python-3.8.16_0.tar.bz2
c313520567176dd9bf61a271ee56e06a62e944e862f9dc4564d94b7fc884c8f9 sed-4.0.9_0.tar.bz2
e8daec00b2c2de7b18efbec057dc9290eed06668806c6f5a48914d4a5cd95eb4 sed-4.8_0.tar.bz2
ef2f2c791c1ae74f19c98ebcd7edae6ae28bc1d9367cc3a2cdb1ac302a156cb7 shadow-4.14.3_0.tar.bz2
912d8f344104f1322255d6210c7c7e1371413ab530b2c6796e6aa565c74bf647 tar-1.34_0.tar.bz2
60e98c09d9135b0150ed52b71cfbb072335741c0954a9b14bbba850c20564036 tcc-0.9.27_0.tar.bz2
e2c9ea82a1ebf2d5d4c937fa837ddb6fc6835395cf03f3207df40c96b6cafcd8 tcc-0.9.27_1.tar.bz2
4860223e6960ce976e6ad59aa90b69c18a1473684bce59ec8a8b36535405792b tcc-0.9.27_2.tar.bz2
d4fe9460ca561fc2f546f9730f19f541b17dac0bcc42eb190abba856588c3593 tcc-0.9.27_3.tar.bz2
50ebaa1d8fcc4a03a43d431eb71e2f435cc8712ae47d400564df3716037d553a texinfo-6.7_0.tar.bz2
59bda6faaa95782154b917a6600cdf932e08cd6bf9388ba40d801baf18e5b454 util-linux-2.19.1_0.tar.bz2
ecdb7ffeb9256f6a9760be70969fe5dea9cde6a538cc88595281fe44340e98a1 which-2.21_0.tar.bz2
3fade2079cc91f2c5624ff7247220059caee82e7de493332103d7a78155400b2 xz-5.4.1_0.tar.bz2
ca8ec9876a7334f5f87e1159e0efe343b8b497ffb0dea8b548223035ecd67f9e zlib-1.2.13_0.tar.bz2

View File

@ -0,0 +1 @@
https://mirrors.kernel.org/gnu/autoconf/autoconf-2.64.tar.xz 32d977213320b8ae76c71175305301197f2b0e04e72d70694bc3d3e2ae6c7248

View File

@ -0,0 +1 @@
https://mirrors.kernel.org/gnu/autoconf/autoconf-2.69.tar.xz 64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684

View File

@ -15,13 +15,13 @@ src_prepare() {
src_compile() {
(
set -e
export PKG_CONFIG_PATH="${LIBDIR}/pkgconfig"
declare -x PKG_CONFIG_PATH="${LIBDIR}/pkgconfig"
sed -i "s/make install/make install DESTDIR=\${DESTDIR}/" bootstrap_tarball.sh
sed -i "/make check/d" bootstrap_tarball.sh
export FINALPREFIX="${PREFIX}"
export GUILE_STATIC="--static"
export GNULIBDIR="${PWD}"/../gnulib-8f4538a5
export MAN_PAGE_DATE=1970-01-01
declare -x FINALPREFIX="${PREFIX}"
declare -x GUILE_STATIC="--static"
declare -x GNULIBDIR="${PWD}"/../gnulib-8f4538a5
declare -x MAN_PAGE_DATE=1970-01-01
SKIP_MAIN=1 . ./bootstrap_tarball.sh
prepare_tarball
@ -41,7 +41,7 @@ src_compile() {
SOURCE_DIR="$PWD" ./config/bootstrap
# Specify timeout to avoid non-reproducibility
./configure \
CPPFLAGS=-D_LARGEFILE64_SOURCE=1 ./configure \
--prefix="${FINALPREFIX}" \
--libdir="${FINALPREFIX}/lib/i386-unknown-linux-musl" \
--disable-shared \

View File

@ -1,4 +1,6 @@
https://github.com/schierlm/gnu-autogen-bootstrapping/archive/refs/tags/autogen-5.18.16-v1.0.tar.gz 98ff63400dff5282017c33e4ec3c93da8a92a5260340da253e59bd6eef18d116
https://github.com/schierlm/gnu-autogen-bootstrapping/archive/refs/tags/autogen-5.18.16-v1.0.1.tar.gz 953ba180b18acff188a0a8700770c7cf2fc97e1683c7b9699a5a748b542ccdd5
https://mirrors.kernel.org/gnu/autogen/rel5.18.16/autogen-5.18.16.tar.xz f8a13466b48faa3ba99fe17a069e71c9ab006d9b1cfabe699f8c60a47d5bb49a
https://git.savannah.gnu.org/cgit/autogen.git/snapshot/autogen-5.18.16.tar.gz 0c04ab2f7ce13c4a1c06c4abc7dfe75312aad89b8b0a1068e5e563787eb56632
https://files.bootstrapping.world/autogen-5.18.16.tar.gz 0c04ab2f7ce13c4a1c06c4abc7dfe75312aad89b8b0a1068e5e563787eb56632
http://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-8f4538a5.tar.gz e207c0bb72093c3a72dde302fcfaa1dbda12a62172d47b73565883a92209ebab
https://files.bootstrapping.world/gnulib-8f4538a5.tar.gz e207c0bb72093c3a72dde302fcfaa1dbda12a62172d47b73565883a92209ebab

View File

@ -12,17 +12,17 @@ src_prepare() {
sed -i '/doc\/Makefile.inc/d' Makefile.am
sed -i '/t\/Makefile.inc/d' Makefile.am
AUTOCONF=autoconf-2.69 AUTOM4TE=autom4te-2.69 ./bootstrap
AUTOCONF="autoconf-2.69 -f" AUTOM4TE=autom4te-2.69 ./bootstrap
rm doc/automake-history.info doc/automake.info*
}
src_configure() {
AUTORECONF=autoreconf-2.69 AUTOM4TE=autom4te-2.69 AUTOHEADER=autoheader-2.69 AUTOCONF=autoconf-2.69 ./configure --prefix="${PREFIX}"
AUTORECONF=autoreconf-2.69 AUTOM4TE=autom4te-2.69 AUTOHEADER=autoheader-2.69 AUTOCONF="autoconf-2.69 -f" ./configure --prefix="${PREFIX}"
}
src_compile() {
AUTORECONF=autoreconf-2.69 AUTOM4TE=autom4te-2.69 AUTOHEADER=autoheader-2.69 AUTOCONF=autoconf-2.69 make -j1 MAKEINFO=true
AUTORECONF=autoreconf-2.69 AUTOM4TE=autom4te-2.69 AUTOHEADER=autoheader-2.69 AUTOCONF="autoconf-2.69 -f" make -j1 MAKEINFO=true
}
src_install() {

View File

@ -0,0 +1 @@
https://mirrors.kernel.org/gnu/automake/automake-1.15.1.tar.xz af6ba39142220687c500f79b4aa2f181d9b24e4f8d8ec497cea4ba26c64bedaf

View File

@ -0,0 +1 @@
467552a7875bae2086ba0fa9a8d2a253a158984e27b2e89acf2e3bcec539ad54 /usr/bin/bash

View File

@ -49,6 +49,7 @@ COMMON_CFLAGS = \
-DHAVE_BZERO \
-DHAVE_POSIX_SIGNALS \
-DHAVE_GETCWD \
-DHAVE_RENAME \
-DHAVE_SYS_SIGLIST \
-Dendpwent\(x\)=0 \
-Denable_hostname_completion\(on_or_off\)=0

View File

@ -16,8 +16,8 @@ mkdir build src
cd build
# Extract
cp ${distfiles}/${pkg}.tar.gz ../src/
gzip -d -f ../src/${pkg}.tar.gz
cp ${DISTFILES}/${pkg}.tar.bz2 ../src/
bzip2 -d -f ../src/${pkg}.tar.bz2
tar xf ../src/${pkg}.tar
rm -r ../src/
cd ${pkg}
@ -46,11 +46,8 @@ cd ..
make
# Install
install bash ${prefix}/bin/
mkdir /bin/
ln -s ${prefix}/bin/bash /bin/bash
ln -s ${prefix}/bin/bash /bin/sh
ln -s ${prefix}/bin/bash ${prefix}/bin/sh
install bash ${PREFIX}/bin/
install bash ${PREFIX}/bin/sh
cd ../..
@ -59,7 +56,7 @@ if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o ${pkg}.checksums \
/usr/bin/bash
install ${pkg}.checksums ${srcdir}
install ${pkg}.checksums ${SRCDIR}
else
sha256sum -c ${pkg}.checksums
fi

1
steps/bash-2.05b/sources Normal file
View File

@ -0,0 +1 @@
https://src.fedoraproject.org/repo/pkgs/bash/bash-2.05b.tar.bz2/f3e5428ed52a4f536f571a945d5de95d/bash-2.05b.tar.bz2 1ce4e5b47a6354531389f0adefb54dee2823227bf6e1e59a31c0e9317a330822

View File

@ -53,9 +53,5 @@ src_compile() {
src_install() {
install -D bash "${DESTDIR}${PREFIX}/bin/bash"
# Work around weird symlink bug
install bash "${DESTDIR}${PREFIX}/bin/sh"
# Needs special handling b/c is currently running - tar doesn't like this
rm -f "${PREFIX}/bin/bash" "${PREFIX}/bin/sh"
}

1
steps/bc-1.07.1/sources Normal file
View File

@ -0,0 +1 @@
https://mirrors.kernel.org/slackware/slackware64-15.0/source/ap/bc/bc-1.07.1.tar.xz 95396f88fc719a1bf8bd463809119526fef44a42ab9eb708335c2cb79bc801c6

Some files were not shown because too many files have changed in this diff Show More