OSDN Git Service

rx: zImage fix.
authorYoshinori Sato <ysato@users.sourceforge.jp>
Wed, 30 Dec 2015 09:38:47 +0000 (18:38 +0900)
committerYoshinori Sato <yo-satoh@sios.com>
Fri, 28 Jan 2022 12:53:39 +0000 (21:53 +0900)
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/rx/boot/Makefile
arch/rx/boot/compressed/Makefile
arch/rx/boot/compressed/head.S
arch/rx/boot/compressed/misc.c

index cac659f..a967343 100644 (file)
@@ -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)]')
 
index c72586f..f17324d 100644 (file)
@@ -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)
index 989b60d..fa8ef5d 100644 (file)
 
        .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 
index 5d1e2d0..8e58649 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <asm/uaccess.h>
-#include <asm/addrspace.h>
 #include <asm/page.h>
 
 /*
@@ -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");
 }