From 4ca9535c91c40da93703bd20727700cd33994f93 Mon Sep 17 00:00:00 2001 From: "Ye.Li" Date: Fri, 4 Jul 2014 16:09:54 +0800 Subject: ENGR00321260-2 iMX6:Android: Append the "androidboot.serialno" to bootargs Android supports to two ways to pass serialno: 1. ATAG_SERIAL 2. "androidboot.serialno=" argument in boot commandline. Since we support the DTB for android, so the ATAGS can't work. We have to choose the second way. This patch only applys the bootargs in bootimg, while the bootargs saved in u-boot env variables won't have this argument appended. Signed-off-by: Ye.Li --- common/cmd_fastboot.c | 18 ++++++++++++++++++ include/configs/mx6sabreandroid_common.h | 2 ++ include/configs/mx6slevkandroid.h | 2 ++ include/configs/mx6sxsabresdandroid.h | 2 ++ 4 files changed, 24 insertions(+) diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index fc3bdba..a8ad8e2 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -67,6 +67,7 @@ #include #include #endif +#include #ifdef CONFIG_FASTBOOT @@ -1748,7 +1749,24 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* If no bootargs env, just use hdr command line */ if (!commandline) { commandline = (char *)hdr->cmdline; +#ifdef CONFIG_SERIAL_TAG + char appended_cmd_line[FASTBOOT_BOOT_ARGS_SIZE]; + struct tag_serialnr serialnr; + get_board_serial(&serialnr); + if (strlen((char *)hdr->cmdline) + + strlen("androidboot.serialno") + 17 < FASTBOOT_BOOT_ARGS_SIZE) { + sprintf(appended_cmd_line, + "%s androidboot.serialno=%08x%08x", + (char *)hdr->cmdline, + serialnr.high, + serialnr.low); + commandline = appended_cmd_line; + } else { + printf("Cannot append androidboot.serialno\n"); + } + setenv("bootargs", commandline); +#endif } /* XXX: in production, you should always use boot.img 's cmdline !!! */ diff --git a/include/configs/mx6sabreandroid_common.h b/include/configs/mx6sabreandroid_common.h index 1645b1b..6602c7d 100644 --- a/include/configs/mx6sabreandroid_common.h +++ b/include/configs/mx6sabreandroid_common.h @@ -7,6 +7,8 @@ #ifndef MX6_SABRE_ANDROID_COMMON_H #define MX6_SABRE_ANDROID_COMMON_H +#define CONFIG_SERIAL_TAG + #define CONFIG_USB_DEVICE #define CONFIG_IMX_UDC 1 diff --git a/include/configs/mx6slevkandroid.h b/include/configs/mx6slevkandroid.h index 0bf67c5..a2447c1 100644 --- a/include/configs/mx6slevkandroid.h +++ b/include/configs/mx6slevkandroid.h @@ -10,6 +10,8 @@ #include +#define CONFIG_SERIAL_TAG + #define CONFIG_USB_DEVICE #define CONFIG_IMX_UDC 1 diff --git a/include/configs/mx6sxsabresdandroid.h b/include/configs/mx6sxsabresdandroid.h index bf78de4..0c16fe8 100644 --- a/include/configs/mx6sxsabresdandroid.h +++ b/include/configs/mx6sxsabresdandroid.h @@ -8,6 +8,8 @@ #ifndef __MX6SX_SABRESD_ANDROID_H #define __MX6SX_SABRESD_ANDROID_H +#define CONFIG_SERIAL_TAG + #define CONFIG_USB_DEVICE #define CONFIG_IMX_UDC 1 -- cgit v1.1