From 10fd786bd425a310b63eb6be4bb8ccf9f7c92f39 Mon Sep 17 00:00:00 2001 From: Pawit Pornkitprasan Date: Sat, 7 Jan 2012 11:52:53 +0700 Subject: aries: Add bootmode injection support Allows reboot recovery to work without /cache/.startrecovery hack - Renames s3c_usb_set_serial to aries_inject_cmdline --- arch/arm/mach-s5pv210/mach-aries.c | 20 ++++++++++++++++---- arch/arm/plat-s5p/devs.c | 15 --------------- arch/arm/plat-samsung/include/plat/devs.h | 2 -- usr/captivatemtd_initramfs_files/init | 8 +++----- usr/fascinatemtd_initramfs_files/init | 9 +++------ usr/galaxysbmtd_initramfs_files/init | 8 +++----- usr/galaxysmtd_initramfs_files/init | 8 +++----- usr/vibrantmtd_initramfs_files/init | 8 +++----- 8 files changed, 31 insertions(+), 47 deletions(-) diff --git a/arch/arm/mach-s5pv210/mach-aries.c b/arch/arm/mach-s5pv210/mach-aries.c index 7908c07..eb46197 100644 --- a/arch/arm/mach-s5pv210/mach-aries.c +++ b/arch/arm/mach-s5pv210/mach-aries.c @@ -146,9 +146,7 @@ static int aries_notifier_call(struct notifier_block *this, if ((code == SYS_RESTART) && _cmd) { if (!strcmp((char *)_cmd, "recovery")) - mode = REBOOT_MODE_RECOVERY; - else if (!strcmp((char *)_cmd, "bootloader")) - mode = REBOOT_MODE_FAST_BOOT; + mode = 2; // It's not REBOOT_MODE_RECOVERY, blame Samsung else mode = REBOOT_MODE_NONE; } @@ -5176,12 +5174,26 @@ static void aries_pm_restart(char mode, const char *cmd) arm_machine_restart(mode, cmd); } +// Ugly hack to inject parameters (e.g. device serial, bootmode) into /proc/cmdline +static void __init aries_inject_cmdline(void) { + char *new_command_line; + int size; + + size = strlen(boot_command_line); + new_command_line = kmalloc(size + 40 + 11, GFP_KERNEL); + strcpy(new_command_line, saved_command_line); + size += sprintf(new_command_line + size, " androidboot.serialno=%08X%08X", + system_serial_high, system_serial_low); + size += sprintf(new_command_line + size, " bootmode=%d", __raw_readl(S5P_INFORM6)); + saved_command_line = new_command_line; +} + static void __init aries_machine_init(void) { arm_pm_restart = aries_pm_restart; setup_ram_console_mem(); - s3c_usb_set_serial(); + aries_inject_cmdline(); platform_add_devices(aries_devices, ARRAY_SIZE(aries_devices)); /* smb380 */ diff --git a/arch/arm/plat-s5p/devs.c b/arch/arm/plat-s5p/devs.c index d69247f..f961d66 100644 --- a/arch/arm/plat-s5p/devs.c +++ b/arch/arm/plat-s5p/devs.c @@ -41,21 +41,6 @@ #include #include -/* Android Gadget */ -// Ugly hack to inject device serial into /proc/cmdline -void __init s3c_usb_set_serial(void) -{ - char *new_command_line; - int size; - - size = strlen(boot_command_line); - new_command_line = kmalloc(size + 40, GFP_KERNEL); - strcpy(new_command_line, saved_command_line); - sprintf(new_command_line + size, " androidboot.serialno=%08X%08X", - system_serial_high, system_serial_low); - saved_command_line = new_command_line; -} - /* RTC */ static struct resource s5p_rtc_resource[] = { [0] = { diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index 1170fb9..54e0b6e 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h @@ -198,6 +198,4 @@ extern struct platform_device s3c_device_ac97; extern void *s3c_set_platdata(void *pd, size_t pdsize, struct platform_device *pdev); -void __init s3c_usb_set_serial(void); - #endif /* __PLAT_DEVS_H */ diff --git a/usr/captivatemtd_initramfs_files/init b/usr/captivatemtd_initramfs_files/init index 5d0a655..feb03f6 100755 --- a/usr/captivatemtd_initramfs_files/init +++ b/usr/captivatemtd_initramfs_files/init @@ -17,11 +17,9 @@ load_offset=$boot_offset load_len=$boot_len busybox mount -t yaffs2 /dev/block/mtdblock2 /system -busybox mount -t yaffs2 /dev/block/mtdblock3 /cache -if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmdline ; then +if busybox grep -q bootmode=2 /proc/cmdline ; then # recovery boot - busybox rm -fr /cache/.startrecovery load_offset=$recovery_offset load_len=$recovery_len @@ -29,7 +27,6 @@ if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmd busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting elif ! busybox test -e /system/build.prop ; then # emergency boot - busybox umount /cache erase_image cache busybox mount -t yaffs2 /dev/block/mtdblock3 /cache busybox mkdir /cache/recovery @@ -42,6 +39,8 @@ elif ! busybox test -e /system/build.prop ; then busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand fi + busybox umount /cache + load_offset=$recovery_offset load_len=$recovery_len @@ -49,7 +48,6 @@ elif ! busybox test -e /system/build.prop ; then busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting fi -busybox umount /cache busybox umount /system busybox umount /sdcard busybox rmdir /sdcard diff --git a/usr/fascinatemtd_initramfs_files/init b/usr/fascinatemtd_initramfs_files/init index ae94eab..4d35c3e 100755 --- a/usr/fascinatemtd_initramfs_files/init +++ b/usr/fascinatemtd_initramfs_files/init @@ -17,12 +17,9 @@ load_offset=$boot_offset load_len=$boot_len busybox mount -t yaffs2 /dev/block/mtdblock2 /system -busybox mount -t yaffs2 /dev/block/mtdblock3 /cache -if busybox test -e /cache/.startrecovery || \ - busybox grep -q bootmode=2 /proc/cmdline ; then +if busybox grep -q bootmode=2 /proc/cmdline ; then # recovery boot - busybox rm -fr /cache/.startrecovery load_offset=$recovery_offset load_len=$recovery_len @@ -31,7 +28,6 @@ if busybox test -e /cache/.startrecovery || \ busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting elif ! busybox test -e /system/build.prop ; then # emergency boot - busybox umount /cache erase_image cache busybox mount -t yaffs2 /dev/block/mtdblock3 /cache busybox mkdir /cache/recovery @@ -44,6 +40,8 @@ elif ! busybox test -e /system/build.prop ; then busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand fi + busybox umount /cache + load_offset=$recovery_offset load_len=$recovery_len @@ -51,7 +49,6 @@ elif ! busybox test -e /system/build.prop ; then busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting fi -busybox umount /cache busybox umount /system busybox umount /sdcard busybox rmdir /sdcard diff --git a/usr/galaxysbmtd_initramfs_files/init b/usr/galaxysbmtd_initramfs_files/init index 5d0a655..feb03f6 100755 --- a/usr/galaxysbmtd_initramfs_files/init +++ b/usr/galaxysbmtd_initramfs_files/init @@ -17,11 +17,9 @@ load_offset=$boot_offset load_len=$boot_len busybox mount -t yaffs2 /dev/block/mtdblock2 /system -busybox mount -t yaffs2 /dev/block/mtdblock3 /cache -if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmdline ; then +if busybox grep -q bootmode=2 /proc/cmdline ; then # recovery boot - busybox rm -fr /cache/.startrecovery load_offset=$recovery_offset load_len=$recovery_len @@ -29,7 +27,6 @@ if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmd busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting elif ! busybox test -e /system/build.prop ; then # emergency boot - busybox umount /cache erase_image cache busybox mount -t yaffs2 /dev/block/mtdblock3 /cache busybox mkdir /cache/recovery @@ -42,6 +39,8 @@ elif ! busybox test -e /system/build.prop ; then busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand fi + busybox umount /cache + load_offset=$recovery_offset load_len=$recovery_len @@ -49,7 +48,6 @@ elif ! busybox test -e /system/build.prop ; then busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting fi -busybox umount /cache busybox umount /system busybox umount /sdcard busybox rmdir /sdcard diff --git a/usr/galaxysmtd_initramfs_files/init b/usr/galaxysmtd_initramfs_files/init index 5d0a655..feb03f6 100755 --- a/usr/galaxysmtd_initramfs_files/init +++ b/usr/galaxysmtd_initramfs_files/init @@ -17,11 +17,9 @@ load_offset=$boot_offset load_len=$boot_len busybox mount -t yaffs2 /dev/block/mtdblock2 /system -busybox mount -t yaffs2 /dev/block/mtdblock3 /cache -if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmdline ; then +if busybox grep -q bootmode=2 /proc/cmdline ; then # recovery boot - busybox rm -fr /cache/.startrecovery load_offset=$recovery_offset load_len=$recovery_len @@ -29,7 +27,6 @@ if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmd busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting elif ! busybox test -e /system/build.prop ; then # emergency boot - busybox umount /cache erase_image cache busybox mount -t yaffs2 /dev/block/mtdblock3 /cache busybox mkdir /cache/recovery @@ -42,6 +39,8 @@ elif ! busybox test -e /system/build.prop ; then busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand fi + busybox umount /cache + load_offset=$recovery_offset load_len=$recovery_len @@ -49,7 +48,6 @@ elif ! busybox test -e /system/build.prop ; then busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting fi -busybox umount /cache busybox umount /system busybox umount /sdcard busybox rmdir /sdcard diff --git a/usr/vibrantmtd_initramfs_files/init b/usr/vibrantmtd_initramfs_files/init index 5d0a655..feb03f6 100755 --- a/usr/vibrantmtd_initramfs_files/init +++ b/usr/vibrantmtd_initramfs_files/init @@ -17,11 +17,9 @@ load_offset=$boot_offset load_len=$boot_len busybox mount -t yaffs2 /dev/block/mtdblock2 /system -busybox mount -t yaffs2 /dev/block/mtdblock3 /cache -if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmdline ; then +if busybox grep -q bootmode=2 /proc/cmdline ; then # recovery boot - busybox rm -fr /cache/.startrecovery load_offset=$recovery_offset load_len=$recovery_len @@ -29,7 +27,6 @@ if busybox test -e /cache/.startrecovery || busybox grep -q bootmode=2 /proc/cmd busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting elif ! busybox test -e /system/build.prop ; then # emergency boot - busybox umount /cache erase_image cache busybox mount -t yaffs2 /dev/block/mtdblock3 /cache busybox mkdir /cache/recovery @@ -42,6 +39,8 @@ elif ! busybox test -e /system/build.prop ; then busybox echo "install_zip(\"`echo $UPDATE`\");" > /cache/recovery/extendedcommand fi + busybox umount /cache + load_offset=$recovery_offset load_len=$recovery_len @@ -49,7 +48,6 @@ elif ! busybox test -e /system/build.prop ; then busybox echo 0 > /sys/class/power_supply/battery/charging_mode_booting fi -busybox umount /cache busybox umount /system busybox umount /sdcard busybox rmdir /sdcard -- cgit v1.1