From 939facfc7191b58c3d0fec275f93ed7d66a6c032 Mon Sep 17 00:00:00 2001 From: Chirayu Desai Date: Fri, 9 Mar 2012 16:37:06 +0530 Subject: add support for p1 Signed-off-by: Chirayu Desai Signed-off-by: Humberto Borba Signed-off-by: Koudai Aono Change-Id: I2dcbaee7f17852ed3ea4a5db2d103704027fe259 --- usr/p1_initramfs.list | 53 ++++++++++++++++++++++++++++++ usr/p1_initramfs_files/busybox | Bin 0 -> 478916 bytes usr/p1_initramfs_files/init | 73 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 usr/p1_initramfs.list create mode 100755 usr/p1_initramfs_files/busybox create mode 100755 usr/p1_initramfs_files/init (limited to 'usr') diff --git a/usr/p1_initramfs.list b/usr/p1_initramfs.list new file mode 100644 index 0000000..9c576e2 --- /dev/null +++ b/usr/p1_initramfs.list @@ -0,0 +1,53 @@ + + +dir /dev 755 0 0 +dir /dev/block 755 0 0 +nod /dev/block/mmcblk0 644 0 0 b 179 0 +nod /dev/block/mmcblk0p1 644 0 0 b 179 1 +nod /dev/block/mmcblk0p2 644 0 0 b 179 2 +nod /dev/block/mmcblk0p3 644 0 0 b 179 3 +nod /dev/block/mtdblock0 644 0 0 b 31 0 +nod /dev/block/mtdblock1 644 0 0 b 31 1 +nod /dev/block/mtdblock2 644 0 0 b 31 2 +nod /dev/block/mtdblock3 644 0 0 b 31 3 +nod /dev/block/mtdblock4 644 0 0 b 31 4 +dir /dev/mtd 755 0 0 +nod /dev/mtd/mtd0 644 0 0 c 90 0 +nod /dev/mtd/mtd0ro 644 0 0 c 90 1 +nod /dev/mtd/mtd1 644 0 0 c 90 2 +nod /dev/mtd/mtd1ro 644 0 0 c 90 3 +nod /dev/mtd/mtd2 644 0 0 c 90 4 +nod /dev/mtd/mtd2ro 644 0 0 c 90 5 +nod /dev/mtd/mtd3 644 0 0 c 90 6 +nod /dev/mtd/mtd3ro 644 0 0 c 90 7 +nod /dev/mtd/mtd4 644 0 0 c 90 8 +nod /dev/mtd/mtd4ro 644 0 0 c 90 9 +slink /init /stage1/init 777 0 0 +dir /proc 755 0 0 +dir /stage1 755 0 0 +dir /system 755 0 0 +dir /cache 755 0 0 +dir /sdcard 755 0 0 +file /stage1/busybox source/usr/p1_initramfs_files/busybox 755 0 0 +file /stage1/init source/usr/p1_initramfs_files/init 755 0 0 +file /stage1/make_ext4fs ../../utilities/make_ext4fs 755 0 0 +file /stage1/boot.cpio ../../ramdisk.cpio 644 0 0 +file /stage1/recovery.cpio ../../ramdisk-recovery.cpio 644 0 0 +slink /stage1/cat busybox 755 0 0 +slink /stage1/cp busybox 755 0 0 +slink /stage1/cpio busybox 755 0 0 +slink /stage1/date busybox 755 0 0 +slink /stage1/dd busybox 755 0 0 +slink /stage1/echo busybox 755 0 0 +slink /stage1/grep busybox 755 0 0 +slink /stage1/insmod busybox 755 0 0 +slink /stage1/mkdir busybox 755 0 0 +slink /stage1/mount busybox 755 0 0 +slink /stage1/rm busybox 755 0 0 +slink /stage1/sh busybox 755 0 0 +slink /stage1/tail busybox 755 0 0 +slink /stage1/test busybox 755 0 0 +slink /stage1/touch busybox 755 0 0 +slink /stage1/umount busybox 755 0 0 +slink /stage1/zcat busybox 755 0 0 +dir /sys 755 0 0 diff --git a/usr/p1_initramfs_files/busybox b/usr/p1_initramfs_files/busybox new file mode 100755 index 0000000..9496f7a Binary files /dev/null and b/usr/p1_initramfs_files/busybox differ diff --git a/usr/p1_initramfs_files/init b/usr/p1_initramfs_files/init new file mode 100755 index 0000000..3a989f1 --- /dev/null +++ b/usr/p1_initramfs_files/init @@ -0,0 +1,73 @@ +#!/stage1/busybox sh +export _PATH="$PATH" +export PATH=/stage1 + +busybox cd / +busybox date >>boot.txt +exec >>boot.txt 2>&1 +busybox rm init +busybox mount -t proc proc /proc +busybox mount -t sysfs sysfs /sys +busybox mount -t yaffs2 /dev/block/mtdblock2 /system +busybox mount -t ext4 /dev/block/mmcblk0p3 /cache + +image=/stage1/boot.cpio + +if busybox test -e /cache/.startrecovery || [ `busybox cat /proc/cmdline | busybox grep bootmode | busybox awk '{print $2}'` == bootmode=2 ] ; then + # recovery boot + busybox rm -fr /cache/.startrecovery + image=/stage1/recovery.cpio + + # disable lpm + busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting +elif ! busybox test -e /system/build.prop ; then + # emergency boot + busybox umount /cache + make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /cache /dev/block/mmcblk0p3 + busybox mount -t ext4 /dev/block/mmcblk0p3 /cache + busybox mkdir /cache/recovery + + busybox mount -t vfat /dev/block/mmcblk0p1 /sdcard + + UPDATE=$(busybox cat /sdcard/cyanogenmod.cfg) + + if busybox test -e $UPDATE ; then + busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand + fi + + image=/stage1/recovery.cpio + + # disable lpm + busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting +fi + +busybox umount /cache +busybox umount /system +busybox umount /sdcard +busybox rmdir /sdcard + +cpio -i < ${image} + +if busybox grep -q 1 /sys/class/power_supply/battery/charging_mode_booting ; then + # low power mode + busybox cp lpm.rc init.rc + busybox rm init.p1.rc +fi + +HW=$(busybox cat /proc/cpuinfo | busybox grep Hardware | busybox sed s/Hardware// | busybox tr '[A-Z]' '[a-z]' | busybox tr -d ' ' | busybox tr -d ':' | busybox tr -d '\t') +if [ "$HW" != "p1" ] ; then + if [ "$image" == "/stage1/boot.cpio" ] ; then + busybox ln -s /init.p1.rc /init.$HW.rc + elif [ "$image" == "/stage1/recovery.cpio" ] ; then + busybox ln -s /init.recovery.p1.rc /init.recovery.$HW.rc + fi + + busybox ln -s /ueventd.p1.rc /ueventd.$HW.rc +fi + +busybox umount /sys +busybox umount /proc +busybox date >>boot.txt +busybox rm -fr /stage1 /dev/* +export PATH="${_PATH}" +exec /init -- cgit v1.1