Commit graph

78 commits

Author SHA1 Message Date
Samuel Tyler
bbccded731
Use a "real" copyright line 2025-10-17 18:53:10 +11:00
Andrius Štikonas
3d1d1e751f
Merge pull request #528 from fosslinux/mirror-docs
Document mirrors a bit better
2025-09-08 01:04:45 +01:00
fosslinux
00e39e13d0 Force people to include a mirror 2025-07-17 17:47:43 +10:00
Alexandre Gomes Gaigalas
6e5e42307b Allow --qemu and file:// --mirrors to be used together
When using file:// mirrors, rootfs.py will spawn a local HTTP
server at 127.0.0.1.

In combination with --qemu, this poses a problem: downloads
on the host machine will work, but downloads on the guest
machine will not reach the local server.

This commit introduces a change to rewrite the address to
10.0.2.2 inside the guest, only when QEMU=True is set in
the configuration, allowing this combination to build
past the get_network improvement step.
2025-06-11 22:28:28 -03:00
Andrius Štikonas
f3553639f9 Improve support for pre-python 3.12 f-strings. 2025-02-04 23:55:16 +00:00
fosslinux
7d50a224c6 Support file:// mirrors
Spawns a simple HTTP server to host the mirror.
Useful for testing mirror support or CI in chroot or bwrap modes.
2025-02-02 10:02:32 +11:00
fosslinux
df1c9e9aba Support mirrors within 2025-02-02 10:02:32 +11:00
fosslinux
4c08ba4de3 Integrate configurator with rootfs.py 2024-05-28 21:57:36 +10: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
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
fosslinux
2182076773 Use a constant umask 2024-01-26 10:29:57 +11:00
rick-masters
82235e5bd0 Account for int and NoneType in string concatenations. 2024-01-10 18:03:50 +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
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
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
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
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
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
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
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
f66f9efa2c Update bwrap bootstrap code to match the simplify refactor 2023-12-26 13:01:24 +11: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
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
8d193df823 Fix printed image paths for bare-metal bootstrap 2023-12-22 13:06:59 +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
fosslinux
05c13dd64e Modify rootfs.py infrastructure to support the new layout 2023-12-15 21:43:21 +11:00
Andrius Štikonas
f98161581c Update to newer bootstrappable tcc snapshot. 2023-11-19 15:49:59 +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
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
Paul Dersey
c61b4afd8a Boot Fiwix and Linux without serial console on bare metal 2023-06-15 11:18:51 -04:00
rick-masters
d2870cf17a Generate bootstrap.cfg for bare metal. 2023-05-26 12:16:06 +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
ce33a6e9f9 Actually, split into 3, sysc is too long 2023-05-04 22:15:35 +10:00
fosslinux
3723747562 Add internal-ci argument for ci passes to rootfs.py 2023-05-01 20:53:48 +10:00
Eduardo Sánchez Muñoz
55a44d9347 Force building kernels with --update-checksums 2023-04-16 12:14:26 +02:00
Eduardo Sánchez Muñoz
dd8ce0e516 Add option to build kernels and related tools during chroot and bwrap builds
The main motivations to have this are:
* Detect checksum changes with chroot/bwrap builds
* Avoid removing checksums from `SHA256SUMS.pkgs` when unsing `--update-checksums`
* Find crashes that would otherwise be missed in `builder-hex0`
2023-04-16 12:13:20 +02:00
fosslinux
b0a2747ada
Merge pull request #279 from eduardosm/external-sources-without-net
Pass `--unshare-net` to bwrap when building with `--external-sources`
2023-04-14 02:05:48 +00:00
Eduardo Sánchez Muñoz
c143e65154 Pass --unshare-net to bwrap when building with --external-sources
Ensures that when `--external-sources` is used, the build does not require a working internet connection.

`--unshare-net` is always passed for the sysa phase.
2023-04-13 18:52:37 +02:00
fosslinux
d98f97e214 Introduce parallelism
By using --cores argument to rootfs.py, JOBS= is set in the
live-bootstrap environment, and -j${JOBS} is used on builds. This speeds
larger packages up significantly.

A fair number of packages do not build properly with parallelism. Most
of these, at least for now, are disabled with -j1.
2023-04-13 17:13:53 +10:00
fosslinux
58b8c1768c Clarify custom kernel logic 2023-04-11 16:36:25 +10:00
rick-masters
3c817913c7 Fix criteria for kernel bootstrapping. 2023-04-03 18:07:24 +00:00
rick-masters
ecf99ab08b Implement kernel bootstrap up to building Linux. 2023-03-31 18:08:50 +00:00
Seppo Yli-Olli
7167610125 Split sysa and sysc when using bwrap
Using separate bwrap invocations allows dropping chroot permission
2023-02-07 18:03:20 +02:00
Seppo Yli-Olli
56cab8bb71 Support building only sysa with chroot mode
This is intended primarily for external build systems that directly
bind into sysa and sysc rather than using rootfs Python wrapper.
2023-02-02 09:12:49 +02:00
Dor Askayo
74c852b166 Add /dev/shm for sysc
This allows named semaphores to be created. See sem_overview(7).
2023-02-02 01:55:33 +02:00
fosslinux
ac010bc1a0
Merge pull request #201 from doraskayo/musl-libdir-triplet
Rename /usr/lib/musl to /usr/lib/i386-unknown-linux-musl
2023-01-30 08:52:17 +11:00
fosslinux
5458a3e6aa Quick fix to tmpdir rework
QEMU no --external-sources broken due to bootstrap.cfg
2023-01-29 21:07:56 +11:00
Dor Askayo
46a5773f66 Fix a typo in rootfs.py 2023-01-28 19:14:49 +02:00