I learned enough about scheme and guix to boot the install cd like a
live cd where you can eject it and keep using it in tmpfs

1. I modify the kernel parameters in grub to change gnu.load to
gnu_load so that guix gives a diagnostic guile repl after mounting the
cd rather than booting
2. In the repl I go something like:
(define dirs (map (lambda (dir) (string-append "/gnu/store/" dir))
(scandir "/real-root/gnu/store")))
To assign a list of all the store objects on the cd to dirs
then something like
(for-each (lambda (dir) (if (not (access? dir 0)) (symlink
(string-append "/real-root" dir) dir))) dirs)
to symlink everything in the cd's store into the initrd
3. Then I drop into bash with such like:
,bournish
cat /proc/cmdline
cd /gnu/store/gnu_loadpathcopiedfromkernelcmdline-system/profile
bin/bash
export PATH=$(pwd)/sbin:$(pwd)/bin

and now I can use all the installed binaries on the cd before the
system is booted, in bash. But there are no ptys or anything yet.
4. In bash I remove the install cd overlay and replace it with a tmpfs root:
umount /root
mount -t tmpfs -osize=$((here I calculate a high fraction of total
ram)) none /root
cd /real-root
ls
cp -va bin var tmp home /root # and any other dirs needed but not gnu
cp --one-file-system -va /rw-root/upper/. /root/.
mount --move /rw-root/upper/dev /root/dev
umount /rw-root
rm -rf /rw-root
mkdir -p /root/gnu/store
cd gnu/store
find -maxdepth 1 \! -type d; du --maxdepth=1 | sort -n | head 380
# here I make sure glibc is in the output and adjust head 380 if
needed. The kernel and modules for example don't need to be copied if
ram is tight.
cp -van $( {

Reply via email to