#!/bin/sh # check root username=`whoami` if [ $username != root ] then echo "must be root" exit fi # check arguments if [ $# -lt 2 ] then echo "usage: $0 [u-boot] [output_image]" exit fi current_directory=$PWD uboot_file=$1 image_file=$2 # create empty disk image dd if=/dev/zero of=$image_file bs=1M count=48 # attach disk image vnconfig vnd0 $image_file # setup u-boot dd if=$uboot_file of=/dev/vnd0c bs=1024 seek=8 # create partitions, disklabel echo "edit 0\n e\n n\n 2048\n 32768\n edit 3\n a6\n n\n 34816\n 63488\n p\n w\n q\n" | fdisk -e vnd0 echo "a a\n\n\n\n p\n w\n q\n" | disklabel -E vnd0 newfs_msdos /dev/rvnd0i newfs /dev/rvnd0a # setup EFI loader mount_msdos -l /dev/vnd0i /mnt mkdir -p /mnt/efi/boot cd /mnt/efi/boot ftp http://ftp.jaist.ac.jp/pub/OpenBSD/snapshots/armv7/BOOTARM.EFI cd $current_directory umount /mnt # setup BSD kernel mount /dev/vnd0a /mnt cd /mnt #ftp http://ftp.jaist.ac.jp/pub/OpenBSD/snapshots/armv7/bsd ftp http://ftp.jaist.ac.jp/pub/OpenBSD/snapshots/armv7/bsd.rd cd $current_directory umount /mnt # detach disk image vnconfig -u vnd0