summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dearman <chris.dearman@imgtec.com>2014-09-25 22:24:46 +0400
committerMatt Redfearn <matt.redfearn@imgtec.com>2015-08-26 11:53:31 +0300
commit6cfaf802b580f2f7e92a5dec705ff9c196c637b4 (patch)
treec5a3b00c38ab13d45c28ae6f342b5e31bcf02191
parent7c4909934860d76d23a966ec0a45d19a7f9276bb (diff)
downloadCI20_u-boot-6cfaf802b580f2f7e92a5dec705ff9c196c637b4.tar.xz
Add board serial number to kernel command line
Also use snprintf to avoid possible buffer overruns Change-Id: I7b96364f077a4b2c312eaabdbca2eb2f6a87ff5e
-rw-r--r--arch/mips/lib/bootm.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 1065ee0ba..57adb1c2f 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -269,7 +269,8 @@ void do_boota_linux(bootm_headers_t * images,
unsigned kernel_actual;
const void *kernel_src_addr, *ramdisk_src_addr;
void *kernel_dst_addr, *ramdisk_dst_addr;
- char cmdline[256];
+ char arg[256];
+ const char *s;
/* init kernel, ramdisk and prepare parameters */
page_mask = fb_hdr->page_size - 1;
@@ -308,13 +309,20 @@ void do_boota_linux(bootm_headers_t * images,
// Include any kernel command line options from boot.img
boot_cmdline_linux(images, (const char *)fb_hdr->cmdline);
+ // Add board serial number for Android boot
+ s = getenv("serial#");
+ if (s) {
+ snprintf(arg, sizeof(arg), "androidboot.serialno=%s", s);
+ linux_cmdline_set(arg, strlen(arg));
+ }
// TODO: These extra lines are being added to support old
// kernels which expect these two parameters to be included
// on the command line.
- sprintf(cmdline, "rd_start=0x%0X", (unsigned int)ramdisk_dst_addr);
- linux_cmdline_set(cmdline, strlen(cmdline));
- sprintf(cmdline, "rd_size=0x%X", fb_hdr->ramdisk_size);
- linux_cmdline_set(cmdline, strlen(cmdline));
+ snprintf(arg, sizeof(arg), "rd_start=0x%0X",
+ (unsigned int)ramdisk_dst_addr);
+ linux_cmdline_set(arg, strlen(arg));
+ snprintf(arg, sizeof(arg), "rd_size=0x%X", fb_hdr->ramdisk_size);
+ linux_cmdline_set(arg, strlen(arg));
#ifdef DEBUG
printf("rd_start=0x%X rd_size=0x%X\n",
(unsigned int)ramdisk_dst_addr, fb_hdr->ramdisk_size);