
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: (use-modules (ice-9 ftw)) (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 $( { Oops hit send from pseudopalsy
cp -va $( { find -max depth 1 \! -type d; du --max-depth=1 | sort -n | | head 380 | cut -f2-; } | sort ) /root/gnu/store # the final sort abovr makes the copy very fast by ordering the files the same as they are held on the iso mkdir /root/mnt/cdrom mount /dev/sr0 /root/mnt/chrome cd /root/gnu/store ln -s ../../mnt/cdrom/gnu/store/* # symlink anything left, ignore errors cd /gnu/store ln -sf /root/gnu/store/* . # replace symlinks made in scheme with ones to tmpfs, ignore errors
whew ... then I guess I leave bash because it's running off the cd, then go back in off the tmpfs. As well as mounting proc and sys within /root . Then you can continue the boot in scheme with something like (starting in bournish) ,L scheme (........
The interesting stuff for somebody new to this like me is the scheme stuff. Let's see if I can parrot that more. Also. I left off (use-modules (ice-9 ftw)) at the start to use scandir from the file tree walking module (define to-load (find-long-option "gnu_load" (linux-command-line))) to-load (chroot /root) (primitive-load to-load) this boots the system. It might have been load-primitive not sure. The functions are all taken from the scheme primer and source files I found on the cd in bash. Haven't engaged the api references much yet. So that's cool! That was my hello world for guile scheme. It's cool that guile includes all the syscalls but they don't always generally have the same names as in c