4 Commits

Author SHA1 Message Date
8e49163f6e ci: Update workspace volume PVC name
All checks were successful
Aimee OS/aimee-os/pipeline/head This commit looks good
Moving to using a single PVC for all Buildroot jobs.
2025-11-15 13:13:48 -06:00
91b584dfd2 utils: Add option to run root shell on console
Some checks reported errors
Aimee OS/aimee-os/pipeline/head Something is wrong with the build of this commit
Until I develop a captive portal-based mechanism for initially
configuring the WiFi on Raspberry Pi machines, the easiest way to do
initial provisioning is using the CLI via the serial console.  Since the
root account has no password, and I don't want to have to specify one in
downstream projects' configurations, I've added a configuration option
to enable automatically launching a root shell connected to the serial
console instead of a login prompt.  The security risks here are pretty
minimal, because someone would need phyiscal access to the device in
order to use this shell, in which case they could use any number of
other methods to get control of the system.
2025-11-15 13:05:37 -06:00
b2a0aab680 Include sleep command in initramfs
All checks were successful
Aimee OS/aimee-os/pipeline/head This commit looks good
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
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
7 changed files with 72 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ bin_install \
/bin/mount \
/bin/rm \
/bin/sh \
/bin/sleep \
/bin/sort \
/bin/tail \
/bin/umount \

2
ci/Jenkinsfile vendored
View File

@@ -13,7 +13,7 @@ pipeline {
yamlFile 'ci/podTemplate.yaml'
yamlMergeStrategy merge()
workspaceVolume persistentVolumeClaimWorkspaceVolume(
claimName: 'buildroot-aimeeos'
claimName: 'buildroot'
)
defaultContainer 'build'
}

View File

@@ -11,4 +11,4 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_TARGET_ROOTFS_TAR is not set
AIMEEOS=y
AIMEEOS_DEFAULT_ROOTFLAGS="systemd.mask=serial-getty@ttyAMA0 systemd.debug_shell systemd.default_debug_tty=ttyAMA0"
BR2_PACKAGE_AIMEE_OS_ROOT_SHELL=y

View File

@@ -67,6 +67,11 @@ $(BR2_EXTERNAL_AIMEEOS_PATH)/boot/grub2/gen-grub-cfg.sh $(LINUX_IMAGE_NAME)
endef
LINUX_TARGET_FINALIZE_HOOKS += AIMEEOS_GEN_GRUB_CFG
define AIMEEOS_TARGET_FINALIZE_HOOKS
echo uninitialized > $(TARGET_DIR)/etc/machine-id
endef
TARGET_FINALIZE_HOOKS += AIMEEOS_TARGET_FINALIZE_HOOKS
BR2_ROOTFS_POST_IMAGE_SCRIPT += $(BR2_EXTERNAL_AIMEEOS_PATH)/update/make-package.sh
endif

View File

@@ -8,3 +8,25 @@ config BR2_PACKAGE_AIMEE_OS_UTILS
select BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT
select BR2_PACKAGE_WGET
select BR2_TARGET_GRUB2_INSTALL_TOOLS
if BR2_PACKAGE_AIMEE_OS_UTILS
config AIMEE_OS_ROOT_SHELL
bool "Spawn a root shell on the serial console by default"
help
With this option enabled, the system will boot up normally, with
a root shell connected to the default serial console. This is
useful for initial provisioning and troubleshooting.
if AIMEE_OS_ROOT_SHELL
config AIMEE_OS_ROOT_SHELL_CONSOLE
string "Console name"
default ttyAMA0
help
Name of the console device where the root shell will be spawned.
Do not include the /dev prefix
endif
endif

View File

@@ -28,4 +28,20 @@ define AIMEE_OS_UTILS_INSTALL_INIT_SYSTEMD
$(TARGET_DIR)/usr/lib/systemd/network/90-default.network
endef
define AIMEE_OS_UTILS_ROOT_SHELL_INSTALL
$(INSTALL) -D -m u=rw,go=r \
$(AIMEE_OS_UTILS_PKGDIR)/root-shell@.service \
$(TARGET_DIR)/usr/lib/systemd/system/root-shell@.service
$(INSTALL) -d -m u=rwx,go=rx \
$(TARGET_DIR)/usr/lib/systemd/system-preset
printf 'enable root-shell@.service %s\n' \
$(AIMEE_OS_ROOT_SHELL_CONSOLE) \
> $(TARGET_DIR)/usr/lib/systemd/system-preset/50-root-shell.preset
endef
ifeq ($(AIMEE_OS_ROOT_SHELL),y)
AIMEE_OS_UTILS_INSTALL_INIT_SYSTEMD += $(AIMEE_OS_UTILS_ROOT_SHELL_INSTALL)
endif
$(eval $(generic-package))

View File

@@ -0,0 +1,26 @@
[Unit]
Description=root shell on %I
After=sshd.service
Conflicts=shutdown.target
Conflicts=getty@%i.service serial-getty@%i.service
[Service]
Type=idle
Environment=TERM=linux
ExecStart=/bin/sh
Restart=always
RestartSec=0
StandardInput=tty
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
KillSignal=SIGHUP
# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
[Install]
WantedBy=multi-user.target