[PATCH 1/3] qi-fix-gta03-format-script-less-fragile-for-host-kernel.patch
Andy Green
andy at openmoko.com
Wed Nov 12 12:05:04 CET 2008
From: Christopher Hall <hsw at openmoko.com>
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 <hsw at openmoko.com>
---
6410-partition-sd.sh | 28 ++++++++++++++++++++++++++--
build | 3 ++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/6410-partition-sd.sh b/6410-partition-sd.sh
index a2b38ef..cb1cac0 100755
--- a/6410-partition-sd.sh
+++ b/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/build b/build
index c9c7788..87684bb 100755
--- a/build
+++ b/build
@@ -2,7 +2,8 @@
make clean && \
make CPU=s3c6410 && \
-make CPU=s3c2442
+make CPU=s3c2442 && \
+make CPU=s3c2410
# as root then...
#
More information about the openmoko-kernel
mailing list