diff --git a/meta/createimg b/meta/createimg index 1a01ce08..b6d47195 100755 --- a/meta/createimg +++ b/meta/createimg @@ -47,11 +47,16 @@ echo "Creating image: $IMG_FILE" cd $ROOT_PATH/$CD_PATH # All sizes are in sectors -MSDOSSTART=32768 -MSDOSSIZE=16384 -FFSSTART=$(($MSDOSSTART + $MSDOSSIZE)) +if [ "$ARCH" = arm64 ]; then + MSDOSSTART=32768 + MSDOSSIZE=16384 + FFSSTART=$(($MSDOSSTART + $MSDOSSIZE)) +fi +if [ "$ARCH" = amd64 ]; then + FFSSTART=0 +fi -# Size of cd/arm64, trim trailing white spaces by adding 0 +# Size of cd/{arm64,amd64}, trim trailing white spaces by adding 0 CD_SIZE=$(($(du -L -s . | cut -d . -f 1) + 0)) echo "CD size $CD_SIZE sectors" @@ -67,7 +72,9 @@ cd $ROOT_PATH rm $IMG_FILE doas umount ./img_ffs -doas umount ./img_msdos +if [ "$ARCH" = arm64 ]; then + doas umount ./img_msdos +fi doas vnconfig -u vnd0 # 1 sector = 512 bytes @@ -77,7 +84,12 @@ dd if=/dev/zero of=$IMG_FILE bs=512 count=$IMG_SIZE doas vnconfig vnd0 $IMG_FILE -echo "reinit\ne 0\nC\nn\n$MSDOSSTART\n$MSDOSSIZE\nf 0\ne 3\nA6\nn\n$FFSSTART\n*\nw\nq\n" | doas fdisk -e vnd0 >/dev/null +if [ "$ARCH" = arm64 ]; then + echo "reinit\ne 0\nC\nn\n$MSDOSSTART\n$MSDOSSIZE\nf 0\ne 3\nA6\nn\n$FFSSTART\n*\nw\nq\n" | doas fdisk -e vnd0 >/dev/null +fi +if [ "$ARCH" = amd64 ]; then + echo "y\n" | doas fdisk -i vnd0 >/dev/null +fi doas fdisk vnd0 echo "a a\n\n\n\nw\nq\n" | doas disklabel -E vnd0 >/dev/null @@ -85,21 +97,30 @@ doas disklabel vnd0 doas newfs -O 1 -m 0 -o space -i $FS_SIZE -c $CD_SIZE /dev/rvnd0a -doas newfs_msdos -L boot -c 1 -F 16 /dev/rvnd0i +if [ "$ARCH" = arm64 ]; then + doas newfs_msdos -L boot -c 1 -F 16 /dev/rvnd0i +fi mkdir ./img_ffs doas mount /dev/vnd0a ./img_ffs -mkdir ./img_msdos -doas mount -o-l /dev/vnd0i ./img_msdos +if [ "$ARCH" = arm64 ]; then + mkdir ./img_msdos + doas mount -o-l /dev/vnd0i ./img_msdos +fi doas cp -R -L -v $ROOT_PATH/$CD_PATH/* ./img_ffs/ if [ "$ARCH" = arm64 ]; then doas cp -R -v openbsd/$INSTALL_SETS_PATH/BOOT/* ./img_msdos + echo "$VOL_ID\n$SYS_ID\n$APP_ID\n$PUBLISH_ID\n$PREP_ID" > ./img_msdos/README.txt +fi +if [ "$ARCH" = amd64 ]; then + doas installboot -r ./img_ffs vnd0 /usr/mdec/biosboot /usr/mdec/boot fi -echo "$VOL_ID\n$SYS_ID\n$APP_ID\n$PUBLISH_ID\n$PREP_ID" > ./img_msdos/README.txt doas umount ./img_ffs -doas umount ./img_msdos +if [ "$ARCH" = arm64 ]; then + doas umount ./img_msdos +fi doas vnconfig -u vnd0