target/linux/image rewrite

SVN-Revision: 3905
This commit is contained in:
Felix Fietkau 2006-06-04 21:57:59 +00:00
parent 2b7eb78d80
commit 648e7db52d
17 changed files with 254 additions and 550 deletions

View File

@ -1,4 +1,10 @@
menu "Target Root Filesystem" menu "Target Root Filesystem"
config TARGET_ROOTFS_INITRAMFS
bool "ramdisk"
default n
depends LINUX_2_6
help
Embed the rootfs into the kernel (initramfs)
config TARGET_ROOTFS_JFFS2 config TARGET_ROOTFS_JFFS2
bool "jffs2" bool "jffs2"
@ -16,7 +22,7 @@ menu "Target Root Filesystem"
config TARGET_ROOTFS_TGZ config TARGET_ROOTFS_TGZ
bool "tgz" bool "tgz"
default y default y if !LINUX_2_4_BRCM && !LINUX_2_6_BRCM && !LINUX_2_6_ARUBA && !LINUX_2_4_AR531X
help help
Build a compressed tar archive of the the root filesystem Build a compressed tar archive of the the root filesystem

View File

@ -3,77 +3,13 @@ include $(TOPDIR)/rules.mk
PKG_OS:=$(shell uname -s) PKG_OS:=$(shell uname -s)
PKG_CPU:=$(shell uname -m) PKG_CPU:=$(shell uname -m)
IB_NAME:=OpenWrt-ImageBuilder-$(PKG_OS)-$(PKG_CPU)
IB_DIR:=$(BUILD_DIR)/$(IB_NAME)
define kernel_template define kernel_template
$(1)/$(2)-clean:
$(MAKE) -C $(2)-$(1) BOARD="$(2)" clean
$(1)/$(2)-prepare:
$(MAKE) -C $(2)-$(1) BOARD="$(2)" prepare
$(1)/$(2)-compile:
$(MAKE) -C $(2)-$(1) BOARD="$(2)" compile
$(1)/$(2)-rebuild:
$(MAKE) -C $(2)-$(1) BOARD="$(2)" rebuild
$(1)/$(2)-install:
$(MAKE) -C $(2)-$(1) BOARD="$(2)" install
$(1)/$(2)-image: $(1)/$(2)-install
$(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" install
$(1)/$(2)-install-ib:
$(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" IB_DIR="$(IB_DIR)" install-ib
echo '$$$$(eval $$$$(call image_template,$(2),$(1)))' >> $(IB_DIR)/kernel.mk
ifeq ($(CONFIG_LINUX_$(3)),y) ifeq ($(CONFIG_LINUX_$(3)),y)
clean: $(1)/$(2)-clean KERNEL:=$(1)
prepare: $(1)/$(2)-prepare BOARD:=$(2)
compile: $(1)/$(2)-compile
rebuild: $(1)/$(2)-rebuild
$(BIN_DIR)/$(IB_NAME).tar.bz2 install: $(1)/$(2)-image
install-ib: $(1)/$(2)-install-ib
endif endif
.PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install $(1)/$(2)-image $(1)/$(2)-install-ib
endef endef
.PHONY: clean prepare compile rebuild install imagebuilder install-ib
install-ib:
$(BIN_DIR)/$(IB_NAME).tar.bz2:
rm -rf $(IB_DIR)
mkdir -p $(IB_DIR)/packages
mkdir -p $(IB_DIR)/scripts
$(CP) ./imagebuilder/* $(IB_DIR)/
$(CP) $(TOPDIR)/bin/packages/*.ipk $(IB_DIR)/packages/
$(CP) $(TOPDIR)/scripts/ipkg $(IB_DIR)/scripts/
$(MAKE) install-ib
$(CP) $(TOPDIR)/rules.mk $(IB_DIR)
$(CP) ./image $(IB_DIR)/
$(CP) $(TOPDIR)/.config $(IB_DIR)/
find $(IB_DIR) -name .svn | xargs rm -rf
find $(IB_DIR) -name CVS | xargs rm -rf
(cd $(BUILD_DIR); tar c $(IB_NAME) | bzip2 -c > $(BIN_DIR)/$(IB_NAME).tar.bz2)
ifeq ($(CONFIG_PACKAGE_IMAGEBUILDER),y)
install: $(BIN_DIR)/$(IB_NAME).tar.bz2
endif
prepare:
$(MAKE) -C image prepare
compile:
$(MAKE) -C image compile
install:
rebuild:
clean:
$(eval $(call kernel_template,2.4,brcm,2_4_BRCM)) $(eval $(call kernel_template,2.4,brcm,2_4_BRCM))
$(eval $(call kernel_template,2.4,ar7,2_4_AR7)) $(eval $(call kernel_template,2.4,ar7,2_4_AR7))
$(eval $(call kernel_template,2.4,x86,2_4_X86)) $(eval $(call kernel_template,2.4,x86,2_4_X86))
@ -84,3 +20,22 @@ $(eval $(call kernel_template,2.6,aruba,2_6_ARUBA))
$(eval $(call kernel_template,2.6,au1000,2_6_AU1000)) $(eval $(call kernel_template,2.6,au1000,2_6_AU1000))
$(eval $(call kernel_template,2.6,xscale,2_6_XSCALE)) $(eval $(call kernel_template,2.6,xscale,2_6_XSCALE))
$(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE)) $(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE))
export BOARD
export KERNEL
prepare:
$(MAKE) -C $(BOARD)-$(KERNEL) prepare
compile:
$(MAKE) -C $(BOARD)-$(KERNEL) compile
install:
$(MAKE) -C $(BOARD)-$(KERNEL) install
$(MAKE) -C image/$(BOARD) install
clean:
$(MAKE) -C $(BOARD)-$(KERNEL) clean
image/%:
$(MAKE) -C image $(patsubst image/%,%,$@)

View File

@ -1,42 +0,0 @@
include $(TOPDIR)/rules.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
include ./jffs2.mk
endif
ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS_LZMA),y)
include ./squashfs.mk
endif
ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y)
include ./tgz.mk
endif
prepare: FORCE
$(MAKE) prepare-targets
compile: FORCE
$(MAKE) compile-targets
install: FORCE
$(MAKE) install-targets
$(BOARD)-compile: FORCE
$(MAKE) -C $(BOARD) prepare
$(MAKE) -C $(BOARD) compile
install-ib: FORCE
-$(MAKE) -C $(BOARD) IB_DIR="$(IB_DIR)" install-ib
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/
install-prepare: FORCE
find $(BUILD_DIR)/root -type f -not -perm +0100 | xargs chmod 0644
find $(BUILD_DIR)/root -type f -perm +0100 | xargs chmod 0755
find $(BUILD_DIR)/root -type d | xargs chmod 0755
mkdir -p $(BUILD_DIR)/root/tmp
chmod 0777 $(BUILD_DIR)/root/tmp
rebuild: clean prepare compile install
clean: FORCE
$(MAKE) clean-targets

View File

@ -1,12 +1,8 @@
include $(TOPDIR)/rules.mk include ../image.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader PKG_BUILD_DIR:=$(BUILD_DIR)/ar7loader
ifeq ($(IB),)
LOADADDR := 0x94020000 LOADADDR := 0x94020000
KERNEL_ENTRY := 0x${shell nm $(KDIR)/linux-$(KERNEL)*/vmlinux | grep kernel_entry | cut -d' ' -f1}
OUTPUT_FORMAT := elf32-tradlittlemips OUTPUT_FORMAT := elf32-tradlittlemips
CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
@ -15,18 +11,6 @@ CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \ -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \
-DLOADADDR=$(LOADADDR) -DLOADADDR=$(LOADADDR)
$(PKG_BUILD_DIR):
mkdir -p $(PKG_BUILD_DIR)
$(PKG_BUILD_DIR)/zimage.script: src/zimage.script.in
sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@
$(PKG_BUILD_DIR)/ld.script: src/ld.script.in
sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@
$(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c $(PKG_BUILD_DIR)/cksum.o: $(PKG_BUILD_DIR)/cksum.c
$(HOSTCC) -o $@ $< $(HOSTCC) -o $@ $<
@ -45,24 +29,35 @@ $(PKG_BUILD_DIR)/loader.o: src/loader.c
$(STAGING_DIR)/bin/srec2bin: src/srec2bin.c $(STAGING_DIR)/bin/srec2bin: src/srec2bin.c
$(HOSTCC) -o $@ $< $(HOSTCC) -o $@ $<
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
$(KDIR)/vmlinux.bin: $(KDIR)/vmlinux.lzma compile define Build/Compile
$(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $< -o $(KDIR)/zimage.o mkdir -p $(PKG_BUILD_DIR)
$(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=$(KERNEL_ENTRY) -T $(PKG_BUILD_DIR)/ld.script \ sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-e 's/@@LOADADDR@@/$(LOADADDR)/' \
< src/zimage.script.in \
> $(PKG_BUILD_DIR)/zimage.script
sed -e 's/@@OUTPUT_FORMAT@@/$(OUTPUT_FORMAT)/' \
-e 's/@@LOADADDR@@/$(LOADADDR)/' \
< src/ld.script.in \
> $(PKG_BUILD_DIR)/ld.script
$(MAKE) $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin
endef
define Build/Clean
rm -rf $(PKG_BUILD_DIR)
endef
define Image/Prepare
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
$(TARGET_CROSS)ld -T $(PKG_BUILD_DIR)/zimage.script -r -b binary $(KDIR)/vmlinux.lzma -o $(KDIR)/zimage.o
$(TARGET_CROSS)ld -static -G 0 --defsym kernel_entry=0x$${shell nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} -T $(PKG_BUILD_DIR)/ld.script \
$(PKG_BUILD_DIR)/loader.o \ $(PKG_BUILD_DIR)/loader.o \
$(PKG_BUILD_DIR)/LzmaDecode.o \ $(PKG_BUILD_DIR)/LzmaDecode.o \
$(KDIR)/zimage.o \ $(KDIR)/zimage.o \
-o $(KDIR)/loader -o $(KDIR)/loader
$(TARGET_CROSS)objcopy -O srec $(KDIR)/loader $(KDIR)/ram_zimage.sre $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader $(KDIR)/ram_zimage.sre
$(STAGING_DIR)/bin/srec2bin $(KDIR)/ram_zimage.sre $@ $(STAGING_DIR)/bin/srec2bin $(KDIR)/ram_zimage.sre $(KDIR)/vmlinux.bin
endef
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin: $(KDIR)/vmlinux.bin
endif
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin:
$(CP) $(KDIR)/vmlinux.bin $@
ifeq ($(FS),jffs2-8MB) ifeq ($(FS),jffs2-8MB)
ALIGN:=bs=131072 conv=sync ALIGN:=bs=131072 conv=sync
@ -71,56 +66,29 @@ ifeq ($(FS),jffs2-4MB)
ALIGN:=bs=65536 conv=sync ALIGN:=bs=65536 conv=sync
endif endif
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin define Image/Build/CyberTAN
dd if=$< $(ALIGN) > $@ (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin) | \
cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(FS) >> $@ $(STAGING_DIR)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
define pattern_template
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin
(dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin) | \
$(STAGING_DIR)/bin/addpattern -p $(1) $(2) -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS)-$(1).bin
endef endef
define sercomm_template define Image/Build/sErCoMm
$(BIN_DIR)/openwrt-$(1)-$(KERNEL)-$(FS).img: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin" > "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img"
cat sercomm/adam2.bin "$$^" > "$$@.tmp" dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
dd if=sercomm/$(1) of="$$@.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc $(STAGING_DIR)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
$(STAGING_DIR)/bin/dgfirmware -f -w "$$@" "$$@.tmp" rm -f "$(KDIR)/dgfw.tmp"
rm -f "$$@.tmp"
install: $(BIN_DIR)/openwrt-$(1)-$(KERNEL)-$(FS).img
endef endef
$(eval $(call sercomm_template,dg834)) define Image/Build
$(eval $(call sercomm_template,jdr454wb)) dd if=$(KDIR)/vmlinux.bin $(ALIGN) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
cat $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
$(call Image/Build/CyberTAN,$(1),AG1B,AG1B,$(1))
$(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
$(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
$(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
$(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
$(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
$(call Image/Build/sErCoMm,$(1),dg834,$(1))
$(call Image/Build/sErCoMm,$(1),jdr454wb,$(1))
endef
$(eval $(call pattern_template,AG1B)) $(eval $(call BuildImage))
$(eval $(call pattern_template,WA22))
$(eval $(call pattern_template,WAG2))
$(eval $(call pattern_template,WA21))
$(eval $(call pattern_template,WA31,-b))
$(eval $(call pattern_template,WA32,-b))
ifeq ($(IB),)
clean:
rm -rf $(PKG_BUILD_DIR)
rm -f $(BIN_DIR)/openwrt-$(BOARD)*
prepare: $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/zimage.script $(PKG_BUILD_DIR)/ld.script
compile: prepare $(PKG_BUILD_DIR)/loader.o $(PKG_BUILD_DIR)/LzmaDecode.o $(STAGING_DIR)/bin/srec2bin
else
clean:
prepare:
compile:
endif
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-kernel.bin $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).bin
install-ib:
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(KDIR)/vmlinux.bin $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)
$(CP) $(STAGING_DIR)/bin/addpattern $(IB_DIR)/staging_dir_$(ARCH)/bin/
$(CP) $(STAGING_DIR)/bin/dgfirmware $(IB_DIR)/staging_dir_$(ARCH)/bin/

View File

@ -1,4 +1,4 @@
include $(TOPDIR)/rules.mk include ../image.mk
LOADADDR = 0x81000000 # RAM start + 16M LOADADDR = 0x81000000 # RAM start + 16M
KERNEL_ENTRY = 0x80100000 KERNEL_ENTRY = 0x80100000
@ -10,57 +10,25 @@ LOADER_MAKEOPTS= \
KERNEL_ENTRY=$(KERNEL_ENTRY) \ KERNEL_ENTRY=$(KERNEL_ENTRY) \
RAMSIZE=$(RAMSIZE) RAMSIZE=$(RAMSIZE)
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) define Build/Clean
lzma-loader-clean: FORCE
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
endef
lzma-loader-prepare: FORCE define Image/Prepare
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile
endef
ifeq ($(IB),) define Image/Build
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux ./addVersion -n ArubaOS $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari version
cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari: $(KDIR)/vmlinux.lzma
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari
endif
ifeq ($(KERNEL),2.6)
FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
ifeq ($(FS),jffs2-4MB)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari: $(KDIR)/loader.elf
./addVersion -n ArubaOS $(KDIR)/loader.elf $@ version
ifneq ($(CONFIG_ARUBA_RAMDISK),y) ifneq ($(CONFIG_ARUBA_RAMDISK),y)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari $(KDIR)/root.$(FS) ifeq ($(1),jffs2-64k)
@dd if=$< of=$@.tmp bs=655360 conv=sync endif
@cat $(KDIR)/root.$(FS) >> $@.tmp @dd if=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari of=$(KDIR)/image.tmp bs=655360 conv=sync
@dd if=$@.tmp of=$@ bs=3604480 conv=sync @cat $(KDIR)/root.$(FS) >> $(KDIR)/image.tmp
@rm -f $@.tmp @dd if=$(KDIR)/image.tmp of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(patsubst jffs2-%,jffs2,$(1)).bin bs=3604480 conv=sync
@rm -f $(KDIR)/image.tmp
endif
endef
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin $(eval $(call BuildImage))
endif
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).ari
endif
endif
ifeq ($(IB),)
clean: lzma-loader-clean
prepare: lzma-loader-prepare
compile: lzma-loader-compile
else
clean:
prepare:
compile:
endif
install-ib:
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
$(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/

View File

@ -1,4 +1,4 @@
include $(TOPDIR)/rules.mk include ../image.mk
LOADADDR = 0x8108c8f4 # RAM start + 16M LOADADDR = 0x8108c8f4 # RAM start + 16M
KERNEL_ENTRY = 0x80100000 # Default kernel entry in arch/mips/Makefile KERNEL_ENTRY = 0x80100000 # Default kernel entry in arch/mips/Makefile
@ -10,67 +10,19 @@ LOADER_MAKEOPTS= \
KERNEL_ENTRY=$(KERNEL_ENTRY) \ KERNEL_ENTRY=$(KERNEL_ENTRY) \
RAMSIZE=$(RAMSIZE) RAMSIZE=$(RAMSIZE)
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) define Build/Clean
lzma-loader-clean: FORCE
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
endef
lzma-loader-prepare: FORCE define Image/Prepare
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare
$(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile
endef
ifeq ($(IB),) define Image/Build
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(1) $(KDIR)/root.srec
cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false) grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
install: $(KDIR)/vmlinux.lzma endef
endif
ifeq ($(FS),jffs2-8MB) $(eval $(call BuildImage))
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS)
$(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
endif
ifeq ($(FS),tgz)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz
$(CP) $^ $@
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz
endif
ifeq ($(FS),squashfs)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS)
$(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
endif
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/zImage.flash
$(CP) $^ $@
ifeq ($(IB),)
clean: lzma-loader-clean
prepare: lzma-loader-prepare
compile: lzma-loader-compile
else
clean:
prepare:
compile:
endif
install-ib:
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
$(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/
$(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/loader.elf $(KDIR)/loader.srec
grep -v S0 $(KDIR)/loader.srec > $(KDIR)/kernel.srec

View File

@ -1,23 +1,4 @@
include $(TOPDIR)/rules.mk include ../image.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
lzma-loader-clean: FORCE
$(MAKE) -C lzma-loader clean
lzma-loader-prepare: FORCE
$(MAKE) -C lzma-loader prepare
lzma-loader-compile: lzma-loader-prepare
$(MAKE) -C lzma-loader compile
ifeq ($(IB),)
$(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
$(KDIR)/loader.tmp.gz: compile
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma
endif
ifeq ($(FS),jffs2-8MB) ifeq ($(FS),jffs2-8MB)
TRXALIGN:=-a 0x20000 TRXALIGN:=-a 0x20000
@ -25,111 +6,56 @@ endif
ifeq ($(FS),jffs2-4MB) ifeq ($(FS),jffs2-4MB)
TRXALIGN:=-a 0x10000 TRXALIGN:=-a 0x10000
endif endif
# see ticket #155
ifeq ($(FS),squashfs) ifeq ($(FS),squashfs)
# see ticket #155
TRXALIGN:=-a 1024 TRXALIGN:=-a 1024
endif endif
define Build/Compile
rm -f $(KDIR)/loader.gz
$(MAKE) -C lzma-loader \
BUILD_DIR="$(KDIR)" \
TARGET="$(KDIR)" \
install
echo -ne "\\x00" >> $(KDIR)/loader.gz
endef
$(KDIR)/loader.tmp.gz: define Build/Clean
$(CP) $(BUILD_DIR)/loader.gz $@ $(MAKE) -C lzma-loader clean
echo -ne "\\x00" >> $@ endef
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/loader.tmp.gz define Image/Prepare
$(STAGING_DIR)/bin/trx -o $@ $(KDIR)/loader.tmp.gz $(KDIR)/vmlinux.lzma $(TRXALIGN) $(KDIR)/root.$(FS) cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
endef
ifeq ($(KERNEL),2.6) define Image/Build/wgt634u
FSNAME:=$(patsubst jffs2-%,jffs2,$(FS)) dd if=$(KDIR)/loader.elf of=$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin bs=131072 conv=sync
cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx >> $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(2).bin
endef
ifneq ($(FS),jffs2-4MB) define Image/Build/CyberTAN
$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx $(STAGING_DIR)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync endef
cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@
$(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx define Image/Build/Motorola
$(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g $(STAGING_DIR)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
endef
install: $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin
endif
ifneq ($(FS),jffs2-8MB)
$(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g
install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin
define Image/Build
$(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(KDIR)/loader.gz $(KDIR)/vmlinux.lzma $(TRXALIGN) $(KDIR)/root.$(1)
ifneq ($(1),jffs2-128k)
$(call Image/Build/CyberTAN,$(1),wrt54g3g,W54F,1.99.5,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),wrt54g,W54G,4.40.1,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),wrt54gs_v4,W54s,1.09.1,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/Motorola,$(1),wa840g,2,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/Motorola,$(1),we800g,3,$(patsubst jffs2-%,jffs2,$(1)))
endif endif
ifneq ($(1),jffs2-64k)
$(call Image/Build/CyberTAN,$(1),wrt54gs,W54S,4.80.1,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),wrtsl54gs,W54U,2.00.5,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/wgt634u,$(1),$(patsubst jffs2-%,jffs2,$(1)))
endif endif
$(call Image/Build/Motorola,$(1),wr850g,1,$(1))
endef
ifeq ($(KERNEL),2.4) $(eval $(call BuildImage))
FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
# ifeq ($(FS),squashfs)
# $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
# $(CP) $< $@
# echo -ne '\x01' >> $@
#
# install: $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx
# endif
ifneq ($(FS),jffs2-8MB)
$(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wr850g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/motorola-bin -1 $< $@
$(BIN_DIR)/openwrt-wa840g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/motorola-bin -2 $< $@
$(BIN_DIR)/openwrt-we800g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/motorola-bin -3 $< $@
install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wr850g-$(FSNAME).bin $(BIN_DIR)/openwrt-wa840g-$(FSNAME).bin $(BIN_DIR)/openwrt-we800g-$(FSNAME).bin
endif
ifneq ($(FS),jffs2-4MB)
$(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync
cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@
$(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g
$(BIN_DIR)/openwrt-wrtsl54gs-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
$(STAGING_DIR)/bin/addpattern -4 -p W54U -v v2.00.0 -i $< -o $@ -g
install: $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrtsl54gs-$(FSNAME).bin
endif
endif
ifeq ($(IB),)
clean: lzma-loader-clean
prepare: lzma-loader-prepare
compile: lzma-loader-compile
else
clean:
prepare:
compile:
endif
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
install-ib:
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
$(CP) $(STAGING_DIR)/bin/addpattern $(STAGING_DIR)/bin/trx $(STAGING_DIR)/bin/motorola-bin $(IB_DIR)/staging_dir_$(ARCH)/bin
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(BUILD_DIR)/loader.gz $(IB_DIR)/build_$(ARCH)/
$(CP) $(BUILD_DIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
$(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/

View File

@ -2,10 +2,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME := loader PKG_NAME := lzma-loader
PKG_VERSION := 0.04 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
$(PKG_BUILD_DIR)/.prepared: $(PKG_BUILD_DIR)/.prepared:
mkdir $(PKG_BUILD_DIR) mkdir $(PKG_BUILD_DIR)
@ -16,17 +14,15 @@ $(PKG_BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/.prepared
$(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)
$(BUILD_DIR)/loader.gz: $(PKG_BUILD_DIR)/loader.gz
$(CP) $< $@
$(BUILD_DIR)/loader.elf: $(PKG_BUILD_DIR)/loader.o
$(CP) $< $@
source: source:
prepare: $(PKG_BUILD_DIR)/.prepared prepare: $(PKG_BUILD_DIR)/.prepared
compile: $(BUILD_DIR)/loader.gz $(BUILD_DIR)/loader.elf compile: $(PKG_BUILD_DIR)/loader.gz
install: install:
ifneq ($(TARGET),)
install: compile
$(CP) $(PKG_BUILD_DIR)/loader.gz $(PKG_BUILD_DIR)/loader.elf $(TARGET)/
endif
clean: clean:
rm -rf $(PKG_BUILD_DIR) rm -rf $(PKG_BUILD_DIR)
rm -f $(BUILD_DIR)/loader.gz

View File

@ -34,7 +34,7 @@ SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
OBJECTS := head.o data.o OBJECTS := head.o data.o
all: loader.gz all: loader.gz loader.elf
# Don't build dependencies, this may die if $(CC) isn't gcc # Don't build dependencies, this may die if $(CC) isn't gcc
dep: dep:
@ -44,6 +44,9 @@ install:
loader.gz: loader loader.gz: loader
gzip -nc9 $< > $@ gzip -nc9 $< > $@
loader.elf: loader.o
cp $< $@
loader: loader.o loader: loader.o
$(OBJCOPY) $< $@ $(OBJCOPY) $< $@

View File

@ -0,0 +1,5 @@
include ../image.mk
# use default targets for everything
$(eval $(call BuildImage))

View File

@ -0,0 +1,53 @@
include $(TOPDIR)/rules.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
include $(TOPDIR)/target/linux/image/jffs2.mk
endif
ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS_LZMA),y)
include $(TOPDIR)/target/linux/image/squashfs.mk
endif
ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y)
include $(TOPDIR)/target/linux/image/tgz.mk
endif
endif
define Image/mkfs/prepare/default
find $(BUILD_DIR)/root -type f -not -perm +0100 | xargs chmod 0644
find $(BUILD_DIR)/root -type f -perm +0100 | xargs chmod 0755
find $(BUILD_DIR)/root -type d | xargs chmod 0755
mkdir -p $(BUILD_DIR)/root/tmp
chmod 0777 $(BUILD_DIR)/root/tmp
endef
define Image/mkfs/prepare
$(call Image/mkfs/prepare/default)
endef
define BuildImage
compile:
$(call Build/Compile)
install:
$(call Image/Prepare)
$(call Image/mkfs/prepare)
$(call Image/mkfs/jffs2)
$(call Image/mkfs/squashfs)
$(call Image/mkfs/tgz)
clean:
$(call Build/Clean)
endef
compile-targets:
install-targets:
clean-targets:
prepare:
compile: compile-targets
install: compile install-targets
clean: clean-targets

View File

@ -4,41 +4,23 @@ else
JFFS2OPTS := --pad --big-endian --squash JFFS2OPTS := --pad --big-endian --squash
endif endif
#JFFS2OPTS += -Xlzo -msize -Xlzari define Image/mkfs/jffs2
rm -rf $(BUILD_DIR)/root/jffs
$(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $(KDIR)/root.jffs2-64k -d $(BUILD_DIR)/root
$(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $(KDIR)/root.jffs2-128k -d $(BUILD_DIR)/root
jffs2-prepare: FORCE $(call Image/Build,jffs2-64k)
$(MAKE) -C jffs2 prepare $(call Image/Build,jffs2-128k)
endef
jffs2-compile: prepare-targets $(STAGING_DIR)/bin/mkfs.jffs2:
$(MAKE) -C jffs2 compile $(MAKE) -C $(TOPDIR)/target/linux/image/jffs2 compile
jffs2-clean: FORCE jffs2-clean: FORCE
$(MAKE) -C jffs2 clean $(MAKE) -C $(TOPDIR)/target/linux/image/jffs2 clean
rm -f $(KDIR)/root.jffs2* rm -f $(KDIR)/root.jffs2*
$(KDIR)/root.jffs2-4MB: install-prepare compile-targets: $(STAGING_DIR)/bin/mkfs.jffs2
@rm -rf $(BUILD_DIR)/root/jffs
$(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $@ -d $(BUILD_DIR)/root
$(KDIR)/root.jffs2-8MB: install-prepare
@rm -rf $(BUILD_DIR)/root/jffs
$(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $@ -d $(BUILD_DIR)/root
ifeq ($(IB),)
jffs2-install: compile-targets $(BOARD)-compile
endif
jffs2-install: $(KDIR)/root.jffs2-4MB $(KDIR)/root.jffs2-8MB FORCE
$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-4MB"
$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-8MB"
jffs2-install-ib: compile-targets FORCE
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
$(CP) $(STAGING_DIR)/bin/mkfs.jffs2 $(IB_DIR)/staging_dir_$(ARCH)/bin
prepare-targets: jffs2-prepare
compile-targets: jffs2-compile
install-targets: jffs2-install
install-ib: jffs2-install-ib
clean-targets: jffs2-clean clean-targets: jffs2-clean

View File

@ -25,5 +25,5 @@ prepare: $(MTD_DIR)/.unpacked
compile: $(MTD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/mkfs.jffs2 compile: $(MTD_DIR)/util/mkfs.jffs2 $(STAGING_DIR)/bin/mkfs.jffs2
install: install:
clean: FORCE clean: FORCE
rm -rf $(MTD_DIR) rm -rf $(MTD_DIR) $(STAGING_DIR)/bin/mkfs.jffs2

View File

@ -1,36 +1,22 @@
ifneq ($(CONFIG_BIG_ENDIAN),y) ifneq ($(CONFIG_BIG_ENDIAN),y)
endian := le ENDIAN := le
else else
endian := be ENDIAN := be
endif endif
squashfs-prepare: FORCE $(STAGING_DIR)/bin/mksquashfs-lzma:
$(MAKE) -C squashfs prepare $(MAKE) -C $(TOPDIR)/target/linux/image/squashfs compile
squashfs-compile: prepare-targets
$(MAKE) -C squashfs compile
squashfs-clean: FORCE squashfs-clean: FORCE
$(MAKE) -C squashfs clean $(MAKE) -C $(TOPDIR)/target/linux/image/squashfs clean
rm -f $(KDIR)/root.squashfs rm -f $(KDIR)/root.squashfs
$(KDIR)/root.squashfs: install-prepare define Image/mkfs/squashfs
@mkdir -p $(BUILD_DIR)/root/jffs @mkdir -p $(BUILD_DIR)/root/jffs
$(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $@ -nopad -noappend -root-owned -$(endian) $(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $(KDIR)/root.squashfs -nopad -noappend -root-owned -$(ENDIAN)
$(call Image/Build,squashfs)
ifeq ($(IB),) endef
squashfs-install: compile-targets $(BOARD)-compile
endif
squashfs-install: $(KDIR)/root.squashfs FORCE FILESYSTEMS += squashfs
$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="squashfs" compile-targets: $(STAGING_DIR)/bin/mksquashfs-lzma
clean-targets: squashfs-clean
squashfs-install-ib: compile-targets
mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
$(CP) $(STAGING_DIR)/bin/mksquashfs-lzma $(IB_DIR)/staging_dir_$(ARCH)/bin
prepare-targets: squashfs-prepare
compile-targets: squashfs-compile
install-targets: squashfs-install
install-ib: squashfs-install-ib
clean: squashfs-clean

View File

@ -1,14 +1,3 @@
$(KDIR)/root.tar.gz: FORCE define Image/mkfs/tgz
tar -zcf $@ --owner=root --group=root -C $(BUILD_DIR)/root/ . tar -zcf $(BIN_DIR)/openwrt-rootfs.tgz --owner=root --group=root -C $(BUILD_DIR)/root/ .
endef
ifeq ($(BOARD),x86)
install: tgz-install
tgz-install: $(KDIR)/root.tar.gz
$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="tgz"
endif
prepare-targets:
compile-targets:
install-targets: $(KDIR)/root.tar.gz

View File

@ -1,31 +1,8 @@
include $(TOPDIR)/rules.mk include ../image.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) define Image/Build
cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
endef
$(eval $(call BuildImage))
ifeq ($(FS),jffs2-8MB)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img: $(KDIR)/root.$(FS)
$(CP) $^ $@
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
endif
ifeq ($(FS),tgz)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz
$(CP) $^ $@
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz
endif
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/bzImage
$(CP) $^ $@
clean:
prepare:
compile:
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
install-ib: FORCE
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(KDIR)/bzImage $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/

View File

@ -1,30 +1,10 @@
include $(TOPDIR)/rules.mk include ../image.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) define Image/Build
ifneq ($(FS),jffs2-64k)
ifeq ($(FS),jffs2-8MB) cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img: $(KDIR)/root.$(FS) cp $(KDIR)/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
$(CP) $^ $@
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
endif endif
endef
$(eval $(call BuildImage))
ifeq ($(FS),tgz)
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz
$(CP) $^ $@
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz
endif
$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/vmlinux
$(CP) $^ $@
clean:
prepare:
compile:
install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
install-ib: FORCE
mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
$(CP) $(KDIR)/bzImage $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/