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.
  *
                                        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);
                }
        }