summaryrefslogtreecommitdiff
path: root/meta/recipes-core/initrdscripts/files
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2012-07-03 16:21:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-09 16:58:17 +0100
commit8aac6ecc5194c734dfd3d677017ab3ea045b2339 (patch)
tree83c4c7a8083052aa5d6337e225e619804fe92c6d /meta/recipes-core/initrdscripts/files
parent4436639eed57d818992596d6f0f7b53d3bbd4800 (diff)
downloadopenembedded-core-8aac6ecc5194c734dfd3d677017ab3ea045b2339.tar.gz
openembedded-core-8aac6ecc5194c734dfd3d677017ab3ea045b2339.tar.bz2
openembedded-core-8aac6ecc5194c734dfd3d677017ab3ea045b2339.zip
init-install: Clean up partition alignment
The current partitioning scheme leaves a 1MB gap between all the generated partitions by adding a 1 to the end of the last partition to use as the start of the next. parted is smart enough to not overlap start and end positions of the same value. This avoids the 1 MB gaps. Rather than pad the disk with 1MB in the beginning and cut it off at the MB boundary on the end, we can use 0% and 100% to allow parted to do the required math and use as much of the disk as possible. Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'meta/recipes-core/initrdscripts/files')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 8d21dd1f58..0ac4949355 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -84,9 +84,9 @@ disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | s
swap_size=$((disk_size*swap_ratio/100))
rootfs_size=$((disk_size-boot_size-swap_size))
-rootfs_start=$((boot_size + 1))
+rootfs_start=$((boot_size))
rootfs_end=$((rootfs_start+rootfs_size))
-swap_start=$((rootfs_end+1))
+swap_start=$((rootfs_end))
# MMC devices are special in a couple of ways
# 1) they use a partition prefix character 'p'
@@ -113,13 +113,13 @@ echo "Creating new partition table on /dev/${device} ..."
parted /dev/${device} mklabel msdos
echo "Creating boot partition on $bootfs"
-parted /dev/${device} mkpart primary 1 $boot_size
+parted /dev/${device} mkpart primary 0% $boot_size
echo "Creating rootfs partition on $rootfs"
parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
echo "Creating swap partition on $swap"
-parted /dev/${device} mkpart primary $swap_start $disk_size
+parted /dev/${device} mkpart primary $swap_start 100%
parted /dev/${device} print