From aa813c24d5266a6edbb433af48dc24bae2f405c6 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Fri, 28 Nov 2008 10:16:44 +0000 Subject: [PATCH] qi-fix-gta03-format-script-less-fragile-for-host-kernel.patch The hack to find the number of sectors turns out to be sensitive to the host kernel. This is a workaround until we find something in /proc or /sys that has the same info in a more accessible way. Signed-off-by: Christopher Hall --- qiboot/6410-partition-sd.sh | 28 ++++++++++++++++++++++++++-- qiboot/build | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/qiboot/6410-partition-sd.sh b/qiboot/6410-partition-sd.sh index a2b38ef..cb1cac0 100755 --- a/qiboot/6410-partition-sd.sh +++ b/qiboot/6410-partition-sd.sh @@ -50,16 +50,40 @@ if [ ! -z "`grep $1 /proc/mounts`" ] ; then exit 2 fi -SECTORS=`dmesg | grep $1 | grep "512-byte hardware" | tail -n 1 | cut -d' ' -f4` +# set CUT_COLUMN for each OS +case "$(lsb_release --short --description)" in + Ubuntu\ 7*) + CUT_COLUMN=5 + ;; + Ubuntu\ 8.04*) + CUT_COLUMN=5 + ;; + *) + CUT_COLUMN=4 + ;; +esac + +DMESG_LINE=$(dmesg | grep "$1" | grep "512-byte hardware" | tail -n 1) +SECTORS=$(echo "${DMESG_LINE}" | cut -d' ' -f"${CUT_COLUMN}") + +if ! echo "${SECTORS}" | grep '^[[:digit:]]\+$' +then + echo "problem finding size for /dev/$1 check CUT_COLUMN value for your os" + echo "CUT_COLUMN=${CUT_COLUMN} --> ${SECTORS}" + echo "dmesg line was:" + echo "${DMESG_LINE}" + exit 3 +fi if [ $SECTORS -le 0 ] ; then echo "problem finding size for /dev/$1" exit 3 fi +echo "$1 is $SECTORS 512-byte blocks" + if [ -z "$4" ] ; then - echo "$1 is $SECTORS 512-byte blocks" FATSECTORS=$(( $SECTORS - $EXT3_TOTAL_SECTORS + $REARSECTORS )) FATMB=$(( $FATSECTORS / 2048 - 16 )) diff --git a/qiboot/build b/qiboot/build index c9c7788..87684bb 100755 --- a/qiboot/build +++ b/qiboot/build @@ -2,7 +2,8 @@ make clean && \ make CPU=s3c6410 && \ -make CPU=s3c2442 +make CPU=s3c2442 && \ +make CPU=s3c2410 # as root then... #