From: <dha...@us...> - 2008-03-06 03:32:06
|
Revision: 1621 http://astlinux.svn.sourceforge.net/astlinux/?rev=1621&view=rev Author: dhartman Date: 2008-03-05 19:32:11 -0800 (Wed, 05 Mar 2008) Log Message: ----------- changes from Philip for makerunnix.sh Modified Paths: -------------- trunk/makerunnix.sh trunk/target/x86/runnix/runnix.mk Modified: trunk/makerunnix.sh =================================================================== --- trunk/makerunnix.sh 2008-03-06 01:38:50 UTC (rev 1620) +++ trunk/makerunnix.sh 2008-03-06 03:32:11 UTC (rev 1621) @@ -11,94 +11,70 @@ # editConf() { - sed -i -r \ - -e 's@ astkd=/dev/sda1@ astkd=/dev/hda3@' \ - -e 's@ astlive @ astlive noram @' \ - os/${ASTVER}.run.conf + # stuff here... + return 0 } -if [ ! $UID = 0 ] -then -echo "You need to be root to run this script (for now)" -exit 1 +if [ ! $UID = 0 ]; then + echo "You need to be root to run this script (for now)" >&2 + exit 1 fi -if [ ! $1 ] -then -echo "Usage: +if [ $# -gt 1 ]; then + if [ "$1" = "-s" ]; then + shift + DOSTRIP=1 + fi +fi +if [ $# -ne 1 ]; then + echo "Usage: + $0 [imagesize in megabytes] -" -exit 1 +" >&2 + exit 1 fi SIZE=$1 -if [ ! -f build_$ARCH/root/etc/rc ] -then -echo "It doesn't look like you have built AstLinux yet. +if [ ! -f build_$ARCH/root/etc/rc ]; then + echo "It doesn't look like you have built AstLinux yet. You need to run make first. For more help please visit http://www.astlinux.org -" -exit 1 +" >&2 + exit 1 fi if [ "$BR2_TARGET_RUNNIX" != "y" -o "$BR2_TARGET_SYSLINUX" != "y" \ - -o ! -d $RUNNIX_DIR -o ! -d $RUNFS_DIR ] -then -echo "This image wasn't built with RUNNIX and SYSLINUX enabled." -exit 1 + -o ! -d $RUNNIX_DIR -o ! -d $RUNFS_DIR ]; then + echo "This image wasn't built with RUNNIX and SYSLINUX enabled." >&2 + exit 1 fi -if [ -d /dev/loop ] -then -LOOPD=/dev/loop/ +if [ -d /dev/loop ]; then + LOOPD=/dev/loop/ else -LOOPD=/dev/loop + LOOPD=/dev/loop fi -clear +if [ -n "$DOSTRIP" ]; then + STRIP=build_$ARCH/staging_dir/bin/$ARCH-linux-strip -echo " + for i in lib usr/lib; do + find build_$ARCH/root/$i -name \*.la -o -name \*.a \ + | xargs --no-run-if-empty rm build_$ARCH/root/$i/ + done -This script will create a bootable AstLinux image from the -development environment in this directory. Every care has been -taken to prevent damage to your host operating system, house, etc. -HOWEVER, IT IS ALWAYS POSSIBLE FOR SOMETHING TO GO WRONG. I CAN -NOT GUARANTEE THAT THIS SCRIPT WILL NOT DESTROY YOUR MACHINE OR -ANY DATA ON IT + for i in bin sbin usr/bin usr/sbin lib usr/lib usr/lib/asterisk/modules; do + find build_$ARCH/root/$i -type f \ + | xargs --no-run-if-empty $STRIP -g build_$ARCH/root/$i/ + done -" - -echo "Press enter to continue, or CTRL+C to exit" - -read - -echo "Would you like me to aggresively strip everything in your image? -This can save as much as 10mb." - -echo "Please answer yes or no" -read -p "Strip: " RESPONSE - -if [ "$RESPONSE" = "yes" ] -then -STRIP=build_$ARCH/staging_dir/bin/$ARCH-linux-strip - -for i in lib usr/lib -do -find build_$ARCH/root/$i -name \*.la -o -name \*.a | xargs rm build_$ARCH/root/$i/ -done - -for i in bin sbin usr/bin usr/sbin lib usr/lib usr/lib/asterisk/modules -do -find build_$ARCH/root/$i -type f | xargs $STRIP -g build_$ARCH/root/$i/ -done - else -echo "Stripping declined" + echo "Stripping declined" fi #dd if=/dev/zero of=runnix.img bs=1024k count=$SIZE @@ -106,16 +82,16 @@ rm -f runnix.img ./bximage -q -hd -mode=flat -size=$SIZE runnix.img > bximage.out + losetup ${LOOPD}0 runnix.img CYL=`cat bximage.out | grep ' cyl=' | awk -F\= '{print $2}'` HEADS=`cat bximage.out | grep ' heads=' | awk -F\= '{print $2}'` SECTORS=`cat bximage.out | grep ' sectors per track=' | awk -F\= '{print $2}'` -if [ "$CYL" -a "$HEADS" -a "$SECTORS" ] -then - echo "I can do this automatically" - echo "x +if [ "$CYL" -a "$HEADS" -a "$SECTORS" ]; then + echo "I can do this automatically" + echo "x h $HEADS s @@ -136,14 +112,15 @@ w" | fdisk ${LOOPD}0 else - echo " + echo " You will need to write down the number of cylinders, heads, and sectors for fdisk. Bad things happen if you mess this up! " - cat bximage.out - echo " + cat bximage.out + + echo " You need to run fdisk manually to partition the image. Please write down or memorize the following instructions: @@ -160,10 +137,10 @@ press 't' fill in FAT16 type - that's ID 6 press 'w' to write partition table and exit " - echo "Press enter when you are ready" - read + echo "Press enter when you are ready" + read - fdisk ${LOOPD}0 + fdisk ${LOOPD}0 fi losetup -d ${LOOPD}0 @@ -185,6 +162,8 @@ cp -r -P --preserve=mode,timestamps ${RUNFS_DIR}/. /mnt/runnix +rootSize=`du -s -m rootfs.i586.ext2 | awk '{print $1}'` + # run this in a subshell, since we change subdirectory ( \ cd /mnt/runnix ; \ Modified: trunk/target/x86/runnix/runnix.mk =================================================================== --- trunk/target/x86/runnix/runnix.mk 2008-03-06 01:38:50 UTC (rev 1620) +++ trunk/target/x86/runnix/runnix.mk 2008-03-06 03:32:11 UTC (rev 1621) @@ -32,6 +32,19 @@ $(RUNFS_DIR)/os/ver: $(wildcard $(ASTVER)/*) cp $(ASTVER)/* $(RUNFS_DIR)/os/ + @echo "Fixing up kernel parameters (astkd/asturw/noram)..." + if [ -n "$$ASTKD" ]; then \ + $(SED) "s@ astkd=[^ ]* @ astkd=$${ASTKD} @" \ + $(RUNFS_DIR)/os/$(ASTVER).run.conf ; \ + elif [ -n "$$ASTURW" ]; then \ + $(SED) "s@ astkd=[^ ]* @ asturw=$${ASTURW} @" \ + $(RUNFS_DIR)/os/$(ASTVER).run.conf ; \ + fi ; \ + megs=`du -s -m rootfs.i586.ext2 | awk '{ print $$1 }'` ; \ + if [ "$$megs" -gt 90 ]; then \ + $(SED) "s@ astlive @ astlive noram @" \ + $(RUNFS_DIR)/os/$(ASTVER).run.conf ; \ + fi rm -f $(RUNFS_DIR)/*.sample cp $(TARGET_RUNNIX_DIR)/syslinux.cfg $(RUNFS_DIR)/syslinux.cfg echo $(ASTVER) > $(RUNFS_DIR)/os/ver This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |