OSDN Git Service

add grub4dos for live usb menu selection
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 19 Aug 2009 11:28:04 +0000 (19:28 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 19 Aug 2009 12:45:06 +0000 (20:45 +0800)
Android.mk
initrd/init
install/scripts/1-install
usb/grub4dos [new file with mode: 0644]
usb/menu.lst [new file with mode: 0644]

index f873f0d..a6b3e99 100644 (file)
@@ -56,13 +56,15 @@ ANDROID_SRC := /android-system
 USB_BOOT := $(PRODUCT_OUT)/usb_boot
 
 usb_tmp_img := $(PRODUCT_OUT)/usb_tmp.img
-$(usb_tmp_img): $(BUILT_IMG) | $(MKEXT2IMG)
+$(usb_tmp_img): $(wildcard $(LOCAL_PATH)/usb/*) $(BUILT_IMG) | $(ACP) $(MKEXT2IMG)
        rm -rf $(USB_BOOT)
        mkdir -p $(USB_BOOT)$(ANDROID_SRC)
-       echo -n "$(BOARD_KERNEL_CMDLINE) SRC=$(ANDROID_SRC)" > $(USB_BOOT)/cmdline
-       ln $^ $(USB_BOOT)
-       mv $(USB_BOOT)/{ramdisk.img,system.*} $(USB_BOOT)$(ANDROID_SRC)
-       mv $(USB_BOOT)/initrd.img $(USB_BOOT)/ramdisk
+       touch $(USB_BOOT)/ramdisk
+       echo 1 > $(USB_BOOT)/cmdline
+       ln $(BUILT_IMG) $(USB_BOOT)$(ANDROID_SRC)
+       $(ACP) -fp $(<D)/* $(<D)/../install/grub/android-x86.xpm.gz $(USB_BOOT)
+       ln -s grub4dos $(USB_BOOT)/kernel
+       $(hide) sed -i "s|VER|$(VER)|; s|CMDLINE|$(BOARD_KERNEL_CMDLINE)|" $(USB_BOOT)/menu.lst
        num_blocks=`du -sk $(USB_BOOT) | tail -n1 | awk '{print $$1;}'`; \
        num_inodes=`find $(USB_BOOT) | wc -l`; \
        $(MKEXT2IMG) -d $(USB_BOOT) -b `expr $$num_blocks + 20480` -N `expr $$num_inodes + 15` -m 0 $@
index 46768e4..bb69f43 100755 (executable)
@@ -8,6 +8,13 @@
 # with Android-x86 project.
 #
 
+try_mount()
+{
+       RW=$1; shift
+       # FIXME: any way to mount ntfs gracefully?
+       mount -o $RW $@ || mount.ntfs-3g -o rw,force $@
+}
+
 if [ -n "$DEBUG" ]; then
        LOG=/tmp/log
        set -x
@@ -27,6 +34,8 @@ export PATH=$PATH:/system/bin
 if [ -n "$DEBUG" -o -n "$INSTALL" ]; then
        mknod /dev/tty2 c 4 2 && openvt
        mknod /dev/tty3 c 4 3 && openvt
+else
+       echo 0 0 0 0 > /proc/sys/kernel/printk
 fi
 
 echo -n Detecting Android...
@@ -35,10 +44,7 @@ while [ 1 ]; do
        mdev -s
 
        for device in /dev/sr* /dev/sd[a-z]*; do
-               # FIXME: any way to mount ntfs gracefully?
-               mount -o ro $device /mnt || \
-                       mount.ntfs-3g -o rw $device /mnt || \
-                       continue
+               try_mount ro $device /mnt || continue
                cd /mnt/$SRC
                if [ ! -e ramdisk.img -o ! \( -e system.img -o -e system.sfs \) ]; then
                        cd /
index 1151b37..b4f05f7 100644 (file)
@@ -103,11 +103,7 @@ install_to()
        mountpoint -q /hd && umount /hd
        while [ 1 ]; do
                format_fs $1
-               for m in mount /sbin/mount.*; do
-                       # FIXME: how to mount fuse filesystem automatically?
-                       $m /dev/$1 /hd && break
-               done
-               [ $? -eq 0 ] && break
+               try_mount rw /dev/$1 /hd && break
                dialog --clear --title " Error " --defaultno --yesno \
                        "\n Cannot mount /dev/$1\n Do you want to format it?" 8 37
                [ $? -ne 0 ] && return 255
@@ -177,7 +173,6 @@ install_hd()
 
 do_install()
 {
-       echo "0 0 0 0" > /proc/sys/kernel/printk
        until install_hd; do
                if [ $retval -eq 255 ]; then
                        dialog --title ' Error! ' --yes-label Retry --no-label Reboot \
diff --git a/usb/grub4dos b/usb/grub4dos
new file mode 100644 (file)
index 0000000..b435981
Binary files /dev/null and b/usb/grub4dos differ
diff --git a/usb/menu.lst b/usb/menu.lst
new file mode 100644 (file)
index 0000000..7f209fb
--- /dev/null
@@ -0,0 +1,20 @@
+default=0
+timeout=6
+root (hd0,0)
+splashimage=/android-x86.xpm.gz
+
+title Live USB - Run Android without Installation
+       kernel /android-system/kernel CMDLINE quiet SRC=/android-system
+       initrd /android-system/initrd.img
+
+title Live USB - VESA Mode
+       kernel /android-system/kernel CMDLINE quiet vga=788 SRC=/android-system
+       initrd /android-system/initrd.img
+
+title Live USB - Debug Mode
+       kernel /android-system/kernel CMDLINE vga=788 SRC=/android-system DEBUG=1
+       initrd /android-system/initrd.img
+
+title Installation - Install Android VER to harddisk
+       kernel /android-system/kernel CMDLINE quiet SRC=/android-system INSTALL=1 DEBUG=
+       initrd /android-system/initrd.img