Moderator Control Panel ]

Add a new boot mode to better match dualOS

How-to guides on Geekbox.

Add a new boot mode to better match dualOS

Postby GeekBox » Mon Feb 22, 2016 8:34 am

As we know, the Android system support following boot mode:
1. reboot loader: Geekbox will reboot into loader mode.
2. reboot recovery: Geekbox will reboot into recovery mode.

It means that we can also switch the system when dualOS a similar way.
In our dualOS building, the Ubuntu is installed in a new independent partition which named ramfs.
So here we describe how to add ramfs boot mode for Geekbox.

1. Linux kernel patch:
Code: Select all
diff --git a/arch/arm/mach-rockchip/common.c b/arch/arm/mach-rockchip/common.c
index 510e4da..e91fa64 100755
--- a/arch/arm/mach-rockchip/common.c
+++ b/arch/arm/mach-rockchip/common.c
@@ -264,6 +264,9 @@ void rockchip_restart_get_boot_mode(const char *cmd, u32 *flag, u32 *mode)
                else if (!strcmp(cmd, "charge")) {
                        *flag = SYS_LOADER_REBOOT_FLAG + BOOT_CHARGING;
                        *mode = BOOT_MODE_CHARGE;
+               }else if(!strcmp(cmd, "ramfs")){
+                       *flag = SYS_LOADER_REBOOT_FLAG + BOOT_RAMFS;
+                       *mode = BOOT_MODE_RAMFS;
                }
        } else {
                if (is_panic)
diff --git a/arch/arm/mach-rockchip/loader.h b/arch/arm/mach-rockchip/loader.h
index bf2cd47..819e277 100644
--- a/arch/arm/mach-rockchip/loader.h
+++ b/arch/arm/mach-rockchip/loader.h
@@ -17,6 +17,7 @@ enum {
     BOOT_FASTBOOT,   /* enter fast boot mode */
     BOOT_SECUREBOOT_DISABLE,
     BOOT_CHARGING,   /* enter charge mode */
+    BOOT_RAMFS,
     BOOT_MAX         /* MAX VALID BOOT TYPE.*/
 };
 
diff --git a/include/linux/rockchip/common.h b/include/linux/rockchip/common.h
index 006d52d..0a10625 100644
--- a/include/linux/rockchip/common.h
+++ b/include/linux/rockchip/common.h
@@ -52,6 +52,7 @@ int rockchip_cpu_disable(unsigned int cpu);
 #define BOOT_MODE_PANIC                        7
 #define BOOT_MODE_WATCHDOG             8
 #define BOOT_MODE_TSADC                        9
+#define BOOT_MODE_RAMFS                      10
 
 int rockchip_boot_mode(void);
 void __init rockchip_boot_mode_init(u32 flag, u32 mode);
diff --git a/include/uapi/linux/reboot.h b/include/uapi/linux/reboot.h
index 09d056d..28e4c51 100644
--- a/include/uapi/linux/reboot.h
+++ b/include/uapi/linux/reboot.h
@@ -33,6 +33,7 @@
 #define        LINUX_REBOOT_CMD_RESTART2       0xA1B2C3D4
 #define        LINUX_REBOOT_CMD_SW_SUSPEND     0xD000FCE2
 #define        LINUX_REBOOT_CMD_KEXEC          0x45584543
+#define        LINUX_REBOOT_CMD_RESTART_RAMFS  0xEEEEEEEE
 
diff --git a/kernel/sys.c b/kernel/sys.c
index b1a203d..3147ab5 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -505,6 +505,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
 
        mutex_lock(&reboot_mutex);
        switch (cmd) {
+       case LINUX_REBOOT_CMD_RESTART_RAMFS:
+               kernel_restart("ramfs");
        case LINUX_REBOOT_CMD_RESTART:
                kernel_restart(NULL);
                break;
View our Github website for the full source code. Committed on Jan 12, 2016:
https://github.com/geekboxzone/lollipop_kernel/commits/geekbox

2. U-Boot patch:
Code: Select all
diff --git a/board/rockchip/common/config.h b/board/rockchip/common/config.h
index 37d287a..9347fe0 100755
--- a/board/rockchip/common/config.h
+++ b/board/rockchip/common/config.h
@@ -188,6 +188,7 @@ enum {
        BOOT_FASTBOOT,   
        BOOT_SECUREBOOT_DISABLE, 
        BOOT_CHARGING,
+       BOOT_RAMFS,
        BOOT_MAX         /* MAX VALID BOOT TYPE.*/
 };
 
diff --git a/board/rockchip/common/rkboot/fastboot.c b/board/rockchip/common/rkboot/fastboot.c
index 4bb8c28..c3f47f0 100755
--- a/board/rockchip/common/rkboot/fastboot.c
+++ b/board/rockchip/common/rkboot/fastboot.c
@@ -120,6 +120,10 @@ enum fbt_reboot_type board_fbt_get_reboot_type(void)
                        case BOOT_CHARGING:
                                frt = FASTBOOT_REBOOT_CHARGE;
                                break;
+                       case BOOT_RAMFS:
+                               frt = FASTBOOT_REBOOT_RAMFS;
+                               break;
+
                        default:
                                printf("unsupport rk boot type %d\n", reboot_mode);
                                break;
@@ -479,6 +483,12 @@ void board_fbt_preboot(void)
                board_fbt_request_start_fastboot();
        }
 #endif
+       else if (frt == FASTBOOT_REBOOT_RAMFS) {
+               #ifdef CONFIG_CMD_BOOTRK
+               char *const boot_cmd[] = {"bootrk", "ramfs"};
+               do_bootrk(NULL, 0, ARRAY_SIZE(boot_cmd), boot_cmd);
+               #endif
+       }
        else {
                FBTDBG("\n%s: check misc command.\n", __func__);
                /* unknown reboot cause (typically because of a cold boot).
diff --git a/include/fastboot.h b/include/fastboot.h
index 7b8508b..d6b8f1f 100755
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -238,6 +238,7 @@ enum fbt_reboot_type {
        FASTBOOT_REBOOT_RECOVERY_WIPE_DATA,     /* recovery and wipe data */
        FASTBOOT_REBOOT_FASTBOOT,               /* android fastboot */
        FASTBOOT_REBOOT_CHARGE,                 /* charge */
+       FASTBOOT_REBOOT_RAMFS,
 };
View our Github website for the full source code. Committed on Jan 11, 2016:
https://github.com/geekboxzone/lollipop_u-boot/commits/geekbox

3. Check it:
In serial terminal or ADB terminal type "reboot ramfs".
Code: Select all
shell@rk3368_box:/ $ reboot ramfs
[   47.928221]  [3:          rk-fb:   79] SysRq : Emergency Remount R/O
[   47.936622]  [0:    kworker/0:2:  138] EXT4-fs (mmcblk0p9): re-mounted. Opts: (null)
...
...
[   48.994094]  [0:           init:    1] Restarting system with command 'ramfs'.


See also:
1. Add a new bootable partition in u-boot for Ubuntu/DualOS: http://forum.geekbox.tv/viewtopic.php?f=2&t=176
User avatar
GeekBox
Site Admin
 
Posts: 623
Joined: Wed Nov 18, 2015 1:56 am

Re: Add a new boot mode to better match dualOS

Postby followmsi1 » Tue Mar 01, 2016 12:00 am

Very cool !

Please commit the patch to github mmallow kernel too.

Thanks
followmsi1
 
Posts: 521
Joined: Tue Jan 12, 2016 7:57 pm

Cephalexin For Adult Uti

Postby KelgotMouts » Wed Jun 21, 2017 1:17 pm

Amoxicillin To Treat A Sinus Infection generic viagra Viagra Soft 20mg Buy Synthroid India Levitra Soft Tabs No Prescription Tadalafil Propecia E Ereccion Cheap Viagra Sales Buy Liquid Viagra Weather In Vancouver Cialis Y Aspirina Low Cost Kamagra Online Compare Generic Cialis Prices Propecia E Impotencia Causar Buy Orlistat Tarif Cialis 20 Allegra Domange Clomid Brand Cialis Online Erfahrungen Mit Cialis Wirkung Lioresal Generique Buy Priligy Generic Viagra 50 Mg
Redtube buy cialis Celebrex Discount Coupon
KelgotMouts
 
Posts: 3229
Joined: Thu Jun 15, 2017 1:26 pm
Location: Somalia


Return to Wiki

Who is online

Users browsing this forum: No registered users and 2 guests

cron