commit 82705162ff0ae747196d4182a499e2b3a80542dc
parent c85b8c65decc3bd0325242b93c8e91553e7155f0
Author: torter <koubbamohamedrayan@gmail.com>
Date: Sat, 14 Nov 2026 15:23:52 +0000
iso: mksh and pkgsrc's squashfs and cdrtools as the tools; flags per mkisofs, uefi and stick boot need xorriso
Diffstat:
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/handbook/handbook.md b/handbook/handbook.md
@@ -13,7 +13,7 @@ and the package manager is `mag`.
| rifle | the coreutils, one C file |
| mag | the package manager, reads pkgsrc packages as they are |
| dinit | init and service manager |
-| oksh | the login shell (the OpenBSD ksh), `/bin/sh` is dash |
+| mksh | the shell: login shell and `/bin/sh` (the MirBSD Korn shell) |
| vim | the editor, installed on the ISO |
| limine | the boot loader |
@@ -27,7 +27,7 @@ and the package manager is `mag`.
Building everything from source takes a while (LLVM is the long one). Packages are not built twice: the sources
are kept in `var/cache/mag` inside the target.
-`-s "shells/oksh editors/vim"` installs your own list, `-n name` sets the host name, `-k kernel.tar.xz` unpacks a
+`-s "shells/mksh editors/vim"` installs your own list, `-n name` sets the host name, `-k kernel.tar.xz` unpacks a
kernel from chapter 3 into the target.
## 2. mag
@@ -98,7 +98,7 @@ and UEFI machines with limine.
What it does, in order: `chamesle-bootstrap` builds a root from `iso/profile/packages`, the files of
`iso/profile/overlay` are copied over it, the kernel tarball from chapter 3 is unpacked into 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.
+the root becomes a zstd squashfs, and `mkisofs` 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,
@@ -114,8 +114,10 @@ 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`, `xorriso` (or any mkisofs: set `MKISOFS`), `zstd`, `bsdcpio` and `limine` on the machine
-that builds. `LIMINE` says where limine's files are (default /usr/share/limine).
+mkiso needs `mksquashfs` (filesystems/squashfs), `mkisofs` (sysutils/cdrtools, `MKISOFS` says which one), `zstd`,
+`bsdcpio` and `limine` on the machine that builds. cdrtools' mkisofs makes an ISO that boots on BIOS machines and virtual machines from a CD. Limine's UEFI boot needs the
+EFI image as a GPT partition inside the ISO, which only xorriso can write: for an ISO that boots on UEFI and from a stick,
+build with `MKISOFS="xorriso -as mkisofs"`. `LIMINE` says where limine's files are (default /usr/share/limine).
## 5. Files
diff --git a/iso/mkiso b/iso/mkiso
@@ -19,12 +19,12 @@ while getopts p:r:k:R:w:o: o; do
esac
done
export MAG_REPO
-: "${MKISOFS:=xorriso -as mkisofs}"
+: "${MKISOFS:=mkisofs}"
: "${LIMINE:=/usr/share/limine}"
die() { echo "mkiso: $*" >&2; exit 1; }
[ -n "$kernel" ] || die "no kernel: build one with kernel/build.sh and give it with -k"
[ -d "$LIMINE" ] && [ -f "$LIMINE/limine-bios-cd.bin" ] || die "no limine files in $LIMINE (set LIMINE)"
-for t in mksquashfs xorriso zstd bsdcpio limine; do command -v $t >/dev/null || die "$t is not installed"; done
+for t in mksquashfs ${MKISOFS%% *} zstd bsdcpio limine; do command -v $t >/dev/null || die "$t is not installed"; done
iso=$work/iso
mkdir -p "$work"
@@ -57,9 +57,13 @@ cp "$LIMINE"/limine-bios.sys "$LIMINE"/limine-bios-cd.bin "$LIMINE"/limine-uefi-
cp "$LIMINE"/BOOTX64.EFI "$iso/EFI/BOOT/"
cp "$profile/limine.conf" "$iso/boot/limine/limine.conf"
+case $MKISOFS in
+xorriso*) efi="--efi-boot boot/limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label" ;;
+*) efi="-eltorito-alt-boot -eltorito-platform efi -b boot/limine/limine-uefi-cd.bin -no-emul-boot"
+ echo "mkiso: $MKISOFS cannot make the uefi image a partition, so this ISO boots on bios only; use MKISOFS=\"xorriso -as mkisofs\" for uefi" >&2 ;;
+esac
$MKISOFS -R -r -J -V CHAMESLE \
-b boot/limine/limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table \
- --efi-boot boot/limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label \
- -o "$out" "$iso" 2>/dev/null
-limine bios-install "$out" >/dev/null
+ $efi -o "$out" "$iso" >/dev/null 2>&1 || { echo "mkiso: $MKISOFS failed" >&2; exit 1; }
+limine bios-install "$out" >/dev/null 2>&1 || echo "mkiso: no hybrid boot sector: the ISO boots from a CD or a virtual machine, not from a stick" >&2
echo "$out: $(du -h "$out" | cut -f1)"
diff --git a/iso/profile/packages b/iso/profile/packages
@@ -3,8 +3,7 @@ sys-libs/musl
dev-build/gmake
app-arch/libarchive
app-arch/pigz
-app-shells/dash
-app-shells/oksh
+shells/mksh
sys-apps/dinit
sys-apps/util-linux
sys-apps/kmod
diff --git a/tools/chamesle-bootstrap b/tools/chamesle-bootstrap
@@ -2,7 +2,7 @@
# chamesle-bootstrap TARGET: makes a root file system in TARGET, like debootstrap does for Debian.
# the directories, the files in /etc, then every package of the base set built and installed there with mag.
# chamesle-bootstrap /mnt/root
-# chamesle-bootstrap -r ~/repos/ports -s "shells/oksh editors/vim" /srv/chroot
+# chamesle-bootstrap -r ~/repos/ports -s "shells/mksh editors/vim" /srv/chroot
set -e
usage() {
echo "usage: chamesle-bootstrap [-r REPOS] [-s PACKAGES] [-n HOSTNAME] [-k KERNEL.tar.xz] TARGET" >&2
@@ -12,7 +12,7 @@ usage() {
echo " -k a kernel tarball made by kernel/build.sh, unpacked into TARGET" >&2
exit 2
}
-base="sys-libs/musl dev-build/gmake app-arch/libarchive app-arch/pigz app-shells/dash app-shells/oksh sys-apps/dinit sys-apps/util-linux sys-apps/kmod sys-apps/eudev net-misc/dhcpcd net-misc/curl sys-fs/e2fsprogs sys-fs/dosfstools sys-boot/limine editors/vim"
+base="sys-libs/musl dev-build/gmake app-arch/libarchive app-arch/pigz shells/mksh sys-apps/dinit sys-apps/util-linux sys-apps/kmod sys-apps/eudev net-misc/dhcpcd net-misc/curl sys-fs/e2fsprogs sys-fs/dosfstools sys-boot/limine editors/vim"
name=chamesle
while getopts r:s:n:k: o; do
case $o in
@@ -37,10 +37,10 @@ done
chmod 1777 tmp var/tmp
chmod 700 root
[ -e etc/passwd ] || cat > etc/passwd <<P
-root:x:0:0:root:/root:/usr/bin/oksh
+root:x:0:0:root:/root:/usr/bin/mksh
P
[ -e etc/group ] || printf 'root:x:0:\nwheel:x:10:\nusers:x:100:\n' > etc/group
-[ -e etc/shells ] || printf '/bin/sh\n/usr/bin/oksh\n/usr/bin/dash\n' > etc/shells
+[ -e etc/shells ] || printf '/bin/sh\n/usr/bin/mksh\n/usr/bin/ksh\n' > etc/shells
[ -e etc/hostname ] || echo "$name" > etc/hostname
[ -e etc/fstab ] || printf '# device mount type options dump pass\nproc /proc proc defaults 0 0\nsysfs /sys sysfs defaults 0 0\ntmpfs /tmp tmpfs mode=1777 0 0\n' > etc/fstab
[ -e etc/profile ] || cat > etc/profile <<'P'
@@ -49,15 +49,10 @@ export EDITOR=vim
export PAGER=less
umask 022
P
-[ -e etc/ksh.kshrc ] || cat > etc/ksh.kshrc <<'P'
-PS1='\u@\h:\w\$ '
-alias ls='ls -F'
-P
[ -e etc/os-release ] || printf 'NAME=Chamesle\nID=chamesle\nPRETTY_NAME="Chamesle"\n' > etc/os-release
export MAG_ROOT=$PWD MAG_PREFIX=/usr MAG_REPO
echo "installing: $base"
mag install $base
-ln -sf dash usr/bin/sh 2>/dev/null || true
[ -e bin/sh ] || ln -s ../usr/bin/sh bin/sh 2>/dev/null || true
if [ -n "$kernel" ]; then
echo "kernel: $kernel"