Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] bootwrapper: Add a firmware-independent simpleboot target.

This target produces a flat binary rather than an ELF file,
fixes the entry point at the beginning of the image, and takes
a complete device tree with no fixups needed.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

authored by

Grant Likely and committed by
Josh Boyer
d2477b5c 19a74263

+127 -1
+9 -1
arch/powerpc/boot/Makefile
··· 40 40 $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 41 41 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 42 42 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 43 + $(obj)/virtex405-head.o: BOOTCFLAGS += -mcpu=405 43 44 44 45 45 46 zlib := inffast.c inflate.c inftrees.c ··· 65 64 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 66 65 fixed-head.S ep88xc.c ep405.c \ 67 66 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 68 - cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c 67 + cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 68 + virtex405-head.S 69 69 src-boot := $(src-wlib) $(src-plat) empty.c 70 70 71 71 src-boot := $(addprefix $(obj)/, $(src-boot)) ··· 308 306 309 307 $(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 310 308 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 309 + 310 + $(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 311 + $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 312 + 313 + $(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 314 + $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb) 311 315 312 316 $(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 313 317 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+84
arch/powerpc/boot/simpleboot.c
··· 1 + /* 2 + * The simple platform -- for booting when firmware doesn't supply a device 3 + * tree or any platform configuration information. 4 + * All data is extracted from an embedded device tree 5 + * blob. 6 + * 7 + * Authors: Scott Wood <scottwood@freescale.com> 8 + * Grant Likely <grant.likely@secretlab.ca> 9 + * 10 + * Copyright (c) 2007 Freescale Semiconductor, Inc. 11 + * Copyright (c) 2008 Secret Lab Technologies Ltd. 12 + * 13 + * This program is free software; you can redistribute it and/or modify it 14 + * under the terms of the GNU General Public License version 2 as published 15 + * by the Free Software Foundation. 16 + */ 17 + 18 + #include "ops.h" 19 + #include "types.h" 20 + #include "io.h" 21 + #include "stdio.h" 22 + #include "libfdt/libfdt.h" 23 + 24 + BSS_STACK(4*1024); 25 + 26 + void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 27 + unsigned long r6, unsigned long r7) 28 + { 29 + const u32 *na, *ns, *reg, *timebase; 30 + u64 memsize64; 31 + int node, size, i; 32 + 33 + /* Make sure FDT blob is sane */ 34 + if (fdt_check_header(_dtb_start) != 0) 35 + fatal("Invalid device tree blob\n"); 36 + 37 + /* Find the #address-cells and #size-cells properties */ 38 + node = fdt_path_offset(_dtb_start, "/"); 39 + if (node < 0) 40 + fatal("Cannot find root node\n"); 41 + na = fdt_getprop(_dtb_start, node, "#address-cells", &size); 42 + if (!na || (size != 4)) 43 + fatal("Cannot find #address-cells property"); 44 + ns = fdt_getprop(_dtb_start, node, "#size-cells", &size); 45 + if (!ns || (size != 4)) 46 + fatal("Cannot find #size-cells property"); 47 + 48 + /* Find the memory range */ 49 + node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type", 50 + "memory", sizeof("memory")); 51 + if (node < 0) 52 + fatal("Cannot find memory node\n"); 53 + reg = fdt_getprop(_dtb_start, node, "reg", &size); 54 + if (size < (*na+*ns) * sizeof(u32)) 55 + fatal("cannot get memory range\n"); 56 + 57 + /* Only interested in memory based at 0 */ 58 + for (i = 0; i < *na; i++) 59 + if (*reg++ != 0) 60 + fatal("Memory range is not based at address 0\n"); 61 + 62 + /* get the memsize and trucate it to under 4G on 32 bit machines */ 63 + memsize64 = 0; 64 + for (i = 0; i < *ns; i++) 65 + memsize64 = (memsize64 << 32) | *reg++; 66 + if (sizeof(void *) == 4 && memsize64 >= 0x100000000ULL) 67 + memsize64 = 0xffffffff; 68 + 69 + /* finally, setup the timebase */ 70 + node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type", 71 + "cpu", sizeof("cpu")); 72 + if (!node) 73 + fatal("Cannot find cpu node\n"); 74 + timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size); 75 + if (timebase && (size == 4)) 76 + timebase_period_ns = 1000000000 / *timebase; 77 + 78 + /* Now we have the memory size; initialize the heap */ 79 + simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64); 80 + 81 + /* prepare the device tree and find the console */ 82 + fdt_init(_dtb_start); 83 + serial_console_init(); 84 + }
+30
arch/powerpc/boot/virtex405-head.S
··· 1 + #include "ppc_asm.h" 2 + 3 + .text 4 + .global _zimage_start 5 + _zimage_start: 6 + 7 + /* PPC errata 213: needed by Virtex-4 FX */ 8 + mfccr0 0 9 + oris 0,0,0x50000000@h 10 + mtccr0 0 11 + 12 + /* 13 + * Invalidate the data cache if the data cache is turned off. 14 + * - The 405 core does not invalidate the data cache on power-up 15 + * or reset but does turn off the data cache. We cannot assume 16 + * that the cache contents are valid. 17 + * - If the data cache is turned on this must have been done by 18 + * a bootloader and we assume that the cache contents are 19 + * valid. 20 + */ 21 + mfdccr r9 22 + cmplwi r9,0 23 + bne 2f 24 + lis r9,0 25 + li r8,256 26 + mtctr r8 27 + 1: dccci r0,r9 28 + addi r9,r9,0x20 29 + bdnz 1b 30 + 2: b _zimage_start_lib
+4
arch/powerpc/boot/wrapper
··· 199 199 platformo="$object/fixed-head.o $object/redboot-8xx.o" 200 200 binary=y 201 201 ;; 202 + simpleboot-virtex405-*) 203 + platformo="$object/virtex405-head.o $object/simpleboot.o" 204 + binary=y 205 + ;; 202 206 esac 203 207 204 208 vmz="$tmpdir/`basename \"$kernel\"`.$ext"