kernel: fix 64-bit for kobject generation

We need a format code for struct packing that fits in
a pointer value, "I" is fixed at 32-bit.

The conversion of string to pointer value now prints
8 bytes. This works for 32-bit since the leading
4 digits are always zero.

The replaced length check uses sizeof(void *) and not 4.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/scripts/gen_kobject_list.py b/scripts/gen_kobject_list.py
index 1e2cdd2..e891472 100755
--- a/scripts/gen_kobject_list.py
+++ b/scripts/gen_kobject_list.py
@@ -200,7 +200,17 @@
         initialized = static_begin <= obj_addr < static_end
         is_driver = obj_type.startswith("K_OBJ_DRIVER_")
 
-        byte_str = struct.pack("<I" if eh.little_endian else ">I", obj_addr)
+        if "CONFIG_64BIT" in syms:
+            format_code = "Q"
+        else:
+            format_code = "I"
+
+        if eh.little_endian:
+            endian = "<"
+        else:
+            endian = ">"
+
+        byte_str = struct.pack(endian + format_code, obj_addr)
         fp.write("\"")
         for byte in byte_str:
             val = "\\x%02x" % byte