minix/releasetools/x86_cdimage.sh
Jean-Baptiste Boric 69eead77ff New image framework generation
The CD now boots directly from the ISO 9660 filesystem instead of using
MBR partitioning with Minix file systems. This saves some space on the
CD and reduces memory requirements by some unknown amount as the root
ramdisk is completely eliminated.

The x86 hard drive image creation is also rewritten in the same
fashion.

The setup is modified to be more NetBSD-like (unpacking sets
tarballs instead of blindly copying the CD contents). Splitting MINIX
into sets is done in another commit due to it being a nightmare to
rebase.

Since MINIX lacks union mounts for now, a bunch of ramdisks are
generated at run-time to make parts of the filesystem writeable for the
CD. This solution isn't ideal, but it's enough for an installation CD.

Change-Id: Icbd9cca4dafebf7b42c345b107a17679a622d5cd
2015-10-10 19:09:35 +02:00

96 lines
2.7 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
#
# This script creates a bootable image and should at some point in the future
# be replaced by the proper NetBSD infrastructure.
#
: ${ARCH=i386}
: ${OBJ=../obj.${ARCH}}
: ${TOOLCHAIN_TRIPLET=i586-elf32-minix-}
: ${BUILDSH=build.sh}
: ${SETS="minix tests"}
: ${IMG=minix_x86.iso}
if [ ! -f ${BUILDSH} ]
then
echo "Please invoke me from the root source dir, where ${BUILDSH} is."
exit 1
fi
# set up disk creation environment
. releasetools/image.defaults
. releasetools/image.functions
# where the kernel & boot modules will be
MODDIR=${DESTDIR}/boot/minix/.temp
echo "Building work directory..."
build_workdir "$SETS"
echo "Adding extra files..."
workdir_add_sets
workdir_add_cdfiles
# create a fstab entry in /etc
cat >${ROOT_DIR}/etc/fstab <<END_FSTAB
none /sys devman rw,rslabel=devman 0 0
none /dev/pts ptyfs rw,rslabel=ptyfs 0 0
END_FSTAB
add_file_spec "etc/fstab" extra.fstab
# workdir_add_kernel minix_default
# add boot.cfg
cat >${ROOT_DIR}/boot.cfg <<END_BOOT_CFG
banner=Welcome to the MINIX 3 installation CD
banner================================================================================
banner=
menu=Regular MINIX 3:multiboot /boot/minix/.temp/kernel bootcd=1 cdproberoot=1 disable=inet
menu=Regular MINIX 3 (with AHCI):multiboot /boot/minix/.temp/kernel bootcd=1 cdproberoot=1 disable=inet ahci=yes
menu=Edit menu option:edit
menu=Drop to boot prompt:prompt
clear=1
timeout=10
default=1
load=/boot/minix/.temp/mod01_ds
load=/boot/minix/.temp/mod02_rs
load=/boot/minix/.temp/mod03_pm
load=/boot/minix/.temp/mod04_sched
load=/boot/minix/.temp/mod05_vfs
load=/boot/minix/.temp/mod06_memory
load=/boot/minix/.temp/mod07_tty
load=/boot/minix/.temp/mod08_mfs
load=/boot/minix/.temp/mod09_vm
load=/boot/minix/.temp/mod10_pfs
load=/boot/minix/.temp/mod11_init
END_BOOT_CFG
add_file_spec "boot.cfg" extra.cdfiles
# add README.TXT
cp releasetools/release/cd/README.TXT ${ROOT_DIR}/README.TXT
add_file_spec "README.TXT" extra.cdfiles
# set correct message of the day (log in and install tip)
cp releasetools/release/cd/etc/issue ${ROOT_DIR}/etc/issue
add_file_spec "etc/issue" extra.cdfiles
echo "Bundling packages..."
bundle_packages "$BUNDLE_PACKAGES"
echo "Creating specification files..."
create_input_spec
create_protos
echo "Writing ISO..."
${CROSS_TOOLS}/nbmakefs -t cd9660 -F ${WORK_DIR}/input -o "rockridge,bootimage=i386;${DESTDIR}/usr/mdec/bootxx_cd9660,label=MINIX" ${IMG} ${ROOT_DIR}
#mods=$(cd ${MODDIR}; echo mod* | tr ' ' ',')
echo "ISO image at `pwd`/${IMG}"
echo "To boot this image on kvm:"
#echo "cd ${MODDIR} && qemu-system-i386 --enable-kvm -kernel kernel -append \"bootcd=1 cdproberoot=1 disable=inet\" -initrd \"${mods}\" -cdrom `pwd`/${IMG}"
echo "qemu-system-i386 --enable-kvm -cdrom `pwd`/${IMG}"