From 0ce9aaa02ba7c5d3223a556d189bc8fe7069452c Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 23 Jan 2018 23:47:01 +0100 Subject: [PATCH] New partition layout --- adjust_image.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/adjust_image.sh b/adjust_image.sh index becddfc..c5f2f44 100755 --- a/adjust_image.sh +++ b/adjust_image.sh @@ -1,8 +1,7 @@ #!/bin/bash -e LOOP_DEV=7 -BOOT_SIZE=$((100*1024*1024)) -GAP_SIZE=$((200*1024*1024)) # Reserved space for future use +BOOT_SIZE=$((250*1024*1024)) ROOT_SIZE=$((1000*1024*1024)) USR_LOCAL_SIZE=$((2*1024*1024)) @@ -24,14 +23,14 @@ echo "image: ${image_file}" echo "adjusted image: ${new_image_file}" echo "*** Creating new image file and partitions ***" -dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1)) +dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1)) parted --script $new_image_file \ mklabel msdos \ mkpart primary fat32 512B ${BOOT_SIZE}B \ set 1 boot on \ - mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B \ - mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \ - mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100% + mkpart primary ext4 $((512+${BOOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}))B \ + mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \ + mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100% echo "*** Copying original partitons ***" oIFS="$IFS" @@ -45,8 +44,8 @@ for line in $(parted $image_file unit B print | grep primary); do echo $num - $start - $size seek=0 [ "$num" = "1" ] && seek=$start - [ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE})/512)) - [ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512)) + [ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE})/512)) + [ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512)) dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc done