diff options
author | 2011-06-04 18:01:12 +0100 | |
---|---|---|
committer | 2011-06-04 18:01:12 +0100 | |
commit | 4d2593cdefcdc24edd46d2e28a8dd4d38769501d (patch) | |
tree | 53a05e4d45f7d4ca8f379c64612838b1ed5ca502 /create_image.sh | |
parent | Adding fstab and renaming bootloader config (diff) | |
download | gentoaster-4d2593cdefcdc24edd46d2e28a8dd4d38769501d.tar.gz gentoaster-4d2593cdefcdc24edd46d2e28a8dd4d38769501d.tar.bz2 gentoaster-4d2593cdefcdc24edd46d2e28a8dd4d38769501d.zip |
Fixed offset but now mounting fails
Diffstat (limited to 'create_image.sh')
-rwxr-xr-x | create_image.sh | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/create_image.sh b/create_image.sh index e403df9..61ab9e7 100755 --- a/create_image.sh +++ b/create_image.sh @@ -4,7 +4,7 @@ IMAGE_BASENAME="${1}" IMAGE_NAME="${IMAGE_BASENAME}.image" IMAGE_OUT="${IMAGE_BASENAME}.vdi" BOOT_MEGABYTES=64 -SWAP_MEGABYTES=512 +SWAP_MEGABYTES=128 IMAGE_MEGABYTES="${2}" IMAGE_BYTES=$(( ${IMAGE_MEGABYTES} * 1024 * 1024 )) TIMEZONE="Europe/London" @@ -33,7 +33,7 @@ umount -d rootfs/dev &>> ${LOG_FILE} umount -d rootfs/proc &>> ${LOG_FILE} umount -d rootfs/boot &>> ${LOG_FILE} umount -d rootfs &>> ${LOG_FILE} -#losetup -d ${LOOP_DEV_ROOT} +losetup -d ${LOOP_DEV_ROOT} } cleanup_mounts @@ -43,10 +43,10 @@ echo -e "\x55\xaa" | dd bs=1 count=2 seek=510 of=${IMAGE_NAME} conv=notrunc &>> LOOP_DEV_IMAGE=`losetup -f` losetup ${LOOP_DEV_IMAGE} ${IMAGE_NAME} &>> ${LOG_FILE} -sfdisk ${LOOP_DEV_IMAGE} -uM &>> ${LOG_FILE} << EOF +sfdisk ${LOOP_DEV_IMAGE} -H64 -S32 &>> ${LOG_FILE} << EOF 1,${BOOT_MEGABYTES},83,* -,${SWAP_MEGABYTES},82,- -,,83,- +$(( 1+ ${BOOT_MEGABYTES} )),${SWAP_MEGABYTES},82,- +$(( 1+ ${BOOT_MEGABYTES} + ${SWAP_MEGABYTES} )),,83,- EOF sleep 2 losetup -d ${LOOP_DEV_IMAGE} @@ -55,19 +55,19 @@ losetup -d ${LOOP_DEV_IMAGE} echo "Creating filesystems" LOOP_DEV_BOOT=`losetup -f` -losetup -o 512 ${LOOP_DEV_BOOT} ${IMAGE_NAME} +losetup -o $(( 512 * 2048 )) ${LOOP_DEV_BOOT} ${IMAGE_NAME} mkfs -t ext2 ${LOOP_DEV_BOOT} &>> ${LOG_FILE} sleep 2 losetup -d ${LOOP_DEV_BOOT} LOOP_DEV_ROOT=`losetup -f` -losetup -o $(( 512 + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) + ( ${SWAP_MEGABYTES} * 1024 * 1024 ) )) ${LOOP_DEV_ROOT} ${IMAGE_NAME} +losetup -o $(( ( 512 * 2048 ) + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) + ( ${SWAP_MEGABYTES} * 1024 * 1024 ) )) ${LOOP_DEV_ROOT} ${IMAGE_NAME} mkfs -t ext3 ${LOOP_DEV_ROOT} &>> ${LOG_FILE} #sleep 2 #losetup -d ${LOOP_DEV_ROOT} LOOP_DEV_SWAP=`losetup -f` -losetup -o $(( 512 + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) )) ${LOOP_DEV_SWAP} ${IMAGE_NAME} +losetup -o $(( ( 512 * 2048 ) + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) )) ${LOOP_DEV_SWAP} ${IMAGE_NAME} mkswap ${LOOP_DEV_SWAP} &>> ${LOG_FILE} sleep 2 losetup -d ${LOOP_DEV_SWAP} @@ -76,10 +76,10 @@ echo "Mounting fileystems" echo "Mount root" mkdir -p rootfs -mount -o loop,offset=$(( 512 + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) + ( ${SWAP_MEGABYTES} * 1024 * 1024 ) )) ${IMAGE_NAME} rootfs +mount -o loop,offset=$(( ( 512 * 2048 ) + ( ${BOOT_MEGABYTES} * 1024 * 1024 ) + ( ${SWAP_MEGABYTES} * 1024 * 1024 ) )) ${IMAGE_NAME} rootfs echo "Mount boot" mkdir -p rootfs/boot -mount -o loop,offset=512 ${IMAGE_NAME} rootfs/boot +mount -o loop,offset=$(( 512 * 2048 )) ${IMAGE_NAME} rootfs/boot cd rootfs # Setup Gentoo |