# Patch author: Benjamin Herrenschmidt # Description: Fix oldworld initrd loading problems. # It looks like older OF "setprop" is bogus and isn't actually copying the # data but just taking a pointer. The LongTrail workaround also has that # problem as "property" will not copy the data. This fixes the workaround # and applies it to Apple OF 1.0.5. # Signed-off-by: Benjamin Herrenschmidt # Closes: # 375035: Kernel 2.6.16 attempts to access root device before running initramfs init # 366620: initramfs-tools: 2.6.16-1-powerpc fails to mount rootfs, 2.6.15-1-powerpc works # Index: linux-tika/arch/powerpc/kernel/prom_init.c =================================================================== --- linux-tika.orig/arch/powerpc/kernel/prom_init.c 2006-09-02 09:53:00.000000000 +1000 +++ linux-tika/arch/powerpc/kernel/prom_init.c 2006-09-18 20:55:26.000000000 +1000 @@ -102,7 +102,7 @@ #endif #define OF_WA_CLAIM 1 /* do phys/virt claim separately, then map */ -#define OF_WA_LONGTRAIL 2 /* work around longtrail bugs */ +#define OF_WA_SETPROP 2 /* work around setprop bugs */ #define PROM_BUG() do { \ prom_printf("kernel BUG at %s line 0x%x!\n", \ @@ -472,7 +472,7 @@ { char cmd[256], *p; - if (!(OF_WORKAROUNDS & OF_WA_LONGTRAIL)) + if (!(OF_WORKAROUNDS & OF_WA_SETPROP)) return call_prom("setprop", 4, 1, node, ADDR(pname), (u32)(unsigned long) value, (u32) valuelen); @@ -482,6 +482,7 @@ add_string(&p, nodename); add_string(&p, tohex((u32)(unsigned long) value)); add_string(&p, tohex(valuelen)); + add_string(&p, "encode-bytes"); add_string(&p, tohex(ADDR(pname))); add_string(&p, tohex(strlen(RELOC(pname)))); add_string(&p, "property"); @@ -1466,9 +1467,9 @@ version[sizeof(version) - 1] = 0; /* XXX might need to add other versions here */ if (strcmp(version, "Open Firmware, 1.0.5") == 0) - of_workarounds = OF_WA_CLAIM; + of_workarounds = OF_WA_CLAIM | OF_WA_SETPROP; else if (strncmp(version, "FirmWorks,3.", 12) == 0) { - of_workarounds = OF_WA_CLAIM | OF_WA_LONGTRAIL; + of_workarounds = OF_WA_CLAIM | OF_WA_SETPROP; call_prom("interpret", 1, 1, "dev /memory 0 to allow-reclaim"); } else return;