#!/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-base minix-comp minix-games minix-man minix-tests tests"} : ${IMG=minix_x86.img} if [ ! -f ${BUILDSH} ] then echo "Please invoke me from the root source dir, where ${BUILDSH} is." exit 1 fi # we create a disk image of about 2 gig's # for alignment reasons, prefer sizes which are multiples of 4096 bytes : ${BOOTXX_SECS=32} : ${ROOT_SIZE=$(( 128*(2**20) - ${BOOTXX_SECS} * 512 ))} : ${HOME_SIZE=$(( 128*(2**20) ))} : ${USR_SIZE=$(( 1792*(2**20) ))} : ${EFI_SIZE=$(( 0 ))} # set up disk creation environment . releasetools/image.defaults . releasetools/image.functions echo "Building work directory..." build_workdir "$SETS" echo "Adding extra files..." workdir_add_hdd_files # add kernels add_link_spec "boot/minix_latest" "minix_default" extra.kernel workdir_add_kernel minix_default workdir_add_kernel minix/$RELEASE_VERSION # add boot.cfg cat >${ROOT_DIR}/boot.cfg <> ${IMG} # Write the partition table using the natively compiled # minix partition utility ${CROSS_TOOLS}/nbpartition -m ${IMG} ${BOOTXX_SECS} 81:${_ROOT_SIZE}* 81:${_USR_SIZE} 81:${_HOME_SIZE} EF:1+ else # Write the partition table using the natively compiled # minix partition utility ${CROSS_TOOLS}/nbpartition -m ${IMG} ${BOOTXX_SECS} 81:${_ROOT_SIZE}* 81:${_USR_SIZE} 81:${_HOME_SIZE} fi ${CROSS_TOOLS}/nbinstallboot -f -m ${ARCH} ${IMG} ${DESTDIR}/usr/mdec/bootxx_minixfs3 echo "" mods="`( cd ${MODDIR}; echo mod* | tr ' ' ',' )`" echo "Disk image at `pwd`/${IMG}" echo "" echo "To boot this image on kvm using the bootloader:" echo "qemu-system-i386 --enable-kvm -m 256 -hda `pwd`/${IMG}" echo "" echo "To boot this image on kvm:" echo "cd ${MODDIR} && qemu-system-i386 --enable-kvm -m 256M -kernel kernel -append \"rootdevname=c0d0p0\" -initrd \"${mods}\" -hda `pwd`/${IMG}"