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
$(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)]')
# 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)
$(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)
.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
*/
#include <asm/uaccess.h>
-#include <asm/addrspace.h>
#include <asm/page.h>
/*
extern char input_data[];
extern int input_len;
-static unsigned char *output;
+extern unsigned char output[];
static void error(char *m);
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");
}