system

the Chamesle handbook, init, live ISO and install helpers
git clone https://github.com/tortr-rs/system
Log | Files | Refs | README | LICENSE

commit 488a33afda42bcc8448253e0d54814dd454786f0
parent 0f27e84e629284464931b093bf07873435008f6e
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Sat, 14 Nov 2026 15:59:20 +0000

no installer: the ISO is a live system, the handbook has the install by hand

Diffstat:
Mhandbook/handbook.md | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
Miso/mkiso | 6+++++-
Miso/profile/limine.conf | 2+-
Miso/profile/overlay/etc/motd | 3++-
Diso/profile/overlay/usr/bin/chamesle-install | 76----------------------------------------------------------------------------
Miso/profile/packages | 2+-
6 files changed, 65 insertions(+), 92 deletions(-)

diff --git a/handbook/handbook.md b/handbook/handbook.md @@ -68,34 +68,78 @@ and `sha256` in `repo/sys-kernel/linux`. The firmware is `sys-kernel/linux-firmw ## 4. The ISO -The ISO is an installer: it boots a small live system, and `chamesle-install` puts that on a disk. It boots on BIOS -and UEFI machines with limine. +The ISO is a live system to install from, nothing more. There is no installer: Chamesle is put on a disk by hand +(chapter 5). It boots on BIOS and UEFI machines with limine, from a CD or a stick, and has mksh, vim, mag, +`chamesle-bootstrap`, the disk tools (sfdisk, mkfs.ext4, mkfs.fat) and this handbook in `/usr/share/doc/chamesle/`. iso/mkiso -r $HOME/src/mag/repo:/usr/pkgsrc What it does, in order: `chamesle-bootstrap` builds a root from `iso/profile/packages`, the files of -`iso/profile/overlay` are copied over it, `mkinitramfs` +`iso/profile/overlay`, the handbook, `mag` and `chamesle-bootstrap` are copied over it, `mkinitramfs` makes the initrd (a few static tools, the modules in `iso/profile/modules` with what they depend on, `iso/init`), the root becomes a zstd squashfs, and `xorriso` writes the ISO with limine's BIOS and UEFI boot images. `-R dir` uses a root you already have instead of building one (it is copied, not changed). At boot `init` looks for the medium that has `LiveOS/rootfs.sfs`, mounts it read-only, puts a tmpfs overlay over it, -and switches into the result. The medium and the squashfs stay mounted under `/run/live/`, which is where the -installer copies from. An installed system boots with `root=UUID=...` on the same initrd. - -`chamesle-install` asks for the disk, a host name and a root password, then makes a GPT with a 1M BIOS boot -partition, a 512M EFI partition (also `/boot`) and the rest as ext4, copies the system, writes fstab and -limine.conf and installs limine for both BIOS and UEFI. +and switches into the result. The medium and the squashfs stay mounted under `/run/live/`. Try an ISO without a machine: qemu-system-x86_64 -cpu max -m 1G -cdrom chamesle.iso -boot d qemu-system-x86_64 -cpu max -m 1G -bios /usr/share/qemu/edk2-x86_64-code.fd -cdrom chamesle.iso # uefi -mkiso needs `mksquashfs` (filesystems/squashfs), `xorriso` (sysutils/libisoburn), `zstd`, `bsdcpio` and `limine` on the -machine that builds. The ISO boots on BIOS and UEFI machines, from a CD and from a stick (dd it). `LIMINE` says where limine's files are (default /usr/share/limine). +mkiso needs `mksquashfs` (filesystems/squashfs), `xorriso` (sysutils/libisoburn), `zstd`, `bsdcpio`, `limine` and `mag` +on the machine that builds. `LIMINE` says where limine's files are (default /usr/share/limine), `MAG` where mag is. + +## 5. Installing by hand + +Boot the ISO, log in as root, bring the network up (`dhcpcd`) and do this. `sda` is the disk, change it. + +1. Partition: a GPT with a 1M BIOS boot partition, a 512M EFI partition and the rest for `/`. + + sfdisk /dev/sda <<P + label: gpt + size=1M, type=21686148-6449-6E6F-744E-656564454649 + size=512M, type=U + type=L + P + mkfs.fat -F32 /dev/sda2 + mkfs.ext4 /dev/sda3 + +2. Mount them. The EFI partition is `/boot`. + + mount /dev/sda3 /mnt + mkdir /mnt/boot + mount /dev/sda2 /mnt/boot + +3. Get a pkgsrc tree and mag's own recipes somewhere on the live system and point mag at them, + `export MAG_REPO=/path/to/repo:/path/to/pkgsrc`. + +4. Make the root: `chamesle-bootstrap -n yourhostname /mnt`. It builds the base set from source, kernel included, + and takes a while. Add what you want after that with `MAG_ROOT=/mnt mag install ...`. + +5. Set the password, fstab and the boot entry by hand. `blkid` gives the UUIDs. + + echo 'root:x:0:0:root:/root:/usr/bin/mksh' > /mnt/etc/passwd # then put a hash in the second field + vim /mnt/etc/fstab + cp /mnt/usr/share/limine/BOOTX64.EFI /mnt/boot/EFI/BOOT/ + vim /mnt/boot/limine.conf + + limine.conf: + + timeout: 3 + /Chamesle + protocol: linux + path: boot():/vmlinuz-6.18.63-0-lts + cmdline: root=UUID=THE-ROOT-UUID rw + +6. Install limine for BIOS and unmount: `limine bios-install /dev/sda`, `umount -R /mnt`, reboot. + +An initramfs is not needed: the Alpine kernel has the common storage and ext4 drivers as modules, so for a root on +anything but a plain disk, build your own and put it in limine.conf as `module_path`. (This chapter has not been run +start to finish on real hardware yet.) -## 5. Files +## 6. Files /etc/profile PATH, EDITOR=vim /etc/ksh.kshrc prompt and aliases of every ksh diff --git a/iso/mkiso b/iso/mkiso @@ -1,5 +1,5 @@ #!/bin/sh -# mkiso: builds the Chamesle installer ISO from a profile. +# mkiso: builds the Chamesle live ISO from a profile. # mkiso -r $HOME/src/mag/repo:/usr/pkgsrc # mkiso -R /srv/rootfs -o chamesle.iso set -e @@ -40,6 +40,10 @@ else fi tar -C "$profile/overlay" -cf - . | tar -C "$rootfs" -xf - +install -Dm755 "$here/../tools/chamesle-bootstrap" "$rootfs/usr/bin/chamesle-bootstrap" +install -Dm644 "$here/../handbook/handbook.md" "$rootfs/usr/share/doc/chamesle/handbook.md" +[ -n "$MAG" ] || MAG=$(command -v mag) || die "no mag: put it in PATH or set MAG" +install -Dm755 "$MAG" "$rootfs/usr/bin/mag" vmlinuz=$(ls "$rootfs"/boot/vmlinuz-* | head -n 1) kver=$(ls "$rootfs/lib/modules" | head -n 1) [ -f "$vmlinuz" ] && [ -n "$kver" ] || die "no kernel in the root: boot/vmlinuz-* and lib/modules/* are missing" diff --git a/iso/profile/limine.conf b/iso/profile/limine.conf @@ -1,6 +1,6 @@ timeout: 3 -/Chamesle installer +/Chamesle live protocol: linux path: boot():/boot/vmlinuz module_path: boot():/boot/initrd diff --git a/iso/profile/overlay/etc/motd b/iso/profile/overlay/etc/motd @@ -1,3 +1,4 @@ - Chamesle. run chamesle-install to put it on a disk. + Chamesle live system. The handbook is in /usr/share/doc/chamesle/handbook.md + (chapter 5 is the install). vim and mksh are here. diff --git a/iso/profile/overlay/usr/bin/chamesle-install b/iso/profile/overlay/usr/bin/chamesle-install @@ -1,76 +0,0 @@ -#!/bin/sh -# chamesle-install: partitions a disk, copies the system on it, sets up limine. -set -e -live=/run/live/rootfs -die() { echo "chamesle-install: $*" >&2; exit 1; } -[ "$(id -u)" = 0 ] || die "run it as root" -[ -d $live ] || die "this is not the live system" - -echo "disks:" -lsblk -dno NAME,SIZE,MODEL | grep -v '^\(loop\|sr\|ram\)' -printf 'install on which disk (name, like sda or nvme0n1)? ' -read -r d -disk=/dev/$d -[ -b "$disk" ] || die "$disk is not a disk" -printf 'host name [chamesle]: ' -read -r name -name=${name:-chamesle} -printf 'root password: ' -stty -echo 2>/dev/null; read -r pw; stty echo 2>/dev/null; echo -[ -n "$pw" ] || die "empty password" -printf 'everything on %s will be erased. type yes to go on: ' "$disk" -read -r ok -[ "$ok" = yes ] || die "stopped" - -case $disk in *[0-9]) p=${disk}p;; *) p=$disk;; esac -sfdisk -q "$disk" <<P -label: gpt -size=1M, type=21686148-6449-6E6F-744E-656564454649 -size=512M, type=U -type=L -P -sleep 1 -mkfs.fat -F32 -n CHAMESLE "${p}2" >/dev/null -mkfs.ext4 -q -F -L chamesle "${p}3" - -t=/mnt/target -mkdir -p $t -mount "${p}3" $t -mkdir -p $t/boot -mount "${p}2" $t/boot -echo "copying the system..." -tar -C $live -cf - . | tar -C $t -xf - -mkdir -p $t/proc $t/sys $t/dev $t/run $t/tmp -chmod 1777 $t/tmp - -root_uuid=$(blkid -s UUID -o value "${p}3") -esp_uuid=$(blkid -s UUID -o value "${p}2") -echo "$name" > $t/etc/hostname -cat > $t/etc/fstab <<P -UUID=$root_uuid / ext4 defaults 0 1 -UUID=$esp_uuid /boot vfat defaults 0 2 -proc /proc proc defaults 0 0 -sysfs /sys sysfs defaults 0 0 -tmpfs /tmp tmpfs mode=1777 0 0 -P -hash=$(openssl passwd -1 "$pw") -sed -i "s|^root:[^:]*:|root:$hash:|" $t/etc/passwd -rm -f $t/etc/motd - -cp /run/live/medium/boot/vmlinuz $t/boot/vmlinuz -cp /run/live/medium/boot/initrd $t/boot/initrd -mkdir -p $t/boot/EFI/BOOT -cp /run/live/medium/EFI/BOOT/BOOTX64.EFI $t/boot/EFI/BOOT/ -cp /run/live/medium/boot/limine/limine-bios.sys $t/boot/ -cat > $t/boot/limine.conf <<P -timeout: 3 - -/Chamesle - protocol: linux - path: boot():/vmlinuz - module_path: boot():/initrd - cmdline: root=UUID=$root_uuid rw quiet -P -limine bios-install "$disk" >/dev/null -umount $t/boot $t -echo "done. take out the installer and reboot." diff --git a/iso/profile/packages b/iso/profile/packages @@ -1,4 +1,4 @@ -# what goes into the installer image +# what goes into the live image sys-libs/musl devel/gmake archivers/libarchive