Commit graph

72 commits

Author SHA1 Message Date
Samuel Tyler
bbccded731
Use a "real" copyright line 2025-10-17 18:53:10 +11:00
Samuel Tyler
851aa5ed5b Add distfile source type to sources files 2025-10-03 21:32:59 +10:00
fosslinux
ba89224641 Modify GH actions to support mirror 2025-02-02 10:02:32 +11: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
Andrius Štikonas
9950b07204 Silence pylint errors. 2024-10-25 18:15:58 +01:00
Googulator
8884d79802
Allow use of base.tar.bz2 from previous build as early preseed
base.tar.bz2 will contain the "steps" and "external" subdirectories, which we later try to create - ensure that they are deleted when restoring an early preseed; this way base.tar.bz2 works without any modification as a preseed tarball
2024-05-22 00:51: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
fosslinux
b80e1f6a57 Ensure that substituted files are equivalent to upstream 2024-02-24 20:36:12 +11: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
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
rick-masters
5aa58e34e0 Add -F flag to mkfs to avoid prompt to proceed. 2024-01-29 23:51:52 +00: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
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
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
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
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
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
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
9ed4ae9a59 Support reusing existing directory for multipass bootstrapping 2023-12-26 13:01:24 +11: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
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
ab47483a51 Linters & CI updates 2023-12-15 21:44:43 +11:00
fosslinux
05c13dd64e Modify rootfs.py infrastructure to support the new layout 2023-12-15 21:43:21 +11: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
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
Andrius Štikonas
26552a928f Increase disk size to 16G. 2023-05-20 12:46:22 +01: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
Andrius Štikonas
d83f810773 Pylint fixes. 2023-02-01 22:17:57 +00:00
fosslinux
51b0bf8405 Rework tmpdir & associated a bit.
- Split out tmpdir logic into a separate entity & add the appropriate
  arguments and checks.
- sysb can be removed since there is now no associated logic.
- Move disk/etc logic into tmpdir.py.
2023-01-28 16:51:00 +11:00
Andrius Štikonas
77b64a0585 parts.rst: add more verbose description of stage0-posix. 2023-01-21 01:26:36 +00:00
Dor Askayo
a1c8c0312c Download source files using a source manifest 2023-01-13 23:38:18 +02:00
Dor Askayo
425beee8dd Always pass file name to download_file()
Move the file name decision to get_packages() when a file name is not
specified in the package source file.
2023-01-13 19:41:32 +02:00
Dor Askayo
38e5dfe35b Pass destination directory to download_file() 2023-01-13 16:21:56 +02:00
fosslinux
10a55522a2 Change sources getting method.
- Rather than defining the urls where they are gotten (python sysa,
  python sysc, inside sysc), a spec file is now used that is easily
  interpretable and tool-independent.
- This is interpreted by rootfs.py and inside sysc.
- This is also used to make sources available and extract sources.
- Manual dirname selection is no longer required as is tarball renaming
  upon download - all of this is handled automatically.

Fixes #188
2022-10-02 09:48:20 +11:00
Dor Askayo
43a8cc6b50 Add a timeout in requests.get() 2022-09-07 22:35:43 +03:00
fosslinux
25f37ba926 Various fixes from rebase
This took a while so a bunch of stuff got broken in rebase.
2022-06-18 09:10:11 +10:00