From 42fe2162eead754917d04a0517de3053ea0e604a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 31 Jan 2006 02:32:29 +0000 Subject: [PATCH] make aruba lzma loader more generic and move it to target/linux/image/generic/lzma-loader SVN-Revision: 3076 --- openwrt/target/linux/image/aruba/Makefile | 16 +++++++++++++--- .../{aruba => generic}/lzma-loader/Makefile | 8 ++++++-- .../lzma-loader/src/LzmaDecode.c | 0 .../lzma-loader/src/LzmaDecode.h | 0 .../{aruba => generic}/lzma-loader/src/Makefile | 10 +++++++--- .../lzma-loader/src/decompress.c | 5 ++--- .../lzma-loader/src/lzma.lds.in} | 2 +- .../{aruba => generic}/lzma-loader/src/print.c | 0 .../{aruba => generic}/lzma-loader/src/print.h | 0 .../{aruba => generic}/lzma-loader/src/printf.c | 0 .../{aruba => generic}/lzma-loader/src/printf.h | 0 .../{aruba => generic}/lzma-loader/src/start.S | 0 .../lzma-loader/src/uart16550.c | 0 .../lzma-loader/src/uart16550.h | 0 14 files changed, 29 insertions(+), 12 deletions(-) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/Makefile (76%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/LzmaDecode.c (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/LzmaDecode.h (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/Makefile (80%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/decompress.c (96%) rename openwrt/target/linux/image/{aruba/lzma-loader/src/lzma.lds => generic/lzma-loader/src/lzma.lds.in} (94%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/print.c (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/print.h (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/printf.c (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/printf.h (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/start.S (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/uart16550.c (100%) rename openwrt/target/linux/image/{aruba => generic}/lzma-loader/src/uart16550.h (100%) diff --git a/openwrt/target/linux/image/aruba/Makefile b/openwrt/target/linux/image/aruba/Makefile index 432a85d59e..2a7f2e4682 100644 --- a/openwrt/target/linux/image/aruba/Makefile +++ b/openwrt/target/linux/image/aruba/Makefile @@ -1,15 +1,25 @@ include $(TOPDIR)/rules.mk +LOADADDR = 0x81000000 # RAM start + 16M +KERNEL_ENTRY = 0x80100000 +RAMSIZE = 0x00100000 # 1MB + +LOADER_MAKEOPTS= \ + KDIR=$(KDIR) \ + LOADADDR=$(LOADADDR) \ + KERNEL_ENTRY=$(KERNEL_ENTRY) \ + RAMSIZE=$(RAMSIZE) + KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) lzma-loader-clean: - $(MAKE) -C lzma-loader clean + $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean lzma-loader-prepare: - $(MAKE) -C lzma-loader prepare + $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare - $(MAKE) -C lzma-loader compile KDIR=$(KDIR) + $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile ifeq ($(IB),) $(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux diff --git a/openwrt/target/linux/image/aruba/lzma-loader/Makefile b/openwrt/target/linux/image/generic/lzma-loader/Makefile similarity index 76% rename from openwrt/target/linux/image/aruba/lzma-loader/Makefile rename to openwrt/target/linux/image/generic/lzma-loader/Makefile index 9d65a3c5d4..daa83535e9 100644 --- a/openwrt/target/linux/image/aruba/lzma-loader/Makefile +++ b/openwrt/target/linux/image/generic/lzma-loader/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME := loader PKG_VERSION := 0.05 -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION) $(PKG_BUILD_DIR)/.prepared: mkdir $(PKG_BUILD_DIR) @@ -14,7 +14,11 @@ $(PKG_BUILD_DIR)/.prepared: $(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma $(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \ - LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS) + LD=$(TARGET_CROSS)ld CROSS_COMPILE=$(TARGET_CROSS) \ + RAMSIZE=$(RAMSIZE) \ + LOADADDR=$(LOADADDR) \ + KERNEL_ENTRY=$(KERNEL_ENTRY) + $(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma cp $< $@ diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/LzmaDecode.c b/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.c similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/LzmaDecode.c rename to openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.c diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/LzmaDecode.h b/openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.h similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/LzmaDecode.h rename to openwrt/target/linux/image/generic/lzma-loader/src/LzmaDecode.h diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/Makefile b/openwrt/target/linux/image/generic/lzma-loader/src/Makefile similarity index 80% rename from openwrt/target/linux/image/aruba/lzma-loader/src/Makefile rename to openwrt/target/linux/image/generic/lzma-loader/src/Makefile index 3d0a58586d..8dfd76a6a2 100644 --- a/openwrt/target/linux/image/aruba/lzma-loader/src/Makefile +++ b/openwrt/target/linux/image/generic/lzma-loader/src/Makefile @@ -1,4 +1,5 @@ -LOADADDR = 0x81000000 +LOADADDR = 0x80400000 # RAM start + 4M +KERNEL_ENTRY = 0x80001000 RAMSIZE = 0x00100000 # 1MB CROSS_COMPILE = mips-linux- @@ -15,7 +16,7 @@ LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump -CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE} -D_LZMA_IN_CB +CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} -D_LZMA_IN_CB # CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE} O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) @@ -28,7 +29,10 @@ strip-flags = $(addprefix --remove-section=,$(drop-sections)) all : lzma.elf -kernel.o: vmlinux.lzma +lzma.lds: lzma.lds.in + sed -e 's,@LOADADDR@,$(LOADADDR),g' $< >$@ + +kernel.o: vmlinux.lzma lzma.lds $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< lzma.elf: start.o decompress.o LzmaDecode.o kernel.o diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/decompress.c b/openwrt/target/linux/image/generic/lzma-loader/src/decompress.c similarity index 96% rename from openwrt/target/linux/image/aruba/lzma-loader/src/decompress.c rename to openwrt/target/linux/image/generic/lzma-loader/src/decompress.c index e921863f16..f602276ddc 100644 --- a/openwrt/target/linux/image/aruba/lzma-loader/src/decompress.c +++ b/openwrt/target/linux/image/generic/lzma-loader/src/decompress.c @@ -35,7 +35,6 @@ */ #include "LzmaDecode.h" -#define LOADADDR 0x80100000 #define KSEG0 0x80000000 #define KSEG1 0xa0000000 @@ -137,12 +136,12 @@ void entry(unsigned long icache_size, unsigned long icache_lsize, /* decompress kernel */ if ((i = LzmaDecode(&vs, &callback, - (unsigned char*)LOADADDR, osize, &osize)) == LZMA_RESULT_OK) + (unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK) { blast_dcache(dcache_size, dcache_lsize); blast_icache(icache_size, icache_lsize); /* Jump to load address */ - ((void (*)(void)) LOADADDR)(); + ((void (*)(void)) KERNEL_ENTRY)(); } } diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/lzma.lds b/openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in similarity index 94% rename from openwrt/target/linux/image/aruba/lzma-loader/src/lzma.lds rename to openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in index faf9bd2295..5ac555bf7d 100644 --- a/openwrt/target/linux/image/aruba/lzma-loader/src/lzma.lds +++ b/openwrt/target/linux/image/generic/lzma-loader/src/lzma.lds.in @@ -3,7 +3,7 @@ ENTRY(_start) SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x81000000; + . = @LOADADDR@; .text : { _ftext = . ; diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/print.c b/openwrt/target/linux/image/generic/lzma-loader/src/print.c similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/print.c rename to openwrt/target/linux/image/generic/lzma-loader/src/print.c diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/print.h b/openwrt/target/linux/image/generic/lzma-loader/src/print.h similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/print.h rename to openwrt/target/linux/image/generic/lzma-loader/src/print.h diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/printf.c b/openwrt/target/linux/image/generic/lzma-loader/src/printf.c similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/printf.c rename to openwrt/target/linux/image/generic/lzma-loader/src/printf.c diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/printf.h b/openwrt/target/linux/image/generic/lzma-loader/src/printf.h similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/printf.h rename to openwrt/target/linux/image/generic/lzma-loader/src/printf.h diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/start.S b/openwrt/target/linux/image/generic/lzma-loader/src/start.S similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/start.S rename to openwrt/target/linux/image/generic/lzma-loader/src/start.S diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/uart16550.c b/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.c similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/uart16550.c rename to openwrt/target/linux/image/generic/lzma-loader/src/uart16550.c diff --git a/openwrt/target/linux/image/aruba/lzma-loader/src/uart16550.h b/openwrt/target/linux/image/generic/lzma-loader/src/uart16550.h similarity index 100% rename from openwrt/target/linux/image/aruba/lzma-loader/src/uart16550.h rename to openwrt/target/linux/image/generic/lzma-loader/src/uart16550.h -- 2.25.1