diff options
author | Ben Dooks <ben-linux@fluff.org> | 2018-10-12 11:12:01 +0300 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2018-11-08 13:57:08 +0300 |
commit | 31d0b9f9982f8e3a489e83419461d35ab003160a (patch) | |
tree | c7d5993c2e8ba67f1eb97c30039fef824f5d1265 /arch/arm/boot/compressed | |
parent | 7f97686715a7a4413baabe47df28946e175f5a59 (diff) | |
download | linux-31d0b9f9982f8e3a489e83419461d35ab003160a.tar.xz |
ARM: 8804/1: zImage: atags_to_fdt: add serial-number for ATAG_SERIAL
If the system passes an ATAG_SERIAL, convert that into a /serial-number
node so that the system serial number will be passed through the FDT and
be present under the kernel.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/boot/compressed')
-rw-r--r-- | arch/arm/boot/compressed/atags_to_fdt.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 41fa7316c52b..330cd3c2eae5 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -98,6 +98,24 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) setprop_string(fdt, "/chosen", "bootargs", cmdline); } +static void hex_str(char *out, uint32_t value) +{ + uint32_t digit; + int idx; + + for (idx = 7; idx >= 0; idx--) { + digit = value >> 28; + value <<= 4; + digit &= 0xf; + if (digit < 10) + digit += '0'; + else + digit += 'A'-10; + *out++ = digit; + } + *out = '\0'; +} + /* * Convert and fold provided ATAGs into the provided FDT. * @@ -180,6 +198,11 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) initrd_start); setprop_cell(fdt, "/chosen", "linux,initrd-end", initrd_start + initrd_size); + } else if (atag->hdr.tag == ATAG_SERIAL) { + char serno[16+2]; + hex_str(serno, atag->u.serialnr.high); + hex_str(serno+8, atag->u.serialnr.low); + setprop_string(fdt, "/", "serial-number", serno); } } |