[pkg-fso-commits] [SCM] Various non-packaged files branch, master, updated. 254f0256575b46c3b41855b4162b94f18a5a31da
Philip Hands
phil at hands.com
Tue Sep 15 23:37:46 UTC 2009
The following commit has been merged in the master branch:
commit 254f0256575b46c3b41855b4162b94f18a5a31da
Author: Philip Hands <phil at hands.com>
Date: Tue Sep 15 22:10:37 2009 +0100
calculate SD size from /sys/block info rather than using nasty fdisk grep-age
diff --git a/install.sh b/install.sh
index c11e7fc..e83d36f 100755
--- a/install.sh
+++ b/install.sh
@@ -55,6 +55,7 @@ QI=${QI:-false}
QI_VERBOSE_BOOT=${QI_VERBOSE_BOOT:-false}
ROOT_PASSWORD=${ROOT_PASSWORD:-changeme}
SD_DEVICE=${SD_DEVICE:-/dev/mmcblk0}
+SD_SYS_BLK=${SD_SYS_BLK:-/sys/block/${SD_DEVICE#/dev/}}
SD_PART1_FS=${SD_PART1_FS:-ext2}
SD_PART1_SIZE=${SD_PART1_SIZE:-8}
SD_PART2_FS=${SD_PART2_FS:-ext3}
@@ -269,6 +270,8 @@ ENVIRONMENT
HOSTNAME the name of the machine (set to '$HOSTNAME')
SD_DEVICE the character device to access the microSD card
(set to '$SD_DEVICE')
+ SD_SYS_BLK the directory under /sys/block that refers to the microSD card
+ (set to '$SD_SYS_BLK', or derived from the value of SD_DEVICE)
SD_PART1_FS the filesystem for the first microSD card partition,
i.e. the one containing the uImage.bin (set to
'$SD_PART1_FS', possible values are ext2/vfat)
@@ -674,7 +677,9 @@ action_partition () {
if [ -z "$SD_SWAP_SIZE" ]; then SD_SWAP_SIZE=0; fi
- mb=$(echo pq | fdisk ${SD_DEVICE} | grep -m1 Disk | cut -f 3 -d \ )
+ mb=$(( $(cat /sys/block/mmcblk0/size) * 8 / 15625 ))
+ # If one were willing to assume that cylinders are always 64 * 512, then we could calculate the
+ # next line thus: $(( $(cat /sys/block/mmcblk0/size) / 64 ))
cylinders=$(echo pq | fdisk ${SD_DEVICE} | grep cylinders|grep heads|cut -f 5 -d\ )
lastcylinder=$(($cylinders-($cylinders*$SD_SWAP_SIZE/$mb)))
--
Various non-packaged files
More information about the pkg-fso-commits
mailing list