From a17c63acdb5515b6d5ad09dd7282c0dffb6144c2 Mon Sep 17 00:00:00 2001 From: Yoshinori Sato Date: Wed, 30 Dec 2015 18:38:47 +0900 Subject: [PATCH] rx: zImage fix. Signed-off-by: Yoshinori Sato --- arch/rx/boot/Makefile | 7 +++--- arch/rx/boot/compressed/Makefile | 45 ++++++++++++------------------------- arch/rx/boot/compressed/head.S | 48 +++++++++++++++++++++------------------- arch/rx/boot/compressed/misc.c | 8 ++----- 4 files changed, 45 insertions(+), 63 deletions(-) diff --git a/arch/rx/boot/Makefile b/arch/rx/boot/Makefile index cac659fd5292..a96734340e7d 100644 --- a/arch/rx/boot/Makefile +++ b/arch/rx/boot/Makefile @@ -14,8 +14,9 @@ subdir- := compressed OBJCOPYFLAGS_vmlinux.srec := -Osrec -R .note.gnu.build-id OBJCOPYFLAGS_vmlinux.bin := -Obinary -R .note.gnu.build-id +OBJCOPYFLAGS_zImage := -O binary -R .note -R .comment -R .stab -R .stabstr -S -CONFIG_MEMORY_START ?= 0x08000000 +CONFIG_RAM_START ?= 0x08000000 CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 CONFIG_ENTRY_OFFSET ?= 0x00001000 @@ -30,11 +31,11 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE $(obj)/compressed/vmlinux: FORCE $(Q)$(MAKE) $(build)=$(obj)/compressed $@ -KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \ +UIMAGE_LOADADDR := $(shell /bin/bash -c 'printf "0x%08x" \ $$[$(CONFIG_MEMORY_START) + \ $(CONFIG_ENTRY_OFFSET)]') -KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \ +UIMAGE_ENTRYADDR := $(shell /bin/bash -c 'printf "0x%08x" \ $$[$(CONFIG_MEMORY_START) + \ $(CONFIG_ENTRY_OFFSET)]') diff --git a/arch/rx/boot/compressed/Makefile b/arch/rx/boot/compressed/Makefile index c72586fd4669..f17324dfede3 100644 --- a/arch/rx/boot/compressed/Makefile +++ b/arch/rx/boot/compressed/Makefile @@ -4,29 +4,23 @@ # create a compressed vmlinux image from the original vmlinux # -targets := vmlinux vmlinux.bin vmlinux.bin.gz \ - vmlinux.bin.bz2 vmlinux.bin.lzma \ - vmlinux.bin.xz vmlinux.bin.lzo \ - head.o misc.o piggy.o +targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o -OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o +OBJECTS = $(obj)/head.o $(obj)/misc.o # # IMAGE_OFFSET is the load offset of the compression loader +# Assign dummy values if these 2 variables are not defined, +# in order to suppress error message. # -IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \ - $$[$(CONFIG_MEMORY_START) + \ - $(CONFIG_BOOT_LINK_OFFSET)]') +CONFIG_RAM_START ?= 0x08000000 +CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 -LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) +IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_RAM_START)+$(CONFIG_BOOT_LINK_OFFSET)))) -ifeq ($(CONFIG_MCOUNT),y) -ORIG_CFLAGS := $(KBUILD_CFLAGS) -KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) -endif - -LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \ - -T $(obj)/../../kernel/vmlinux.lds +LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) +LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \ + --defsym output=$(CONFIG_RAM_START) $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE $(call if_changed,ld) @@ -35,22 +29,11 @@ $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) -vmlinux.bin.all-y := $(obj)/vmlinux.bin - -$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE +$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE $(call if_changed,gzip) -$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE - $(call if_changed,bzip2) -$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE - $(call if_changed,lzma) -$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,xzkern) -$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE - $(call if_changed,lzo) - -OBJCOPYFLAGS += -R .empty_zero_page -LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T +LDFLAGS_piggy.o := -r --format binary --oformat elf32-rx-linux -T +OBJCOPYFLAGS := -O binary -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE $(call if_changed,ld) diff --git a/arch/rx/boot/compressed/head.S b/arch/rx/boot/compressed/head.S index 989b60d5cbc5..fa8ef5dd2d5f 100644 --- a/arch/rx/boot/compressed/head.S +++ b/arch/rx/boot/compressed/head.S @@ -10,32 +10,34 @@ .global startup startup: - mov.l #initsp,r0 - mov.l #_sbss,r1 - mov.l #_ebss,r3 + mov #_stext,r0 + mov r1,r6 + mov #_sbss,r1 + mov #_ebss,r3 sub r1,r3 - mov.l #0,r2 + mov #0,r2 sstr.b - mov.l #decompress_kernel, r1 + mov #decompress_kernel, r1 jsr r1 - mov.l #_text+PAGE_SIZE, r1 - jmp r1 + mov #output, r2 + mov r6,r1 + jmp r2 - .align 9 + .align 1 << 9 fake_headers_as_bzImage: - .word 0 - .ascii "HdrS" ! header signature - .word 0x0202 ! header version number (>= 0x0105) - ! or else old loadlin-1.5 will fail) - .word 0 ! default_switch - .word 0 ! SETUPSEG + .byte 0, 0 + .ascii "HdrS" ; header signature + .word 0x0202 ; header version number (>= 0x0105) + ; or else old loadlin-1.5 will fail) + .word 0 ; default_switch + .word 0 ; SETUPSEG .word 0x1000 - .word 0 ! pointing to kernel version string - .byte 0 ! = 0, old one (LILO, Loadlin, - ! 0xTV: T=0 for LILO - ! V = version - .byte 1 ! Load flags bzImage=1 - .word 0x8000 ! size to move, when setup is not - .long 0x100000 ! 0x100000 = default for big kernel - .long 0 ! address of loaded ramdisk image - .long 0 # its size in bytes + .word 0 ; pointing to kernel version string + .byte 0 ; = 0, old one (LILO, Loadlin, + ; 0xTV: T=0 for LILO + ; V = version + .byte 1 ; Load flags bzImage=1 + .word 0x8000 ; size to move, when setup is not + .long 0x100000 ; 0x100000 = default for big kernel + .long 0 ; address of loaded ramdisk image + .long 0 ; its size in bytes diff --git a/arch/rx/boot/compressed/misc.c b/arch/rx/boot/compressed/misc.c index 5d1e2d0a6a14..8e586497e572 100644 --- a/arch/rx/boot/compressed/misc.c +++ b/arch/rx/boot/compressed/misc.c @@ -9,7 +9,6 @@ */ #include -#include #include /* @@ -24,7 +23,7 @@ extern char input_data[]; extern int input_len; -static unsigned char *output; +extern unsigned char output[]; static void error(char *m); @@ -97,13 +96,10 @@ static void error(char *x) void decompress_kernel(void) { - unsigned long output_addr; - - output = (unsigned char *)&_text+PAGE_SIZE; free_mem_ptr = (unsigned long)&_end; free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; puts("Uncompressing Linux... "); - decompress(input_data, input_len, NULL, NULL, output, NULL, error); + __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error); puts("Ok, booting the kernel.\n"); } -- 2.11.0