make aruba lzma loader more generic and move it to target/linux/image/generic/lzma-loader

SVN-Revision: 3076
lede-17.01
Felix Fietkau 2006-01-31 02:32:29 +00:00
parent 750d358589
commit 42fe2162ee
14 changed files with 29 additions and 12 deletions

View File

@ -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

View File

@ -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 $< $@

View File

@ -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

View File

@ -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)();
}
}

View File

@ -3,7 +3,7 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0x81000000;
. = @LOADADDR@;
.text :
{
_ftext = . ;