mirror of https://github.com/hak5/openwrt.git
make aruba lzma loader more generic and move it to target/linux/image/generic/lzma-loader
SVN-Revision: 3076lede-17.01
parent
750d358589
commit
42fe2162ee
|
@ -1,15 +1,25 @@
|
||||||
include $(TOPDIR)/rules.mk
|
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)
|
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
|
||||||
|
|
||||||
lzma-loader-clean:
|
lzma-loader-clean:
|
||||||
$(MAKE) -C lzma-loader clean
|
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
|
||||||
|
|
||||||
lzma-loader-prepare:
|
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
|
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),)
|
ifeq ($(IB),)
|
||||||
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
|
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
|
||||||
|
|
|
@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME := loader
|
PKG_NAME := loader
|
||||||
PKG_VERSION := 0.05
|
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:
|
$(PKG_BUILD_DIR)/.prepared:
|
||||||
mkdir $(PKG_BUILD_DIR)
|
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
|
$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma
|
||||||
$(MAKE) -C $(PKG_BUILD_DIR) CC=$(TARGET_CC) \
|
$(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
|
$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma
|
||||||
cp $< $@
|
cp $< $@
|
|
@ -1,4 +1,5 @@
|
||||||
LOADADDR = 0x81000000
|
LOADADDR = 0x80400000 # RAM start + 4M
|
||||||
|
KERNEL_ENTRY = 0x80001000
|
||||||
RAMSIZE = 0x00100000 # 1MB
|
RAMSIZE = 0x00100000 # 1MB
|
||||||
|
|
||||||
CROSS_COMPILE = mips-linux-
|
CROSS_COMPILE = mips-linux-
|
||||||
|
@ -15,7 +16,7 @@ LD = $(CROSS_COMPILE)ld
|
||||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
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}
|
# CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE}
|
||||||
|
|
||||||
O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
|
O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
|
||||||
|
@ -28,7 +29,10 @@ strip-flags = $(addprefix --remove-section=,$(drop-sections))
|
||||||
|
|
||||||
all : lzma.elf
|
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 $@ $<
|
$(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
|
||||||
|
|
||||||
lzma.elf: start.o decompress.o LzmaDecode.o kernel.o
|
lzma.elf: start.o decompress.o LzmaDecode.o kernel.o
|
|
@ -35,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LzmaDecode.h"
|
#include "LzmaDecode.h"
|
||||||
#define LOADADDR 0x80100000
|
|
||||||
|
|
||||||
#define KSEG0 0x80000000
|
#define KSEG0 0x80000000
|
||||||
#define KSEG1 0xa0000000
|
#define KSEG1 0xa0000000
|
||||||
|
@ -137,12 +136,12 @@ void entry(unsigned long icache_size, unsigned long icache_lsize,
|
||||||
|
|
||||||
/* decompress kernel */
|
/* decompress kernel */
|
||||||
if ((i = LzmaDecode(&vs, &callback,
|
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_dcache(dcache_size, dcache_lsize);
|
||||||
blast_icache(icache_size, icache_lsize);
|
blast_icache(icache_size, icache_lsize);
|
||||||
|
|
||||||
/* Jump to load address */
|
/* Jump to load address */
|
||||||
((void (*)(void)) LOADADDR)();
|
((void (*)(void)) KERNEL_ENTRY)();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ ENTRY(_start)
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* Read-only sections, merged into text segment: */
|
/* Read-only sections, merged into text segment: */
|
||||||
. = 0x81000000;
|
. = @LOADADDR@;
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
_ftext = . ;
|
_ftext = . ;
|
Loading…
Reference in New Issue