1#!/usr/bin/env bash 2set -e 3 4# 5# This script creates a bootable image and should at some point in the future 6# be replaced by the proper NetBSD infrastructure. 7# 8 9: ${ARCH=i386} 10: ${OBJ=../obj.${ARCH}} 11: ${TOOLCHAIN_TRIPLET=i586-elf32-minix-} 12: ${BUILDSH=build.sh} 13 14: ${SETS="minix-base"} 15: ${IMG=minix_x86.iso} 16: ${BUNDLE_SETS=1} 17 18if [ ! -f ${BUILDSH} ] 19then 20 echo "Please invoke me from the root source dir, where ${BUILDSH} is." 21 exit 1 22fi 23 24# set up disk creation environment 25. releasetools/image.defaults 26. releasetools/image.functions 27 28echo "Building work directory..." 29build_workdir "$SETS" 30 31echo "Adding extra files..." 32workdir_add_cd_files 33 34# add kernel 35workdir_add_kernel minix_default 36 37# add boot.cfg 38cat >${ROOT_DIR}/boot.cfg <<END_BOOT_CFG 39banner=Welcome to the MINIX 3 installation CD 40banner================================================================================ 41banner= 42menu=Regular MINIX 3:multiboot /boot/minix_default/kernel bootcd=1 cdproberoot=1 disable=inet 43menu=Regular MINIX 3 (with AHCI):multiboot /boot/minix_default/kernel bootcd=1 cdproberoot=1 disable=inet ahci=yes 44menu=Edit menu option:edit 45menu=Drop to boot prompt:prompt 46clear=1 47timeout=10 48default=1 49load=/boot/minix_default/mod01_ds 50load=/boot/minix_default/mod02_rs 51load=/boot/minix_default/mod03_pm 52load=/boot/minix_default/mod04_sched 53load=/boot/minix_default/mod05_vfs 54load=/boot/minix_default/mod06_memory 55load=/boot/minix_default/mod07_tty 56load=/boot/minix_default/mod08_mib 57load=/boot/minix_default/mod09_vm 58load=/boot/minix_default/mod10_pfs 59load=/boot/minix_default/mod11_mfs 60load=/boot/minix_default/mod12_init 61END_BOOT_CFG 62add_file_spec "boot.cfg" extra.cdfiles 63 64# set correct message of the day (log in and install tip) 65cp releasetools/release/cd/etc/issue ${ROOT_DIR}/etc/issue 66add_file_spec "etc/issue" extra.cdfiles 67 68echo "Bundling packages..." 69bundle_packages "$BUNDLE_PACKAGES" 70 71echo "Creating specification files..." 72create_input_spec 73create_protos 74 75# Clean image 76if [ -f ${IMG} ] # IMG might be a block device 77then 78 rm -f ${IMG} 79fi 80 81echo "Writing ISO..." 82${CROSS_TOOLS}/nbmakefs -t cd9660 -F ${WORK_DIR}/input -o "rockridge,bootimage=i386;${DESTDIR}/usr/mdec/bootxx_cd9660,label=MINIX" ${IMG} ${ROOT_DIR} 83 84echo "" 85echo "ISO image at `pwd`/${IMG}" 86echo "" 87echo "To boot this image on kvm using the bootloader:" 88echo "qemu-system-i386 --enable-kvm -cdrom `pwd`/${IMG}" 89echo "" 90echo "To boot this image on kvm:" 91echo "cd ${MODDIR} && qemu-system-i386 --enable-kvm -kernel kernel -append \"bootcd=1 cdproberoot=1 disable=inet\" -initrd \"${mods}\" -cdrom `pwd`/${IMG}" 92