1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-22 22:00:36 +02:00

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 <hsw@openmoko.com>
This commit is contained in:
Christopher Hall 2008-11-28 10:16:44 +00:00 committed by Andy Green
parent 16c6bb1660
commit aa813c24d5
2 changed files with 28 additions and 3 deletions

View File

@ -50,16 +50,40 @@ if [ ! -z "`grep $1 /proc/mounts`" ] ; then
exit 2 exit 2
fi 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 if [ $SECTORS -le 0 ] ; then
echo "problem finding size for /dev/$1" echo "problem finding size for /dev/$1"
exit 3 exit 3
fi fi
echo "$1 is $SECTORS 512-byte blocks"
if [ -z "$4" ] ; then if [ -z "$4" ] ; then
echo "$1 is $SECTORS 512-byte blocks"
FATSECTORS=$(( $SECTORS - $EXT3_TOTAL_SECTORS + $REARSECTORS )) FATSECTORS=$(( $SECTORS - $EXT3_TOTAL_SECTORS + $REARSECTORS ))
FATMB=$(( $FATSECTORS / 2048 - 16 )) FATMB=$(( $FATSECTORS / 2048 - 16 ))

View File

@ -2,7 +2,8 @@
make clean && \ make clean && \
make CPU=s3c6410 && \ make CPU=s3c6410 && \
make CPU=s3c2442 make CPU=s3c2442 && \
make CPU=s3c2410
# as root then... # as root then...
# #