From 80d8381811821445bc47cd6e46f1eea423d9fce5 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Thu, 6 Jan 2011 00:22:58 +0000 Subject: Add experimental code to self-relocate vmlinuz on e.g. brcm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for the following reason: our memory layout looks like this: | |vmlinux | |CFE| * | | | |vmlinuz | | ^ Since CFE can only load to the spot marked with ‘^’ anyway, we load vmlinub.elf there which is basically a big rodata blob containing vmlinuz and minimal code moving it to the location pointed with vmlinuz above. Another solution would be to use CFE’s “boot -raw” to place it on the location marked with ‘*’ above (but the CFE location and size are dynamic, and since it insists on loading to 0x80001000 anyway, this point is virtually moot). Signed-off-by: Thorsten Glaser --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 196 +++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch new file mode 100644 index 000000000..705bd1dde --- /dev/null +++ b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch @@ -0,0 +1,196 @@ +--- /dev/null Thu Jan 6 00:14:18 2011 ++++ arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 +@@ -0,0 +1,39 @@ ++/*- ++ * written 2010 by Thorsten Glaser based on ++ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script ++ */ ++ ++#include ++#include ++#include ++ ++#undef mips ++#define mips mips ++OUTPUT_ARCH(mips) ++ENTRY(selfreloc_start) ++PHDRS { ++ text PT_LOAD FLAGS(7); /* RWX */ ++} ++SECTIONS ++{ ++ . = VMLINUX_LOAD_ADDRESS; ++ .text : { ++ *(.text) ++ *(.text.*) ++ *(.rodata) ++ *(.rodata.*) ++ *(.data) ++ *(.data.*) ++ *(.bss) ++ *(.bss.*) ++ } :text ++ /DISCARD/ : { ++ *(.MIPS.options) ++ *(.options) ++ *(.pdr) ++ *(.reginfo) ++ *(.comment) ++ *(.note) ++ *(.gnu.attributes) ++ } ++} +--- /dev/null Thu Jan 6 00:14:22 2011 ++++ arch/mips/boot/compressed/selfreloc1.S Wed Jan 5 23:22:30 2011 +@@ -0,0 +1,48 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * arch/mips/boot/compressed/head.S ++ */ ++ ++#include ++#include ++ ++ .set noreorder ++ .cprestore ++ ++ .globl selfreloc_move ++ ++ .text ++ LEAF(selfreloc_start) ++selfreloc_start: ++ /* Save boot rom start args */ ++ move s0, a0 ++ move s1, a1 ++ move s2, a2 ++ move s3, a3 ++ ++ PTR_LI a0, VMLINUZ_LOAD_ADDRESS ++ PTR_LA sp, (.stack + 2048) /* stack address */ ++ ++ PTR_LA ra, 2f ++ PTR_LA k0, selfreloc_move ++ jr k0 ++ nop ++2: ++ move a0, s0 ++ move a1, s1 ++ move a2, s2 ++ move a3, s3 ++ PTR_LI k0, VMLINUZ_LOAD_ADDRESS ++ jr k0 ++ nop ++3: ++ b 3b ++ nop ++ END(selfreloc_start) ++ ++ .globl imgbeg ++imgbeg: .incbin "vmlinuz.bin" ++ .globl imgend ++imgend: ++ ++ .comm .stack,2048,4 +--- /dev/null Thu Jan 6 00:14:26 2011 ++++ arch/mips/boot/compressed/selfreloc2.c Wed Jan 5 23:34:00 2011 +@@ -0,0 +1,39 @@ ++/* written 2011 by Thorsten Glaser */ ++ ++extern unsigned char imgbeg, imgend; ++ ++/* debug interfaces */ ++extern void puts(const char *); ++extern void puthex(unsigned long long); ++ ++void selfreloc_move(unsigned char *); ++ ++/* ++ * Note: we assume we are loaded to VMLINUX_LOAD_ADDRESS, ++ * the range between it and our end-of-file doesn't over- ++ * lap VMLINUZ_LOAD_ADDRESS, we need to relocate the code ++ * there and jump to its first byte. ++ */ ++ ++void ++selfreloc_move(unsigned char *dst /* VMLINUZ_LOAD_ADDRESS */) ++{ ++ unsigned char *src; ++ unsigned long len; ++ ++ puts("in selfreloc_move from "); ++ puthex((unsigned long)&imgbeg); ++ puts(":"); ++ puthex((unsigned long)&imgend); ++ puts(" to "); ++ puthex((unsigned long)dst); ++ puts(" ..."); ++ ++ src = &imgbeg; ++ len = (unsigned long)(&imgend) - (unsigned long)(&imgbeg); ++ ++ while (len--) ++ *dst++ = *src++; ++ ++ puts("done\n"); ++} +--- /home/tg/arch/mips/boot/compressed/Makefile Wed Jan 5 21:26:40 2011 ++++ arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 +@@ -28,12 +28,14 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUIL + targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o + + # decompressor objects (linked with vmlinuz) +-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o ++vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o ++vmlinuz-dbg-objs-y := $(obj)/dbg.o + + ifdef CONFIG_DEBUG_ZBOOT +-vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o +-vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o ++vmlinuz-dbg-objs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o ++vmlinuz-dbg-objs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o + endif ++vmlinuzobjs-y += $(vmlinuz-dbg-objs-y) + + targets += vmlinux.bin + OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S +@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL + vmlinuz.srec: vmlinuz + $(call cmd,objcopy) + +-clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} ++AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) ++arch/mips/boot/compressed/selfreloc1.o: arch/mips/boot/compressed/selfreloc1.S vmlinuz.bin ++ ++CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) ++ ++vmlinub.elf: arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o arch/mips/boot/compressed/selfreloc.lds $(vmlinuz-dbg-objs-y) ++ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o $(vmlinuz-dbg-objs-y) -o $@ ++ ++clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc{{1,2}.o,.lds} +--- /home/tg/arch/mips/Makefile Wed Jan 5 20:26:12 2011 ++++ arch/mips/Makefile Wed Jan 5 22:41:38 2011 +@@ -79,6 +79,7 @@ endif + all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) + all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) + all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz ++all-$(CONFIG_BCM47XX) += vmlinub.elf + + # + # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel +@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: + $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ + + # boot/compressed +-vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE ++vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE + $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ + VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ + +@@ -322,6 +323,7 @@ define archhelp + echo ' vmlinuz.ecoff - ECOFF zboot image' + echo ' vmlinuz.bin - Raw binary zboot image' + echo ' vmlinuz.srec - SREC zboot image' ++ echo ' vmlinub.elf - ELF self-relocating zboot image' + echo + echo ' These will be default as apropriate for a configured platform.' + endef -- cgit v1.2.3 From 259ed65c86100f18cc584cc547413541534f66ff Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 6 Jan 2011 01:51:13 +0100 Subject: Revert "Add experimental code to self-relocate vmlinuz on e.g. brcm" This reverts commit 80d8381811821445bc47cd6e46f1eea423d9fce5. --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 196 --------------------- 1 file changed, 196 deletions(-) delete mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch deleted file mode 100644 index 705bd1dde..000000000 --- a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch +++ /dev/null @@ -1,196 +0,0 @@ ---- /dev/null Thu Jan 6 00:14:18 2011 -+++ arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 -@@ -0,0 +1,39 @@ -+/*- -+ * written 2010 by Thorsten Glaser based on -+ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script -+ */ -+ -+#include -+#include -+#include -+ -+#undef mips -+#define mips mips -+OUTPUT_ARCH(mips) -+ENTRY(selfreloc_start) -+PHDRS { -+ text PT_LOAD FLAGS(7); /* RWX */ -+} -+SECTIONS -+{ -+ . = VMLINUX_LOAD_ADDRESS; -+ .text : { -+ *(.text) -+ *(.text.*) -+ *(.rodata) -+ *(.rodata.*) -+ *(.data) -+ *(.data.*) -+ *(.bss) -+ *(.bss.*) -+ } :text -+ /DISCARD/ : { -+ *(.MIPS.options) -+ *(.options) -+ *(.pdr) -+ *(.reginfo) -+ *(.comment) -+ *(.note) -+ *(.gnu.attributes) -+ } -+} ---- /dev/null Thu Jan 6 00:14:22 2011 -+++ arch/mips/boot/compressed/selfreloc1.S Wed Jan 5 23:22:30 2011 -@@ -0,0 +1,48 @@ -+/*- -+ * written 2011 by Thorsten Glaser based on -+ * arch/mips/boot/compressed/head.S -+ */ -+ -+#include -+#include -+ -+ .set noreorder -+ .cprestore -+ -+ .globl selfreloc_move -+ -+ .text -+ LEAF(selfreloc_start) -+selfreloc_start: -+ /* Save boot rom start args */ -+ move s0, a0 -+ move s1, a1 -+ move s2, a2 -+ move s3, a3 -+ -+ PTR_LI a0, VMLINUZ_LOAD_ADDRESS -+ PTR_LA sp, (.stack + 2048) /* stack address */ -+ -+ PTR_LA ra, 2f -+ PTR_LA k0, selfreloc_move -+ jr k0 -+ nop -+2: -+ move a0, s0 -+ move a1, s1 -+ move a2, s2 -+ move a3, s3 -+ PTR_LI k0, VMLINUZ_LOAD_ADDRESS -+ jr k0 -+ nop -+3: -+ b 3b -+ nop -+ END(selfreloc_start) -+ -+ .globl imgbeg -+imgbeg: .incbin "vmlinuz.bin" -+ .globl imgend -+imgend: -+ -+ .comm .stack,2048,4 ---- /dev/null Thu Jan 6 00:14:26 2011 -+++ arch/mips/boot/compressed/selfreloc2.c Wed Jan 5 23:34:00 2011 -@@ -0,0 +1,39 @@ -+/* written 2011 by Thorsten Glaser */ -+ -+extern unsigned char imgbeg, imgend; -+ -+/* debug interfaces */ -+extern void puts(const char *); -+extern void puthex(unsigned long long); -+ -+void selfreloc_move(unsigned char *); -+ -+/* -+ * Note: we assume we are loaded to VMLINUX_LOAD_ADDRESS, -+ * the range between it and our end-of-file doesn't over- -+ * lap VMLINUZ_LOAD_ADDRESS, we need to relocate the code -+ * there and jump to its first byte. -+ */ -+ -+void -+selfreloc_move(unsigned char *dst /* VMLINUZ_LOAD_ADDRESS */) -+{ -+ unsigned char *src; -+ unsigned long len; -+ -+ puts("in selfreloc_move from "); -+ puthex((unsigned long)&imgbeg); -+ puts(":"); -+ puthex((unsigned long)&imgend); -+ puts(" to "); -+ puthex((unsigned long)dst); -+ puts(" ..."); -+ -+ src = &imgbeg; -+ len = (unsigned long)(&imgend) - (unsigned long)(&imgbeg); -+ -+ while (len--) -+ *dst++ = *src++; -+ -+ puts("done\n"); -+} ---- /home/tg/arch/mips/boot/compressed/Makefile Wed Jan 5 21:26:40 2011 -+++ arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 -@@ -28,12 +28,14 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUIL - targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o - - # decompressor objects (linked with vmlinuz) --vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o -+vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o -+vmlinuz-dbg-objs-y := $(obj)/dbg.o - - ifdef CONFIG_DEBUG_ZBOOT --vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o --vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o -+vmlinuz-dbg-objs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o -+vmlinuz-dbg-objs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o - endif -+vmlinuzobjs-y += $(vmlinuz-dbg-objs-y) - - targets += vmlinux.bin - OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S -@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL - vmlinuz.srec: vmlinuz - $(call cmd,objcopy) - --clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} -+AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) -+arch/mips/boot/compressed/selfreloc1.o: arch/mips/boot/compressed/selfreloc1.S vmlinuz.bin -+ -+CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) -+ -+vmlinub.elf: arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o arch/mips/boot/compressed/selfreloc.lds $(vmlinuz-dbg-objs-y) -+ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o $(vmlinuz-dbg-objs-y) -o $@ -+ -+clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc{{1,2}.o,.lds} ---- /home/tg/arch/mips/Makefile Wed Jan 5 20:26:12 2011 -+++ arch/mips/Makefile Wed Jan 5 22:41:38 2011 -@@ -79,6 +79,7 @@ endif - all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) - all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) - all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz -+all-$(CONFIG_BCM47XX) += vmlinub.elf - - # - # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel -@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: - $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ - - # boot/compressed --vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE -+vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE - $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ - VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ - -@@ -322,6 +323,7 @@ define archhelp - echo ' vmlinuz.ecoff - ECOFF zboot image' - echo ' vmlinuz.bin - Raw binary zboot image' - echo ' vmlinuz.srec - SREC zboot image' -+ echo ' vmlinub.elf - ELF self-relocating zboot image' - echo - echo ' These will be default as apropriate for a configured platform.' - endef -- cgit v1.2.3 From 5bd743ad60b85f005235aac2435563b168e012e3 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Thu, 6 Jan 2011 00:22:34 +0000 Subject: Add experimental code to self-relocate vmlinuz on e.g. brcm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for the following reason: our memory layout looks like this: | |vmlinux | |CFE| * | | | |vmlinuz | | ^ Since CFE can only load to the spot marked with ‘^’ anyway, we load vmlinub.elf there which is basically a big rodata blob containing vmlinuz and minimal code moving it to the location pointed with vmlinuz above. Another solution would be to use CFE’s “boot -raw” to place it on the location marked with ‘*’ above (but the CFE location and size are dynamic, and since it insists on loading to 0x80001000 anyway, this point is virtually moot). Signed-off-by: Thorsten Glaser --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 196 +++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch new file mode 100644 index 000000000..bec8c27d6 --- /dev/null +++ b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch @@ -0,0 +1,196 @@ +--- /dev/null Thu Jan 6 00:14:18 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 +@@ -0,0 +1,39 @@ ++/*- ++ * written 2010 by Thorsten Glaser based on ++ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script ++ */ ++ ++#include ++#include ++#include ++ ++#undef mips ++#define mips mips ++OUTPUT_ARCH(mips) ++ENTRY(selfreloc_start) ++PHDRS { ++ text PT_LOAD FLAGS(7); /* RWX */ ++} ++SECTIONS ++{ ++ . = VMLINUX_LOAD_ADDRESS; ++ .text : { ++ *(.text) ++ *(.text.*) ++ *(.rodata) ++ *(.rodata.*) ++ *(.data) ++ *(.data.*) ++ *(.bss) ++ *(.bss.*) ++ } :text ++ /DISCARD/ : { ++ *(.MIPS.options) ++ *(.options) ++ *(.pdr) ++ *(.reginfo) ++ *(.comment) ++ *(.note) ++ *(.gnu.attributes) ++ } ++} +--- /dev/null Thu Jan 6 00:14:22 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc1.S Wed Jan 5 23:22:30 2011 +@@ -0,0 +1,48 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * arch/mips/boot/compressed/head.S ++ */ ++ ++#include ++#include ++ ++ .set noreorder ++ .cprestore ++ ++ .globl selfreloc_move ++ ++ .text ++ LEAF(selfreloc_start) ++selfreloc_start: ++ /* Save boot rom start args */ ++ move s0, a0 ++ move s1, a1 ++ move s2, a2 ++ move s3, a3 ++ ++ PTR_LI a0, VMLINUZ_LOAD_ADDRESS ++ PTR_LA sp, (.stack + 2048) /* stack address */ ++ ++ PTR_LA ra, 2f ++ PTR_LA k0, selfreloc_move ++ jr k0 ++ nop ++2: ++ move a0, s0 ++ move a1, s1 ++ move a2, s2 ++ move a3, s3 ++ PTR_LI k0, VMLINUZ_LOAD_ADDRESS ++ jr k0 ++ nop ++3: ++ b 3b ++ nop ++ END(selfreloc_start) ++ ++ .globl imgbeg ++imgbeg: .incbin "vmlinuz.bin" ++ .globl imgend ++imgend: ++ ++ .comm .stack,2048,4 +--- /dev/null Thu Jan 6 00:14:26 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc2.c Wed Jan 5 23:34:00 2011 +@@ -0,0 +1,39 @@ ++/* written 2011 by Thorsten Glaser */ ++ ++extern unsigned char imgbeg, imgend; ++ ++/* debug interfaces */ ++extern void puts(const char *); ++extern void puthex(unsigned long long); ++ ++void selfreloc_move(unsigned char *); ++ ++/* ++ * Note: we assume we are loaded to VMLINUX_LOAD_ADDRESS, ++ * the range between it and our end-of-file doesn't over- ++ * lap VMLINUZ_LOAD_ADDRESS, we need to relocate the code ++ * there and jump to its first byte. ++ */ ++ ++void ++selfreloc_move(unsigned char *dst /* VMLINUZ_LOAD_ADDRESS */) ++{ ++ unsigned char *src; ++ unsigned long len; ++ ++ puts("in selfreloc_move from "); ++ puthex((unsigned long)&imgbeg); ++ puts(":"); ++ puthex((unsigned long)&imgend); ++ puts(" to "); ++ puthex((unsigned long)dst); ++ puts(" ..."); ++ ++ src = &imgbeg; ++ len = (unsigned long)(&imgend) - (unsigned long)(&imgbeg); ++ ++ while (len--) ++ *dst++ = *src++; ++ ++ puts("done\n"); ++} +--- linux-2.6.36/arch/mips/boot/compressed/Makefile~ Wed Jan 5 21:26:40 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 +@@ -28,12 +28,14 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUIL + targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o + + # decompressor objects (linked with vmlinuz) +-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o ++vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o ++vmlinuz-dbg-objs-y := $(obj)/dbg.o + + ifdef CONFIG_DEBUG_ZBOOT +-vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o +-vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o ++vmlinuz-dbg-objs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o ++vmlinuz-dbg-objs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o + endif ++vmlinuzobjs-y += $(vmlinuz-dbg-objs-y) + + targets += vmlinux.bin + OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S +@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL + vmlinuz.srec: vmlinuz + $(call cmd,objcopy) + +-clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} ++AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) ++arch/mips/boot/compressed/selfreloc1.o: arch/mips/boot/compressed/selfreloc1.S vmlinuz.bin ++ ++CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) ++ ++vmlinub.elf: arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o arch/mips/boot/compressed/selfreloc.lds $(vmlinuz-dbg-objs-y) ++ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o $(vmlinuz-dbg-objs-y) -o $@ ++ ++clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc{{1,2}.o,.lds} +--- linux-2.6.36/arch/mips/Makefile~ Wed Jan 5 20:26:12 2011 ++++ linux-2.6.36/arch/mips/Makefile Wed Jan 5 22:41:38 2011 +@@ -79,6 +79,7 @@ endif + all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) + all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) + all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz ++all-$(CONFIG_BCM47XX) += vmlinub.elf + + # + # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel +@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: + $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ + + # boot/compressed +-vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE ++vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE + $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ + VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ + +@@ -322,6 +323,7 @@ define archhelp + echo ' vmlinuz.ecoff - ECOFF zboot image' + echo ' vmlinuz.bin - Raw binary zboot image' + echo ' vmlinuz.srec - SREC zboot image' ++ echo ' vmlinub.elf - ELF self-relocating zboot image' + echo + echo ' These will be default as apropriate for a configured platform.' + endef -- cgit v1.2.3 From c4eef4c58ae81bc4b6b2a24842c6a45b79b0665f Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 6 Jan 2011 03:24:52 +0100 Subject: Revert "Add experimental code to self-relocate vmlinuz on e.g. brcm" This reverts commit 5bd743ad60b85f005235aac2435563b168e012e3. --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 196 --------------------- 1 file changed, 196 deletions(-) delete mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch deleted file mode 100644 index bec8c27d6..000000000 --- a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch +++ /dev/null @@ -1,196 +0,0 @@ ---- /dev/null Thu Jan 6 00:14:18 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 -@@ -0,0 +1,39 @@ -+/*- -+ * written 2010 by Thorsten Glaser based on -+ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script -+ */ -+ -+#include -+#include -+#include -+ -+#undef mips -+#define mips mips -+OUTPUT_ARCH(mips) -+ENTRY(selfreloc_start) -+PHDRS { -+ text PT_LOAD FLAGS(7); /* RWX */ -+} -+SECTIONS -+{ -+ . = VMLINUX_LOAD_ADDRESS; -+ .text : { -+ *(.text) -+ *(.text.*) -+ *(.rodata) -+ *(.rodata.*) -+ *(.data) -+ *(.data.*) -+ *(.bss) -+ *(.bss.*) -+ } :text -+ /DISCARD/ : { -+ *(.MIPS.options) -+ *(.options) -+ *(.pdr) -+ *(.reginfo) -+ *(.comment) -+ *(.note) -+ *(.gnu.attributes) -+ } -+} ---- /dev/null Thu Jan 6 00:14:22 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/selfreloc1.S Wed Jan 5 23:22:30 2011 -@@ -0,0 +1,48 @@ -+/*- -+ * written 2011 by Thorsten Glaser based on -+ * arch/mips/boot/compressed/head.S -+ */ -+ -+#include -+#include -+ -+ .set noreorder -+ .cprestore -+ -+ .globl selfreloc_move -+ -+ .text -+ LEAF(selfreloc_start) -+selfreloc_start: -+ /* Save boot rom start args */ -+ move s0, a0 -+ move s1, a1 -+ move s2, a2 -+ move s3, a3 -+ -+ PTR_LI a0, VMLINUZ_LOAD_ADDRESS -+ PTR_LA sp, (.stack + 2048) /* stack address */ -+ -+ PTR_LA ra, 2f -+ PTR_LA k0, selfreloc_move -+ jr k0 -+ nop -+2: -+ move a0, s0 -+ move a1, s1 -+ move a2, s2 -+ move a3, s3 -+ PTR_LI k0, VMLINUZ_LOAD_ADDRESS -+ jr k0 -+ nop -+3: -+ b 3b -+ nop -+ END(selfreloc_start) -+ -+ .globl imgbeg -+imgbeg: .incbin "vmlinuz.bin" -+ .globl imgend -+imgend: -+ -+ .comm .stack,2048,4 ---- /dev/null Thu Jan 6 00:14:26 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/selfreloc2.c Wed Jan 5 23:34:00 2011 -@@ -0,0 +1,39 @@ -+/* written 2011 by Thorsten Glaser */ -+ -+extern unsigned char imgbeg, imgend; -+ -+/* debug interfaces */ -+extern void puts(const char *); -+extern void puthex(unsigned long long); -+ -+void selfreloc_move(unsigned char *); -+ -+/* -+ * Note: we assume we are loaded to VMLINUX_LOAD_ADDRESS, -+ * the range between it and our end-of-file doesn't over- -+ * lap VMLINUZ_LOAD_ADDRESS, we need to relocate the code -+ * there and jump to its first byte. -+ */ -+ -+void -+selfreloc_move(unsigned char *dst /* VMLINUZ_LOAD_ADDRESS */) -+{ -+ unsigned char *src; -+ unsigned long len; -+ -+ puts("in selfreloc_move from "); -+ puthex((unsigned long)&imgbeg); -+ puts(":"); -+ puthex((unsigned long)&imgend); -+ puts(" to "); -+ puthex((unsigned long)dst); -+ puts(" ..."); -+ -+ src = &imgbeg; -+ len = (unsigned long)(&imgend) - (unsigned long)(&imgbeg); -+ -+ while (len--) -+ *dst++ = *src++; -+ -+ puts("done\n"); -+} ---- linux-2.6.36/arch/mips/boot/compressed/Makefile~ Wed Jan 5 21:26:40 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 -@@ -28,12 +28,14 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUIL - targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o - - # decompressor objects (linked with vmlinuz) --vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o -+vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o -+vmlinuz-dbg-objs-y := $(obj)/dbg.o - - ifdef CONFIG_DEBUG_ZBOOT --vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o --vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o -+vmlinuz-dbg-objs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o -+vmlinuz-dbg-objs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o - endif -+vmlinuzobjs-y += $(vmlinuz-dbg-objs-y) - - targets += vmlinux.bin - OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S -@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL - vmlinuz.srec: vmlinuz - $(call cmd,objcopy) - --clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} -+AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) -+arch/mips/boot/compressed/selfreloc1.o: arch/mips/boot/compressed/selfreloc1.S vmlinuz.bin -+ -+CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) -+ -+vmlinub.elf: arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o arch/mips/boot/compressed/selfreloc.lds $(vmlinuz-dbg-objs-y) -+ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc1.o arch/mips/boot/compressed/selfreloc2.o $(vmlinuz-dbg-objs-y) -o $@ -+ -+clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc{{1,2}.o,.lds} ---- linux-2.6.36/arch/mips/Makefile~ Wed Jan 5 20:26:12 2011 -+++ linux-2.6.36/arch/mips/Makefile Wed Jan 5 22:41:38 2011 -@@ -79,6 +79,7 @@ endif - all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) - all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) - all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz -+all-$(CONFIG_BCM47XX) += vmlinub.elf - - # - # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel -@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: - $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ - - # boot/compressed --vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE -+vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE - $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ - VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ - -@@ -322,6 +323,7 @@ define archhelp - echo ' vmlinuz.ecoff - ECOFF zboot image' - echo ' vmlinuz.bin - Raw binary zboot image' - echo ' vmlinuz.srec - SREC zboot image' -+ echo ' vmlinub.elf - ELF self-relocating zboot image' - echo - echo ' These will be default as apropriate for a configured platform.' - endef -- cgit v1.2.3 From f6897b395f6340132ab47a46fe587e8e6ced647a Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Thu, 6 Jan 2011 00:22:10 +0000 Subject: Add experimental code to self-relocate vmlinuz on e.g. brcm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for the following reason: our memory layout looks like this: | |vmlinux | |CFE| * | | | |vmlinuz | | ^ Since CFE can only load to the spot marked with ‘^’ anyway, we load vmlinub.elf there which is basically a big rodata blob containing vmlinuz and minimal code moving it to the location pointed with vmlinuz above. Another solution would be to use CFE’s “boot -raw” to place it on the location marked with ‘*’ above (but the CFE location and size are dynamic, and since it insists on loading to 0x80001000 anyway, this point is virtually moot). Even worse, we probably cannot overwrite CFE space even late, so we move vmlinuz like this: | |vmlinux | |CFE| |vmlinuz | | This way, both “Total memory used by CFE” and “Boot area (physical)” (the latter as mapped into KSEG0) are retained. Signed-off-by: Thorsten Glaser --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 297 +++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch new file mode 100644 index 000000000..62de01b36 --- /dev/null +++ b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch @@ -0,0 +1,297 @@ +--- /dev/null Thu Jan 6 02:10:11 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/invcache.S Thu Jan 6 01:32:57 2011 +@@ -0,0 +1,132 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * code from LZMA-Loader with the following copyright note: ++ * Copyright 2005 Oleg I. Vdovikin ++ * cache manipulation adapted from Broadcom code ++ * idea taken from original bunzip2 decompressor code ++ * Copyright 2004 Manuel Novoa III ++ */ ++ ++/* ++ * This file is supposed to be #include’d where it’s ++ * needed; we will not trash s0, s1, s2, s3. ++ */ ++ ++#define KSEG0 0x80000000 ++ ++#define C0_CONFIG $16 ++#define C0_TAGLO $28 ++#define C0_TAGHI $29 ++ ++#define CONF1_DA_SHIFT 7 /* D$ associativity */ ++#define CONF1_DA_MASK 0x00000380 ++#define CONF1_DA_BASE 1 ++#define CONF1_DL_SHIFT 10 /* D$ line size */ ++#define CONF1_DL_MASK 0x00001c00 ++#define CONF1_DL_BASE 2 ++#define CONF1_DS_SHIFT 13 /* D$ sets/way */ ++#define CONF1_DS_MASK 0x0000e000 ++#define CONF1_DS_BASE 64 ++#define CONF1_IA_SHIFT 16 /* I$ associativity */ ++#define CONF1_IA_MASK 0x00070000 ++#define CONF1_IA_BASE 1 ++#define CONF1_IL_SHIFT 19 /* I$ line size */ ++#define CONF1_IL_MASK 0x00380000 ++#define CONF1_IL_BASE 2 ++#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */ ++#define CONF1_IS_MASK 0x01c00000 ++#define CONF1_IS_BASE 64 ++ ++#define Index_Invalidate_I 0x00 ++#define Index_Writeback_Inv_D 0x01 ++ ++ /* Get cache sizes */ ++ .set mips32 ++ mfc0 s4,C0_CONFIG,1 ++ .set mips0 ++ ++ li s5,CONF1_DL_MASK ++ and s5,s4 ++ beq s5,zero,2f ++ nop ++ ++ srl s5,CONF1_DL_SHIFT ++ li t0,CONF1_DL_BASE ++ sll s5,t0,s5 /* s5 has D$ cache line size */ ++ ++ li s6,CONF1_DA_MASK ++ and s6,s4 ++ srl s6,CONF1_DA_SHIFT ++ addiu s6,CONF1_DA_BASE /* s6 now has D$ associativity */ ++ ++ li t0,CONF1_DS_MASK ++ and t0,s4 ++ srl t0,CONF1_DS_SHIFT ++ li s7,CONF1_DS_BASE ++ sll s7,s7,t0 /* s7 has D$ sets per way */ ++ ++ multu s6,s7 /* sets/way * associativity */ ++ mflo t0 /* total cache lines */ ++ ++ multu s5,t0 /* D$ linesize * lines */ ++ mflo s6 /* s6 is now D$ size in bytes */ ++ ++ /* Initilize the D$: */ ++ mtc0 zero,C0_TAGLO ++ mtc0 zero,C0_TAGHI ++ ++ li t0,KSEG0 /* Just an address for the first $ line */ ++ addu t1,t0,s6 /* + size of cache == end */ ++ ++ .set mips3 ++1: cache Index_Writeback_Inv_D,0(t0) ++ .set mips0 ++ bne t0,t1,1b ++ addu t0,s5 ++ ++2: ++ /* Now we get to do it all again for the I$ */ ++ ++ move s7,zero /* just in case there is no icache */ ++ move t8,zero ++ ++ li t0,CONF1_IL_MASK ++ and t0,s4 ++ beq t0,zero,3f ++ nop ++ ++ srl t0,CONF1_IL_SHIFT ++ li s7,CONF1_IL_BASE ++ sll s7,t0 /* s7 has I$ cache line size */ ++ ++ li t0,CONF1_IA_MASK ++ and t0,s4 ++ srl t0,CONF1_IA_SHIFT ++ addiu t8,t0,CONF1_IA_BASE /* t8 now has I$ associativity */ ++ ++ li t0,CONF1_IS_MASK ++ and t0,s4 ++ srl t0,CONF1_IS_SHIFT ++ li t9,CONF1_IS_BASE ++ sll t9,t0 /* t9 has I$ sets per way */ ++ ++ multu t8,t9 /* sets/way * associativity */ ++ mflo t0 /* t8 is now total cache lines */ ++ ++ multu s7,t0 /* I$ linesize * lines */ ++ mflo t8 /* t8 is cache size in bytes */ ++ ++ /* Initilize the I$: */ ++ mtc0 zero,C0_TAGLO ++ mtc0 zero,C0_TAGHI ++ ++ li t0,KSEG0 /* Just an address for the first $ line */ ++ addu t1,t0,t8 /* + size of cache == end */ ++ ++ .set mips3 ++1: cache Index_Invalidate_I,0(t0) ++ .set mips0 ++ bne t0,t1,1b ++ addu t0,s7 ++ ++3: +--- /dev/null Thu Jan 6 00:14:18 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 +@@ -0,0 +1,39 @@ ++/*- ++ * written 2010 by Thorsten Glaser based on ++ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script ++ */ ++ ++#include ++#include ++#include ++ ++#undef mips ++#define mips mips ++OUTPUT_ARCH(mips) ++ENTRY(selfreloc_start) ++PHDRS { ++ text PT_LOAD FLAGS(7); /* RWX */ ++} ++SECTIONS ++{ ++ . = VMLINUX_LOAD_ADDRESS; ++ .text : { ++ *(.text) ++ *(.text.*) ++ *(.rodata) ++ *(.rodata.*) ++ *(.data) ++ *(.data.*) ++ *(.bss) ++ *(.bss.*) ++ } :text ++ /DISCARD/ : { ++ *(.MIPS.options) ++ *(.options) ++ *(.pdr) ++ *(.reginfo) ++ *(.comment) ++ *(.note) ++ *(.gnu.attributes) ++ } ++} +--- /dev/null Thu Jan 6 02:10:14 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.S Thu Jan 6 01:21:44 2011 +@@ -0,0 +1,60 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * arch/mips/boot/compressed/head.S and code from LZMA-Loader ++ */ ++ ++#include ++#include ++ ++ .set noreorder ++ .cprestore ++ ++ .text ++ LEAF(selfreloc_start) ++selfreloc_start: ++ /* Save boot rom start args */ ++ move s0, a0 ++ move s1, a1 ++ move s2, a2 ++ move s3, a3 ++ ++ /* Copy code to the correct place */ ++ PTR_LI a0, VMLINUZ_LOAD_ADDRESS ++ PTR_LA a1, imgbeg ++ PTR_LA a2, imgend ++1: lw t0, 0(a1) ++ sw t0, 0(a0) ++ add a1, 4 ++ add a0, 4 ++ blt a1, a2, 1b ++ nop ++ ++ /* ++ * At this point we need to invalidate dcache and ++ * icache before jumping to the new code ++ */ ++/* #include "invcache.S" // since this may work only on brcm? */ ++ ++ /* Restore boot rom start args */ ++ move a0, s0 ++ move a1, s1 ++ move a2, s2 ++ move a3, s3 ++ ++ /* Jump to the code at its new location */ ++ PTR_LI k0, VMLINUZ_LOAD_ADDRESS ++ jr k0 ++ nop ++ ++ /* Just in case we come back… */ ++3: ++ b 3b ++ nop ++ END(selfreloc_start) ++ ++ .globl imgbeg ++ .p2align 2 ++imgbeg: .incbin "vmlinuz.bin" ++ .globl imgend ++ .p2align 2 ++imgend: +--- linux-2.6.36/arch/mips/boot/compressed/Makefile~ Wed Jan 5 21:26:40 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 +@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL + vmlinuz.srec: vmlinuz + $(call cmd,objcopy) + +-clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} ++AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) ++arch/mips/boot/compressed/selfreloc.o: arch/mips/boot/compressed/selfreloc.S vmlinuz.bin arch/mips/boot/compressed/invcache.S ++ ++CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) ++ ++vmlinub.elf: arch/mips/boot/compressed/selfreloc.oarch/mips/boot/compressed/selfreloc.lds ++ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc.o -o $@ ++ ++clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc.{o,lds} +--- linux-2.6.36/arch/mips/Makefile~ Wed Jan 5 20:26:12 2011 ++++ linux-2.6.36/arch/mips/Makefile Wed Jan 5 22:41:38 2011 +@@ -62,8 +62,13 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vm + # Calculate the load address of the compressed kernel image + hostprogs-y := calc_vmlinuz_load_addr + ++ifdef CONFIG_BCM47XX ++# XXX just after CFE, just pray the address is static ++VMLINUZ_LOAD_ADDRESS = 0xffffffff80480000 ++else + VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ + $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) ++endif + + vmlinuzobjs-y += $(obj)/piggy.o + +@@ -79,6 +79,7 @@ endif + all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) + all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) + all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz ++all-$(CONFIG_BCM47XX) += vmlinub.elf + + # + # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel +@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: + $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ + + # boot/compressed +-vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE ++vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE + $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ + VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ + +@@ -322,6 +323,7 @@ define archhelp + echo ' vmlinuz.ecoff - ECOFF zboot image' + echo ' vmlinuz.bin - Raw binary zboot image' + echo ' vmlinuz.srec - SREC zboot image' ++ echo ' vmlinub.elf - ELF self-relocating zboot image' + echo + echo ' These will be default as apropriate for a configured platform.' + endef -- cgit v1.2.3 From 2ab8ae9946dd47a88089844e42140a83a0061758 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 6 Jan 2011 03:29:53 +0100 Subject: Revert "Add experimental code to self-relocate vmlinuz on e.g. brcm" This reverts commit f6897b395f6340132ab47a46fe587e8e6ced647a. --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 297 --------------------- 1 file changed, 297 deletions(-) delete mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch deleted file mode 100644 index 62de01b36..000000000 --- a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch +++ /dev/null @@ -1,297 +0,0 @@ ---- /dev/null Thu Jan 6 02:10:11 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/invcache.S Thu Jan 6 01:32:57 2011 -@@ -0,0 +1,132 @@ -+/*- -+ * written 2011 by Thorsten Glaser based on -+ * code from LZMA-Loader with the following copyright note: -+ * Copyright 2005 Oleg I. Vdovikin -+ * cache manipulation adapted from Broadcom code -+ * idea taken from original bunzip2 decompressor code -+ * Copyright 2004 Manuel Novoa III -+ */ -+ -+/* -+ * This file is supposed to be #include’d where it’s -+ * needed; we will not trash s0, s1, s2, s3. -+ */ -+ -+#define KSEG0 0x80000000 -+ -+#define C0_CONFIG $16 -+#define C0_TAGLO $28 -+#define C0_TAGHI $29 -+ -+#define CONF1_DA_SHIFT 7 /* D$ associativity */ -+#define CONF1_DA_MASK 0x00000380 -+#define CONF1_DA_BASE 1 -+#define CONF1_DL_SHIFT 10 /* D$ line size */ -+#define CONF1_DL_MASK 0x00001c00 -+#define CONF1_DL_BASE 2 -+#define CONF1_DS_SHIFT 13 /* D$ sets/way */ -+#define CONF1_DS_MASK 0x0000e000 -+#define CONF1_DS_BASE 64 -+#define CONF1_IA_SHIFT 16 /* I$ associativity */ -+#define CONF1_IA_MASK 0x00070000 -+#define CONF1_IA_BASE 1 -+#define CONF1_IL_SHIFT 19 /* I$ line size */ -+#define CONF1_IL_MASK 0x00380000 -+#define CONF1_IL_BASE 2 -+#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */ -+#define CONF1_IS_MASK 0x01c00000 -+#define CONF1_IS_BASE 64 -+ -+#define Index_Invalidate_I 0x00 -+#define Index_Writeback_Inv_D 0x01 -+ -+ /* Get cache sizes */ -+ .set mips32 -+ mfc0 s4,C0_CONFIG,1 -+ .set mips0 -+ -+ li s5,CONF1_DL_MASK -+ and s5,s4 -+ beq s5,zero,2f -+ nop -+ -+ srl s5,CONF1_DL_SHIFT -+ li t0,CONF1_DL_BASE -+ sll s5,t0,s5 /* s5 has D$ cache line size */ -+ -+ li s6,CONF1_DA_MASK -+ and s6,s4 -+ srl s6,CONF1_DA_SHIFT -+ addiu s6,CONF1_DA_BASE /* s6 now has D$ associativity */ -+ -+ li t0,CONF1_DS_MASK -+ and t0,s4 -+ srl t0,CONF1_DS_SHIFT -+ li s7,CONF1_DS_BASE -+ sll s7,s7,t0 /* s7 has D$ sets per way */ -+ -+ multu s6,s7 /* sets/way * associativity */ -+ mflo t0 /* total cache lines */ -+ -+ multu s5,t0 /* D$ linesize * lines */ -+ mflo s6 /* s6 is now D$ size in bytes */ -+ -+ /* Initilize the D$: */ -+ mtc0 zero,C0_TAGLO -+ mtc0 zero,C0_TAGHI -+ -+ li t0,KSEG0 /* Just an address for the first $ line */ -+ addu t1,t0,s6 /* + size of cache == end */ -+ -+ .set mips3 -+1: cache Index_Writeback_Inv_D,0(t0) -+ .set mips0 -+ bne t0,t1,1b -+ addu t0,s5 -+ -+2: -+ /* Now we get to do it all again for the I$ */ -+ -+ move s7,zero /* just in case there is no icache */ -+ move t8,zero -+ -+ li t0,CONF1_IL_MASK -+ and t0,s4 -+ beq t0,zero,3f -+ nop -+ -+ srl t0,CONF1_IL_SHIFT -+ li s7,CONF1_IL_BASE -+ sll s7,t0 /* s7 has I$ cache line size */ -+ -+ li t0,CONF1_IA_MASK -+ and t0,s4 -+ srl t0,CONF1_IA_SHIFT -+ addiu t8,t0,CONF1_IA_BASE /* t8 now has I$ associativity */ -+ -+ li t0,CONF1_IS_MASK -+ and t0,s4 -+ srl t0,CONF1_IS_SHIFT -+ li t9,CONF1_IS_BASE -+ sll t9,t0 /* t9 has I$ sets per way */ -+ -+ multu t8,t9 /* sets/way * associativity */ -+ mflo t0 /* t8 is now total cache lines */ -+ -+ multu s7,t0 /* I$ linesize * lines */ -+ mflo t8 /* t8 is cache size in bytes */ -+ -+ /* Initilize the I$: */ -+ mtc0 zero,C0_TAGLO -+ mtc0 zero,C0_TAGHI -+ -+ li t0,KSEG0 /* Just an address for the first $ line */ -+ addu t1,t0,t8 /* + size of cache == end */ -+ -+ .set mips3 -+1: cache Index_Invalidate_I,0(t0) -+ .set mips0 -+ bne t0,t1,1b -+ addu t0,s7 -+ -+3: ---- /dev/null Thu Jan 6 00:14:18 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 -@@ -0,0 +1,39 @@ -+/*- -+ * written 2010 by Thorsten Glaser based on -+ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script -+ */ -+ -+#include -+#include -+#include -+ -+#undef mips -+#define mips mips -+OUTPUT_ARCH(mips) -+ENTRY(selfreloc_start) -+PHDRS { -+ text PT_LOAD FLAGS(7); /* RWX */ -+} -+SECTIONS -+{ -+ . = VMLINUX_LOAD_ADDRESS; -+ .text : { -+ *(.text) -+ *(.text.*) -+ *(.rodata) -+ *(.rodata.*) -+ *(.data) -+ *(.data.*) -+ *(.bss) -+ *(.bss.*) -+ } :text -+ /DISCARD/ : { -+ *(.MIPS.options) -+ *(.options) -+ *(.pdr) -+ *(.reginfo) -+ *(.comment) -+ *(.note) -+ *(.gnu.attributes) -+ } -+} ---- /dev/null Thu Jan 6 02:10:14 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.S Thu Jan 6 01:21:44 2011 -@@ -0,0 +1,60 @@ -+/*- -+ * written 2011 by Thorsten Glaser based on -+ * arch/mips/boot/compressed/head.S and code from LZMA-Loader -+ */ -+ -+#include -+#include -+ -+ .set noreorder -+ .cprestore -+ -+ .text -+ LEAF(selfreloc_start) -+selfreloc_start: -+ /* Save boot rom start args */ -+ move s0, a0 -+ move s1, a1 -+ move s2, a2 -+ move s3, a3 -+ -+ /* Copy code to the correct place */ -+ PTR_LI a0, VMLINUZ_LOAD_ADDRESS -+ PTR_LA a1, imgbeg -+ PTR_LA a2, imgend -+1: lw t0, 0(a1) -+ sw t0, 0(a0) -+ add a1, 4 -+ add a0, 4 -+ blt a1, a2, 1b -+ nop -+ -+ /* -+ * At this point we need to invalidate dcache and -+ * icache before jumping to the new code -+ */ -+/* #include "invcache.S" // since this may work only on brcm? */ -+ -+ /* Restore boot rom start args */ -+ move a0, s0 -+ move a1, s1 -+ move a2, s2 -+ move a3, s3 -+ -+ /* Jump to the code at its new location */ -+ PTR_LI k0, VMLINUZ_LOAD_ADDRESS -+ jr k0 -+ nop -+ -+ /* Just in case we come back… */ -+3: -+ b 3b -+ nop -+ END(selfreloc_start) -+ -+ .globl imgbeg -+ .p2align 2 -+imgbeg: .incbin "vmlinuz.bin" -+ .globl imgend -+ .p2align 2 -+imgend: ---- linux-2.6.36/arch/mips/boot/compressed/Makefile~ Wed Jan 5 21:26:40 2011 -+++ linux-2.6.36/arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 -@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL - vmlinuz.srec: vmlinuz - $(call cmd,objcopy) - --clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} -+AFLAGS_selfreloc1.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) -+arch/mips/boot/compressed/selfreloc.o: arch/mips/boot/compressed/selfreloc.S vmlinuz.bin arch/mips/boot/compressed/invcache.S -+ -+CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) -+ -+vmlinub.elf: arch/mips/boot/compressed/selfreloc.oarch/mips/boot/compressed/selfreloc.lds -+ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc.o -o $@ -+ -+clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc.{o,lds} ---- linux-2.6.36/arch/mips/Makefile~ Wed Jan 5 20:26:12 2011 -+++ linux-2.6.36/arch/mips/Makefile Wed Jan 5 22:41:38 2011 -@@ -62,8 +62,13 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vm - # Calculate the load address of the compressed kernel image - hostprogs-y := calc_vmlinuz_load_addr - -+ifdef CONFIG_BCM47XX -+# XXX just after CFE, just pray the address is static -+VMLINUZ_LOAD_ADDRESS = 0xffffffff80480000 -+else - VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ - $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) -+endif - - vmlinuzobjs-y += $(obj)/piggy.o - -@@ -79,6 +79,7 @@ endif - all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) - all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) - all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz -+all-$(CONFIG_BCM47XX) += vmlinub.elf - - # - # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel -@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: - $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ - - # boot/compressed --vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE -+vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE - $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ - VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ - -@@ -322,6 +323,7 @@ define archhelp - echo ' vmlinuz.ecoff - ECOFF zboot image' - echo ' vmlinuz.bin - Raw binary zboot image' - echo ' vmlinuz.srec - SREC zboot image' -+ echo ' vmlinub.elf - ELF self-relocating zboot image' - echo - echo ' These will be default as apropriate for a configured platform.' - endef -- cgit v1.2.3 From 88d3e6d6c572143bd95a589a44e30bfefd616b88 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Thu, 6 Jan 2011 00:21:46 +0000 Subject: Add experimental code to self-relocate vmlinuz on e.g. brcm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for the following reason: our memory layout looks like this: | |vmlinux | |CFE| * | | | |vmlinuz | | ^ Since CFE can only load to the spot marked with ‘^’ anyway, we load vmlinub.elf there which is basically a big rodata blob containing vmlinuz and minimal code moving it to the location pointed with vmlinuz above. Another solution would be to use CFE’s “boot -raw” to place it on the location marked with ‘*’ above (but the CFE location and size are dynamic, and since it insists on loading to 0x80001000 anyway, this point is virtually moot). Even worse, we probably cannot overwrite CFE space even late, so we move vmlinuz like this: | |vmlinux | |CFE| |vmlinuz | | This way, both “Total memory used by CFE” and “Boot area (physical)” (the latter as mapped into KSEG0) are retained. Signed-off-by: Thorsten Glaser --- target/linux/patches/2.6.36/zboot-brcm-reloc.patch | 297 +++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 target/linux/patches/2.6.36/zboot-brcm-reloc.patch (limited to 'target') diff --git a/target/linux/patches/2.6.36/zboot-brcm-reloc.patch b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch new file mode 100644 index 000000000..2ff2cce15 --- /dev/null +++ b/target/linux/patches/2.6.36/zboot-brcm-reloc.patch @@ -0,0 +1,297 @@ +--- /dev/null Thu Jan 6 02:10:11 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/invcache.S Thu Jan 6 01:32:57 2011 +@@ -0,0 +1,132 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * code from LZMA-Loader with the following copyright note: ++ * Copyright 2005 Oleg I. Vdovikin ++ * cache manipulation adapted from Broadcom code ++ * idea taken from original bunzip2 decompressor code ++ * Copyright 2004 Manuel Novoa III ++ */ ++ ++/* ++ * This file is supposed to be #include’d where it’s ++ * needed; we will not trash s0, s1, s2, s3. ++ */ ++ ++#define KSEG0 0x80000000 ++ ++#define C0_CONFIG $16 ++#define C0_TAGLO $28 ++#define C0_TAGHI $29 ++ ++#define CONF1_DA_SHIFT 7 /* D$ associativity */ ++#define CONF1_DA_MASK 0x00000380 ++#define CONF1_DA_BASE 1 ++#define CONF1_DL_SHIFT 10 /* D$ line size */ ++#define CONF1_DL_MASK 0x00001c00 ++#define CONF1_DL_BASE 2 ++#define CONF1_DS_SHIFT 13 /* D$ sets/way */ ++#define CONF1_DS_MASK 0x0000e000 ++#define CONF1_DS_BASE 64 ++#define CONF1_IA_SHIFT 16 /* I$ associativity */ ++#define CONF1_IA_MASK 0x00070000 ++#define CONF1_IA_BASE 1 ++#define CONF1_IL_SHIFT 19 /* I$ line size */ ++#define CONF1_IL_MASK 0x00380000 ++#define CONF1_IL_BASE 2 ++#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */ ++#define CONF1_IS_MASK 0x01c00000 ++#define CONF1_IS_BASE 64 ++ ++#define Index_Invalidate_I 0x00 ++#define Index_Writeback_Inv_D 0x01 ++ ++ /* Get cache sizes */ ++ .set mips32 ++ mfc0 s4,C0_CONFIG,1 ++ .set mips0 ++ ++ li s5,CONF1_DL_MASK ++ and s5,s4 ++ beq s5,zero,2f ++ nop ++ ++ srl s5,CONF1_DL_SHIFT ++ li t0,CONF1_DL_BASE ++ sll s5,t0,s5 /* s5 has D$ cache line size */ ++ ++ li s6,CONF1_DA_MASK ++ and s6,s4 ++ srl s6,CONF1_DA_SHIFT ++ addiu s6,CONF1_DA_BASE /* s6 now has D$ associativity */ ++ ++ li t0,CONF1_DS_MASK ++ and t0,s4 ++ srl t0,CONF1_DS_SHIFT ++ li s7,CONF1_DS_BASE ++ sll s7,s7,t0 /* s7 has D$ sets per way */ ++ ++ multu s6,s7 /* sets/way * associativity */ ++ mflo t0 /* total cache lines */ ++ ++ multu s5,t0 /* D$ linesize * lines */ ++ mflo s6 /* s6 is now D$ size in bytes */ ++ ++ /* Initilize the D$: */ ++ mtc0 zero,C0_TAGLO ++ mtc0 zero,C0_TAGHI ++ ++ li t0,KSEG0 /* Just an address for the first $ line */ ++ addu t1,t0,s6 /* + size of cache == end */ ++ ++ .set mips3 ++1: cache Index_Writeback_Inv_D,0(t0) ++ .set mips0 ++ bne t0,t1,1b ++ addu t0,s5 ++ ++2: ++ /* Now we get to do it all again for the I$ */ ++ ++ move s7,zero /* just in case there is no icache */ ++ move t8,zero ++ ++ li t0,CONF1_IL_MASK ++ and t0,s4 ++ beq t0,zero,3f ++ nop ++ ++ srl t0,CONF1_IL_SHIFT ++ li s7,CONF1_IL_BASE ++ sll s7,t0 /* s7 has I$ cache line size */ ++ ++ li t0,CONF1_IA_MASK ++ and t0,s4 ++ srl t0,CONF1_IA_SHIFT ++ addiu t8,t0,CONF1_IA_BASE /* t8 now has I$ associativity */ ++ ++ li t0,CONF1_IS_MASK ++ and t0,s4 ++ srl t0,CONF1_IS_SHIFT ++ li t9,CONF1_IS_BASE ++ sll t9,t0 /* t9 has I$ sets per way */ ++ ++ multu t8,t9 /* sets/way * associativity */ ++ mflo t0 /* t8 is now total cache lines */ ++ ++ multu s7,t0 /* I$ linesize * lines */ ++ mflo t8 /* t8 is cache size in bytes */ ++ ++ /* Initilize the I$: */ ++ mtc0 zero,C0_TAGLO ++ mtc0 zero,C0_TAGHI ++ ++ li t0,KSEG0 /* Just an address for the first $ line */ ++ addu t1,t0,t8 /* + size of cache == end */ ++ ++ .set mips3 ++1: cache Index_Invalidate_I,0(t0) ++ .set mips0 ++ bne t0,t1,1b ++ addu t0,s7 ++ ++3: +--- /dev/null Thu Jan 6 00:14:18 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.lds.S Wed Jan 5 23:52:43 2011 +@@ -0,0 +1,39 @@ ++/*- ++ * written 2010 by Thorsten Glaser based on ++ * arch/mips/kernel/vmlinux.lds and arch/mips/boot/compressed/ld.script ++ */ ++ ++#include ++#include ++#include ++ ++#undef mips ++#define mips mips ++OUTPUT_ARCH(mips) ++ENTRY(selfreloc_start) ++PHDRS { ++ text PT_LOAD FLAGS(7); /* RWX */ ++} ++SECTIONS ++{ ++ . = VMLINUX_LOAD_ADDRESS; ++ .text : { ++ *(.text) ++ *(.text.*) ++ *(.rodata) ++ *(.rodata.*) ++ *(.data) ++ *(.data.*) ++ *(.bss) ++ *(.bss.*) ++ } :text ++ /DISCARD/ : { ++ *(.MIPS.options) ++ *(.options) ++ *(.pdr) ++ *(.reginfo) ++ *(.comment) ++ *(.note) ++ *(.gnu.attributes) ++ } ++} +--- /dev/null Thu Jan 6 02:10:14 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/selfreloc.S Thu Jan 6 01:21:44 2011 +@@ -0,0 +1,60 @@ ++/*- ++ * written 2011 by Thorsten Glaser based on ++ * arch/mips/boot/compressed/head.S and code from LZMA-Loader ++ */ ++ ++#include ++#include ++ ++ .set noreorder ++ .cprestore ++ ++ .text ++ LEAF(selfreloc_start) ++selfreloc_start: ++ /* Save boot rom start args */ ++ move s0, a0 ++ move s1, a1 ++ move s2, a2 ++ move s3, a3 ++ ++ /* Copy code to the correct place */ ++ PTR_LI a0, VMLINUZ_LOAD_ADDRESS ++ PTR_LA a1, imgbeg ++ PTR_LA a2, imgend ++1: lw t0, 0(a1) ++ sw t0, 0(a0) ++ add a1, 4 ++ add a0, 4 ++ blt a1, a2, 1b ++ nop ++ ++ /* ++ * At this point we need to invalidate dcache and ++ * icache before jumping to the new code ++ */ ++/* #include "invcache.S" // since this may work only on brcm? */ ++ ++ /* Restore boot rom start args */ ++ move a0, s0 ++ move a1, s1 ++ move a2, s2 ++ move a3, s3 ++ ++ /* Jump to the code at its new location */ ++ PTR_LI k0, VMLINUZ_LOAD_ADDRESS ++ jr k0 ++ nop ++ ++ /* Just in case we come back… */ ++3: ++ b 3b ++ nop ++ END(selfreloc_start) ++ ++ .globl imgbeg ++ .p2align 2 ++imgbeg: .incbin "vmlinuz.bin" ++ .globl imgend ++ .p2align 2 ++imgend: +--- linux-2.6.36/arch/mips/boot/compressed/Makefile~ Wed Jan 5 21:26:40 2011 ++++ linux-2.6.36/arch/mips/boot/compressed/Makefile Wed Jan 5 23:35:58 2011 +@@ -62,8 +62,13 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vm + # Calculate the load address of the compressed kernel image + hostprogs-y := calc_vmlinuz_load_addr + ++ifdef CONFIG_BCM47XX ++# XXX just after CFE, just pray the address is static ++VMLINUZ_LOAD_ADDRESS = 0xffffffff80480000 ++else + VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ + $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) ++endif + + vmlinuzobjs-y += $(obj)/piggy.o + +@@ -106,4 +107,12 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL + vmlinuz.srec: vmlinuz + $(call cmd,objcopy) + +-clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} ++AFLAGS_selfreloc.o := -DVMLINUZ_LOAD_ADDRESS=$(VMLINUZ_LOAD_ADDRESS) ++arch/mips/boot/compressed/selfreloc.o: arch/mips/boot/compressed/selfreloc.S vmlinuz.bin arch/mips/boot/compressed/invcache.S ++ ++CPPFLAGS_selfreloc.lds := $(KBUILD_CFLAGS) ++ ++vmlinub.elf: arch/mips/boot/compressed/selfreloc.o arch/mips/boot/compressed/selfreloc.lds ++ $(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc.o -o $@ ++ ++clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} $(objtree)/vmlinub.elf $(objtree)/arch/mips/boot/compressed/selfreloc.{o,lds} +--- linux-2.6.36/arch/mips/Makefile~ Wed Jan 5 20:26:12 2011 ++++ linux-2.6.36/arch/mips/Makefile Wed Jan 5 22:41:38 2011 +@@ -79,6 +79,7 @@ endif + all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) + all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) + all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz ++all-$(CONFIG_BCM47XX) += vmlinub.elf + + # + # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel +@@ -285,7 +286,7 @@ vmlinux.bin vmlinux.ecoff vmlinux.srec: + $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ + + # boot/compressed +-vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE ++vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec vmlinub.elf: $(vmlinux-32) FORCE + $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ + VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ + +@@ -322,6 +323,7 @@ define archhelp + echo ' vmlinuz.ecoff - ECOFF zboot image' + echo ' vmlinuz.bin - Raw binary zboot image' + echo ' vmlinuz.srec - SREC zboot image' ++ echo ' vmlinub.elf - ELF self-relocating zboot image' + echo + echo ' These will be default as apropriate for a configured platform.' + endef -- cgit v1.2.3 From b944726b75e18b624bb92e1e4eaa2dafc8d118e0 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 26 Jan 2011 20:23:03 +0100 Subject: some usb fixes, wrong controller choosen. (and some more minor changes) --- target/linux/config/Config.in.misc | 7 +------ target/linux/config/Config.in.usb | 40 +++++++++++++++++++----------------- target/packages/pkg-available/laptop | 8 -------- 3 files changed, 22 insertions(+), 33 deletions(-) (limited to 'target') diff --git a/target/linux/config/Config.in.misc b/target/linux/config/Config.in.misc index f936f39be..8acd0dabe 100644 --- a/target/linux/config/Config.in.misc +++ b/target/linux/config/Config.in.misc @@ -1,9 +1,3 @@ -#config ADK_LINUX_INITRAMFS_BUILTIN -# select ADK_KERNEL_BLK_DEV_INITRD -# select ADK_KERNEL_INITRAMFS_COMPRESSION_NONE -# boolean -# default n - config ADK_KERNEL_RFKILL boolean @@ -46,6 +40,7 @@ config ADK_KERNEL_RTC_DRV_CMOS default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13 default y if ADK_TARGET_SYSTEM_IBM_X40 default n + depends on (ADK_TARGET_SYSTEM_PCENGINES_ALIX1C || ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13 || ADK_TARGET_SYSTEM_IBM_X40) help PC CMOS RTC support. diff --git a/target/linux/config/Config.in.usb b/target/linux/config/Config.in.usb index 07a97ae24..52eb92864 100644 --- a/target/linux/config/Config.in.usb +++ b/target/linux/config/Config.in.usb @@ -1,35 +1,37 @@ menu "USB support" depends on ADK_TARGET_WITH_USB +config ADK_KERNEL_USB + boolean + config ADK_KERNEL_USB_LIBUSUAL tristate config ADK_KERNEL_USB_SERIAL boolean -config ADK_KERNEL_USB - boolean - config ADK_KERNEL_USB_STORAGE boolean config ADK_KERNEL_USB_EHCI_HCD boolean + select ADK_PACKAGE_KMOD_USB_CONTROLLER config ADK_KERNEL_USB_UHCI_HCD boolean + select ADK_PACKAGE_KMOD_USB_CONTROLLER config ADK_KPACKAGE_KMOD_USB prompt "kmod-usb......................... USB support" tristate + select ADK_KERNEL_NLS + depends on !ADK_KERNEL_USB default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D2 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13 default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 default n - depends on !ADK_KERNEL_USB - select ADK_KERNEL_NLS help Universal Serial Bus (USB) is a specification for a serial bus subsystem which offers higher speeds and more features than the @@ -62,10 +64,12 @@ config ADK_KPACKAGE_KMOD_USB config ADK_KPACKAGE_KMOD_USB_UHCI_HCD prompt "kmod-usb-uhci................... Support for UHCI controllers" tristate + select ADK_PACKAGE_KMOD_USB_CONTROLLER depends on ADK_KPACKAGE_KMOD_USB depends on !ADK_KERNEL_USB_UHCI_HCD depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - select ADK_PACKAGE_KMOD_USB_CONTROLLER + default y if ADK_TARGET_SYSTEM_IBM_X40 + default n help The Universal Host Controller Interface is a standard by Intel for accessing the USB hardware in the PC (which is also called the USB @@ -79,15 +83,13 @@ config ADK_KPACKAGE_KMOD_USB_UHCI_HCD config ADK_KPACKAGE_KMOD_USB_OHCI_HCD prompt "kmod-usb-ohci................... Support for OHCI controllers" tristate + select ADK_PACKAGE_KMOD_USB_CONTROLLER + depends on ADK_KPACKAGE_KMOD_USB + depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D2 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13 - default y if ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - default y if ADK_TARGET_SYSTEM_IBM_X40 default n - depends on ADK_KPACKAGE_KMOD_USB - depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - select ADK_PACKAGE_KMOD_USB_CONTROLLER help The Open Host Controller Interface (OHCI) is a standard for accessing USB 1.1 host controller hardware. It does more in hardware than Intel's @@ -101,10 +103,10 @@ config ADK_KPACKAGE_KMOD_USB_OHCI_HCD config ADK_KPACKAGE_KMOD_USB_ISP116X_HCD prompt "kmod-usb-isp116x................ ISP116X HCD support" tristate - default n + select ADK_PACKAGE_KMOD_USB_CONTROLLER depends on ADK_KPACKAGE_KMOD_USB depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - select ADK_PACKAGE_KMOD_USB_CONTROLLER + default n help The ISP1160 and ISP1161 chips are USB host controllers. Enable this option if your board has this chip. If unsure, say N. @@ -114,10 +116,10 @@ config ADK_KPACKAGE_KMOD_USB_ISP116X_HCD config ADK_KPACKAGE_KMOD_USB_SL811_HCD prompt "kmod-usb-sl811.................. SL811HS HCD support" tristate - default n + select ADK_PACKAGE_KMOD_USB_CONTROLLER depends on ADK_KPACKAGE_KMOD_USB depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - select ADK_PACKAGE_KMOD_USB_CONTROLLER + default n help The SL811HS is a single-port USB controller that supports either host side or peripheral side roles. Enable this option if your @@ -128,15 +130,15 @@ config ADK_KPACKAGE_KMOD_USB_SL811_HCD config ADK_KPACKAGE_KMOD_USB_EHCI_HCD prompt "kmod-usb-ehci................... Support for USB 2.0 controllers" tristate + select ADK_PACKAGE_KMOD_USB_CONTROLLER depends on !ADK_KERNEL_USB_EHCI_HCD + depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 + depends on ADK_KPACKAGE_KMOD_USB default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D2 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13 default y if ADK_TARGET_SYSTEM_IBM_X40 default n - depends on !ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 - depends on ADK_KPACKAGE_KMOD_USB - select ADK_PACKAGE_KMOD_USB_CONTROLLER help The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0 "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware. @@ -158,7 +160,7 @@ config ADK_KPACKAGE_KMOD_USB_EHCI_HCD config ADK_PACKAGE_KMOD_USB_CONTROLLER tristate - depends on ADK_KPACKAGE_KMOD_USB_UHCI_HCD || ADK_KPACKAGE_KMOD_USB_OHCI_HCD || ADK_KPACKAGE_KMOD_EHCI_HCD + default y if ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20 default n config ADK_KPACKAGE_KMOD_USB_ACM diff --git a/target/packages/pkg-available/laptop b/target/packages/pkg-available/laptop index 1d0185550..9663690fe 100644 --- a/target/packages/pkg-available/laptop +++ b/target/packages/pkg-available/laptop @@ -1,19 +1,11 @@ config ADK_PKG_LAPTOP bool "Choose packages for a laptop system with X" default n - select ADK_KPACKAGE_KMOD_PCMCIA - select ADK_KPACKAGE_KMOD_PCCARD - select ADK_KPACKAGE_KMOD_SERIAL_8250_CS select ADK_PACKAGE_SCREEN select ADK_PACKAGE_VIM select ADK_PACKAGE_SUDO select ADK_PACKAGE_KEYCHAIN - select ADK_PACKAGE_CRYPTSETUP - select ADK_PACKAGE_OPENSC - select ADK_PACKAGE_PCSC_LITE - select ADK_PACKAGE_CCID select ADK_PACKAGE_ALSA_UTILS - select ADK_PACKAGE_OPENSSL_PKCS11 select ADK_PACKAGE_OPENSSH_CLIENT select ADK_PACKAGE_OPENSSH_CLIENT_UTILS select ADK_PACKAGE_OPENSSH_SERVER -- cgit v1.2.3 From 6eb7b2e3c44b8fe909534f63b7dbe58fa7838d86 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 27 Jan 2011 13:53:41 +0100 Subject: add missing dependency to crc-ccitt --- target/linux/config/Config.in.netdevice | 1 + 1 file changed, 1 insertion(+) (limited to 'target') diff --git a/target/linux/config/Config.in.netdevice b/target/linux/config/Config.in.netdevice index b5390e92d..28a37dbef 100644 --- a/target/linux/config/Config.in.netdevice +++ b/target/linux/config/Config.in.netdevice @@ -340,6 +340,7 @@ config ADK_KPACKAGE_KMOD_P54_USB select ADK_PACKAGE_P54_FIRMWARE select ADK_KERNEL_EXPERIMENTAL select ADK_KPACKAGE_KMOD_MAC80211 + select ADK_KPACKAGE_KMOD_CRC_CCITT depends on ADK_PACKAGE_KMOD_USB_CONTROLLER default n help -- cgit v1.2.3