open-power / petitboot

GNU General Public License v2.0
212 stars 56 forks source link

persistant boot options on systems without ipmi #62

Open hanetzer opened 5 years ago

hanetzer commented 5 years ago

Unless I'm just dumb I don't think its possible to set autoboot options on systems which do not do ipmi. I currently have a buildroot-built 'skiroot' for aarch64 (rk3399-gru-kevin) which can boot gentoo on the emmc. However, I have to manually tell it to boot the entry each time I boot it. Boot overrides inside the 'System configuration' menu of petitboot-nc do not persist after reboots.

Using petitboot 1.10.3 and the following syslinux.cfg:

DEFAULT 5.0.9-gentoo

LABEL 5.0.9-gentoo
kernel /boot/vmlinuz-5.0.9-gentoo
append console=tty0 console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 init=/sbin/openrc-init root=/dev/mmcblk1p2 rootwait rw earlycon=uart8250,mmio32,0xff1a0000
initrd /boot/initramfs-5.0.9-gentoo.img
hanetzer commented 5 years ago

Ok a bit of research shows that on powerpc systems these params are stored in some form of nvram. No such memory exists on my system, and no platform-independent way of storing this sort of thing exists in mainline coreboot atm. So, I'm working on implementing a platform-uboot.c to use the userspace tools from uboot (fw_printenv and fw_setenv) to store these params, and shrink the cbfs in coreboot by a bit to store the params.

sammj commented 5 years ago

@hanetzer yep, on POWER boxes this is saved in NVRAM. fw_fooenv support would be great to have, if you have patches or questions feel free to post them on the mailing list! https://lists.ozlabs.org/listinfo/petitboot

hanetzer commented 5 years ago

@sammj ok, I've got a basic platform-uboot.c thrown together, sent it to the ml. Problem is, the petitboot parameters which contain a ?, such as autoboot?, need to be escaped otherwise the u-boot env gets corrupted. so instead of constructing a command like this; fw_setenv autoboot? true we would need fw_setenv autoboot\? true, and I'm not sure how I could achieve that based on the existing code.

sammj commented 5 years ago

How parameters are saved is implemented per-platform, so in your platform-uboot you could probably handle this by inserting escaping characters if needed in what you pass to fw_setenv etc.