#!/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. # # # Source settings if present # : ${SETTINGS_MINIX=.settings} if [ -f "${SETTINGS_MINIX}" ] then echo "Sourcing settings from ${SETTINGS_MINIX}" # Display the content (so we can check in the build logs # what the settings contain. cat ${SETTINGS_MINIX} | sed "s,^,CONTENT ,g" . ${SETTINGS_MINIX} fi : ${ARCH=evbearm-el} : ${OBJ=../obj.${ARCH}} : ${TOOLCHAIN_TRIPLET=arm-elf32-minix-} : ${BUILDSH=build.sh} : ${SETS="minix-base minix-comp minix-games minix-man minix-tests tests"} : ${IMG=minix_arm_sd.img} # ARM definitions: : ${BUILDVARS=-V MKGCCCMDS=yes -V MKLLVM=no} # These BUILDVARS are for building with LLVM: #: ${BUILDVARS=-V MKLIBCXX=no -V MKKYUA=no -V MKATF=no -V MKLLVMCMDS=no} : ${FAT_SIZE=$(( 10*(2**20) / 512))} # This is in sectors # Beagleboard-xm : ${U_BOOT_BIN_DIR=build/omap3_beagle/} : ${CONSOLE=tty02} # BeagleBone (and black) #: ${U_BOOT_BIN_DIR=build/am335x_evm/} #: ${CONSOLE=tty00} # # We host u-boot binaries. # : ${MLO=MLO} : ${UBOOT=u-boot.img} U_BOOT_GIT_VERSION=cb5178f12787c690cb1c888d88733137e5a47b15 if [ ! -f ${BUILDSH} ] then echo "Please invoke me from the root source dir, where ${BUILDSH} is." exit 1 fi if [ -n "$BASE_URL" ] then #we no longer download u-boot but do a checkout #BASE_URL used to be the base url for u-boot #Downloads echo "Warning:** Setting BASE_URL (u-boot) is no longer possible use U_BOOT_BIN_DIR" echo "Look in ${RELEASETOOLSDIR}/arm_sdimage.sh for suggested values" exit 1 fi export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:${PATH} # we create a disk image of about 2 gig's # for alignment reasons, prefer sizes which are multiples of 4096 bytes : ${IMG_SIZE=$(( 2*(2**30) ))} : ${ROOT_SIZE=$(( 64*(2**20) ))} : ${HOME_SIZE=$(( 128*(2**20) ))} : ${USR_SIZE=$(( 1792*(2**20) ))} # set up disk creation environment . releasetools/image.defaults . releasetools/image.functions # all sizes are written in 512 byte blocks ROOTSIZEARG="-b $((${ROOT_SIZE} / 512 / 8))" USRSIZEARG="-b $((${USR_SIZE} / 512 / 8))" HOMESIZEARG="-b $((${HOME_SIZE} / 512 / 8))" # where the kernel & boot modules will be MODDIR=${DESTDIR}/boot/minix/.temp echo "Building work directory..." build_workdir "$SETS" echo "Adding extra files..." # create a fstab entry in /etc cat >${ROOT_DIR}/etc/fstab < ${WORK_DIR}/uEnv.txt ${RELEASETOOLSDIR}/gen_uEnv.txt.sh -c ${CONSOLE} > ${ROOT_DIR}/uEnv.txt # Do some last processing of the kernel and servers and then put them on the FAT # partition. ${CROSS_PREFIX}objcopy ${OBJ}/minix/kernel/kernel -O binary ${ROOT_DIR}/kernel.bin for f in servers/vm/vm servers/rs/rs servers/pm/pm servers/sched/sched \ servers/vfs/vfs servers/ds/ds servers/mib/mib fs/pfs/pfs fs/mfs/mfs \ ../sbin/init/init drivers/tty/tty/tty drivers/storage/memory/memory do fn=`basename $f`.elf cp ${OBJ}/minix/${f} ${ROOT_DIR}/${fn} ${CROSS_PREFIX}strip -s ${ROOT_DIR}/${fn} done cat >${WORK_DIR}/boot.mtree <