Commit Graph

25 Commits (master)

Author SHA1 Message Date
Dustin b2a0aab680 Include sleep command in initramfs
Aimee OS/aimee-os/pipeline/head This commit looks good Details
This is needed in case we need to poll for the block device containing
the root filesystem.
2025-09-03 09:51:51 -05:00
Dustin d9415b0fb5 Set machine-id to uninitialized
An empty `/etc/machine-id` file does _not_ trigger systemd's "first
boot" logic.  This means with `ConditionFirstBoot=true` will not run,
and the unit preset policy will not be applied.  To ensure a first boot
behaves the way we want, we need to pre-populate the `/etc/machine-id`
file with the string `uninitialized\n`, per _machine-id(5)_ § _First
Boot Semantics_.
2025-09-03 09:48:20 -05:00
Dustin f838e9f0bd Do not run systemd preset-all at build time
Aimee OS/aimee-os/pipeline/head This commit looks good Details
Let systemd apply preset policy on first boot.  This keeps symlinks out
of the immutable image.
2025-09-03 08:30:19 -05:00
Dustin 62035f3223 init-storage: Add retry loop for findfs
Aimee OS/aimee-os/pipeline/head This commit looks good Details
Occasionally, especially on a Raspberry Pi, the storage subsystem has
not fully enumerated all of the disks before the `init-storage` script
starts.  This prevents the system from being able to boot, since the
script attempts to identify the root filesystem very early.  Now, we try
a few times to identify the filesystem before giving up, to give the
kernel a chance to discover everything.
2025-09-03 08:06:26 -05:00
Dustin f3c6c71bfa Force built-in kernel overlayfs driver
Aimee OS/aimee-os/pipeline/head This commit looks good Details
As with the other "real" filesystems, we need the OverlayFS driver to be
built into the kernel so it is available in early boot.
2025-08-31 08:09:18 -05:00
Dustin 7d44d03279 Force built-in kernel support for filesystems
Aimee OS/aimee-os/pipeline/head This commit looks good Details
the `KCONFIG_ENABLE_OPT` macro will not switch a `=m` value to `=y`, so
if the downstream kernel configuration already enables these
filesystems as modules, they will not get built into the kernel image,
making the system unbootable.  We need to call `KCONFIG_SET_OPT` instead
to explicitly set them to be built-in.
2025-08-30 15:36:07 -05:00
Dustin 9d00ebfdba Use LINUX_IMAGE_NAME to find kernel file
Aimee OS/aimee-os/pipeline/head This commit looks good Details
It turns out, Buildroot already sets a variable, `LINUX_IMAGE_NAME`,
that holds the name of the Linux kernel image file.  Instead of figuring
it out for ourselves (incorrectly, it turns out), we can just use that.
2025-08-30 14:04:53 -05:00
Dustin dd6261aa33 Configure network interfaces by default
Aimee OS/aimee-os/pipeline/head This commit looks good Details
For an optimal out-of-the-box experience, we need to automatically
configure any wired network interfaces with DHCP.  `systemd-networkd`
does not do this by default.
2025-08-30 11:21:44 -05:00
Dustin 821ea84ea7 Implement system-update feature
The `system-update` and `install-update` scripts are the same as from
Aimee OS v1, with references to Gentoo replaced, of course.  We need
some additional kernel features in order to mount the firmware partition
and update the GRUB environment file, and of course the `grub-editenv`
tool itself.  We also need `wget` for now, since that's how the tool
downloads the specified update file from the network.

Eventually, `system-update` will be replaced by a much more robust tool,
with package URL discovery, signature verification, etc.  The shell
script will do for now while development is still proceeding rapidly.
2025-08-30 11:21:44 -05:00
Dustin 7e5a83ba28 configs/*: Move GRUB, kernel config to external.mk
The fewer required items in each defconfig file, the easier they will be
to maintain.
2025-08-29 20:29:43 -05:00
Dustin 44b2ce8a99 Begin persistent storage implementation
Aimee OS/aimee-os/pipeline/head This commit looks good Details
Most of the logic in the `init-storage` script is the same as it was in
Aimee OS v1 (Gentoo).  The major difference is now we are initializing
the data volume in the initramfs instead of in the real OS.  This allows
us to make all of `/etc` writable via OverlayFS, instead of having only
certain sub-directories writable via bind-mounts.

Buildroot doesn't really have any tools for building an initramfs,
unfortunately.  It does have a bit of infrastructure for running
`dracut`, but I'd really rather avoid having that much complexity in the
initramfs; all we need is to run the `init-storage` script and then
switch root.  Instead, the `mkinitramfs.sh` script, called in the
post-build stage, creates the CPIO archive from files in the target
directory.  The only particularly interesting bit is how it resolves
shared library dependencies, to make sure the appropriate resources are
available for the requisite commands.

I briefly considered building a statically-linked BusyBox just for the
initramfs.  Since it doesn't provide several important tools like
`btrfs`/`mkfs.btrfs`, I had to implement the dynamic link resolution
function anyway.  It made sense, then, to copy Dash and the necessary
Coreutils binaries themselves.
2025-08-29 20:17:52 -05:00
Dustin 05dd3810c9 configs/qemu: Enable debug shell on ttyAMA0
We set the default kernel command-line arguments to tell systemd to
spawn a debug shell on the serial console, instead of the default getty.
This will allow tests to run commands directly on the console, without
any authentication, etc.
2025-08-29 20:17:52 -05:00
Dustin 8a2d305b04 grub2: Support setting rootflags in config
The `AIMEEOS_DEFAULT_ROOTFLAGS` kconfig option can be used to set the
default value for the `rootflags` GRUB2 environment variable.  The value
of this variable will be passed along as command-line arguments to
whatever kernel is chosen at boot.

Since post-image scripts do not have access to kconfig option values, we
need to build the GRUB2 environment file in the
`GRUB2_INSTALL_IMAGES_CMDS` script fragment instead.
2025-08-29 20:17:52 -05:00
Dustin 20c92961d6 ci: Add CUSTOM_TARGET parameter
If a value is provided for the `CUSTOM_TARGET` parameter, the specified
target will be built first, before building the filesystem images.  This
provides a way to e.g. rebuild a specific package.
2025-08-29 20:17:52 -05:00
Dustin 1a33e711bb configs/*: Install GRUB terminfo module
So we can set `terminfo dumb` and hopefully get better output over the
serial console.
2025-08-29 20:13:18 -05:00
Dustin 3a0d599ff6 gen-grub-cfg: Support different kernel file names
Different architectures and/or configurations can use a different name
for the Linux kernel image file.  The `gen-grub-cfg.sh` shell script
needs to be able to identify the correct file name in the GRUB
configuration fragment it embeds in the root filesystem image.
2025-08-29 20:13:18 -05:00
Dustin 66af20213b board/qemu: Generate sdcard.img with post-image
In order to test AimeeOS A/B filesystem updates, we need a full disk
image just like the Raspberry Pi variant has.
2025-08-29 20:13:18 -05:00
Dustin d41ad4c55c ci: Add Jenkins pipeline 2025-08-29 20:13:14 -05:00
Dustin 841b64bac2 configs: Add QEMU aarch64 config for testing 2025-08-28 21:47:24 -05:00
Dustin fbf22908eb board/rpi3: Enable UART console
U-Boot will not boot without the primary UART console enabled; the Pi
just hangs at the rainbow splash screen.  There are three ways to enable
a UART console, but disabling Bluetooth is usually the best, as the
others have performance implications.  Applications that need Bluetooth
will have to choose one of the other options, depending on their
specific requirements.
2025-08-20 06:57:20 -05:00
Dustin c0f8beb49a board/rpi3: post-image: Create grubenv BEFORE image
We obviously have to create the `grubenv` file before running
`genimage`, or it will not be included in the image.
2025-08-19 08:59:09 -05:00
Dustin 4c947bde8a config: rpi: Enable host OpenSSL/GnuTLS for uboot
The default U-Boot configuration tries to build tools that depend on
OpenSSL _and_ GnuTLS.  We need to enable the corresponding buildroot
configuration options, or the build system will try to use the
system-wide headers and libraries.
2025-08-18 19:23:39 -05:00
Dustin 7f4d8d4e49 configs/rpi3: Bump kernel version to match upstream
We have to keep the kernel version in sync with Buildroot upstream, or
downloading will fail because they do not keep old checksum values.
2025-08-18 18:11:08 -05:00
Dustin 9dae022788 First working revision
At this point, we can generate an SD card image that is composed of an
EFI system partition, a SquashFS root partition (a), a blank root
partition (b), and a data partition.  On the EFI system partition are
the Raspberry Pi firmware and device trees, U-Boot and GRUB.  The
SquashFS filesystem contains the kernel and the whole filesystem tree.

A Raspberry Pi can successfully boot from an SD card containing this
image.  It's not quite usable yet, because there's no writable storage
available, or indeed any way to log in.
2025-08-17 16:01:40 -05:00
Dustin e267f82db1 Initial commit 2025-08-17 10:30:19 -05:00