mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail/openwrt-devel/2007-August/001159.html
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8362 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -22,7 +22,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
endef
|
||||
|
||||
define trxalign/jffs2-128k
|
||||
@@ -36,12 +36,12 @@ define trxalign/squashfs
|
||||
endef
|
||||
|
||||
define Image/Build/TRX
|
||||
$(STAGING_DIR)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
|
||||
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
|
||||
endef
|
||||
|
||||
define Image/Build/TRXNoloader
|
||||
$(STAGING_DIR)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
|
||||
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
|
||||
endef
|
||||
|
||||
@@ -53,7 +53,7 @@ endef
|
||||
define Image/Build/Edimax
|
||||
$(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
|
||||
$(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
|
||||
$(STAGING_DIR)/bin/mkcsysimg -B $(4) -d -w \
|
||||
$(STAGING_DIR_HOST)/bin/mkcsysimg -B $(4) -d -w \
|
||||
-r $(KDIR)/loader-$(2).gz \
|
||||
-x $(IMGNAME)-$(3)-$(2).trx \
|
||||
$(IMGNAME)-$(3)-$(2).bin
|
||||
@@ -69,7 +69,7 @@ endef
|
||||
define Image/Build/MyLoader
|
||||
$(call Image/Build/Loader,$(2),gz,0x80500000,0)
|
||||
$(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
|
||||
$(STAGING_DIR)/bin/mkmylofw -B $(4) \
|
||||
$(STAGING_DIR_HOST)/bin/mkmylofw -B $(4) \
|
||||
-p0x20000:0x10000:ahp:0x80001000 \
|
||||
-p0x30000:0 \
|
||||
-b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \
|
||||
@@ -83,7 +83,7 @@ endef
|
||||
|
||||
define Image/Build/RouterBoard
|
||||
$(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-rb1xx-vmlinux
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/yaffs2)) '
|
||||
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/yaffs2)) '
|
||||
endef
|
||||
|
||||
define Image/Build/jffs2-64k
|
||||
|
||||
@@ -22,7 +22,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
endef
|
||||
|
||||
define trxalign/jffs2-128k
|
||||
@@ -36,12 +36,12 @@ define trxalign/squashfs
|
||||
endef
|
||||
|
||||
define Image/Build/TRX
|
||||
$(STAGING_DIR)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
|
||||
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
|
||||
endef
|
||||
|
||||
define Image/Build/TRXNoloader
|
||||
$(STAGING_DIR)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
|
||||
$(call trxalign/$(2)) -f $(KDIR)/root.$(2)
|
||||
endef
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
define Image/BuildKernel
|
||||
$(STAGING_DIR)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
|
||||
$(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
|
||||
mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e \
|
||||
0x80002000 \
|
||||
-n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
|
||||
|
||||
@@ -33,7 +33,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
|
||||
$(LOADER_MAKEOPTS) \
|
||||
@@ -52,13 +52,13 @@ endef
|
||||
|
||||
define Image/Build/CyberTAN
|
||||
(dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin) | \
|
||||
$(STAGING_DIR)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
|
||||
$(STAGING_DIR_HOST)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(4).bin
|
||||
endef
|
||||
|
||||
#define Image/Build/sErCoMm
|
||||
# cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin" > "$(KDIR)/dgfw.tmp"
|
||||
# dd if=sercomm/$(2) of="$(KDIR)/dgfw.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_HOST)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(3).img" "$(KDIR)/dgfw.tmp"
|
||||
# rm -f "$(KDIR)/dgfw.tmp"
|
||||
#endef
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ define Image/Build
|
||||
dd if=$(KDIR)/uImage of=$(KDIR)/uImage.block bs=8448 conv=sync
|
||||
dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.block bs=8448 conv=sync
|
||||
cat $(KDIR)/uImage.block $(KDIR)/root.block > $(KDIR)/knlroot.bin
|
||||
$(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
|
||||
cp $(KDIR)/dfbptest.bin $(BIN_DIR)
|
||||
$(call Image/Build/$(1),$(1))
|
||||
endef
|
||||
|
||||
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/image.mk
|
||||
define Image/BuildKernel
|
||||
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf
|
||||
gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
|
||||
$(STAGING_DIR)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
|
||||
$(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
|
||||
dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.lzma bs=65536 conv=sync
|
||||
dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.gz bs=65536 conv=sync
|
||||
endef
|
||||
|
||||
@@ -29,7 +29,7 @@ OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,
|
||||
OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
|
||||
# Build RAM image
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
|
||||
|
||||
@@ -12,7 +12,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
rm -f $(KDIR)/loader.gz
|
||||
$(MAKE) -C lzma-loader \
|
||||
BUILD_DIR="$(KDIR)" \
|
||||
@@ -32,15 +32,15 @@ ifneq ($(KERNEL),2.4)
|
||||
endif
|
||||
|
||||
define Image/Build/CyberTAN
|
||||
$(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
|
||||
$(STAGING_DIR_HOST)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(5).bin
|
||||
endef
|
||||
|
||||
define Image/Build/Motorola
|
||||
$(STAGING_DIR)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
|
||||
$(STAGING_DIR_HOST)/bin/motorola-bin -$(3) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(4).bin
|
||||
endef
|
||||
|
||||
define Image/Build/USR
|
||||
$(STAGING_DIR)/bin/trx2usr $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(3).bin
|
||||
$(STAGING_DIR_HOST)/bin/trx2usr $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx $(BIN_DIR)/openwrt-$(2)-$(3).bin
|
||||
endef
|
||||
|
||||
define trxalign/jffs2-128k
|
||||
@@ -78,7 +78,7 @@ define Image/Build/squashfs
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1),$(1))
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1),$(1))
|
||||
$(call Image/Build/$(1),$(1))
|
||||
$(call Image/Build/Motorola,$(1),wr850g,1,$(1))
|
||||
$(call Image/Build/USR,$(1),usr5461,$(1))
|
||||
|
||||
@@ -32,7 +32,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
rm -f $(KDIR)/loader.gz
|
||||
$(MAKE) -C lzma-loader \
|
||||
BUILD_DIR="$(KDIR)" \
|
||||
@@ -42,7 +42,7 @@ define Image/Prepare
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
|
||||
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
||||
@@ -25,7 +25,7 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
||||
endef
|
||||
|
||||
@@ -54,14 +54,14 @@ root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
|
||||
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
|
||||
./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin 4 $(KDIR)/vmlinux.elf $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
||||
define Image/Prepare
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
||||
endef
|
||||
define Image/BuildKernel
|
||||
|
||||
@@ -26,7 +26,7 @@ define Image/Build/ar525w
|
||||
mv $(KDIR)/root.$(1) $(KDIR)/root.tmp
|
||||
dd of=$(KDIR)/root.$(1) if=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync
|
||||
rm -f $(KDIR)/root.tmp
|
||||
$(STAGING_DIR)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
|
||||
$(STAGING_DIR_HOST)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
|
||||
endef
|
||||
|
||||
define Image/Build/wl153
|
||||
|
||||
@@ -49,7 +49,7 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
|
||||
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
|
||||
-e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
|
||||
./grub/menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
|
||||
PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/bin:$(PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
|
||||
PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
|
||||
$(call Image/Build/grub/$(1))
|
||||
endef
|
||||
endif
|
||||
@@ -58,11 +58,10 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
|
||||
define Image/Prepare/grub
|
||||
# for the image builder
|
||||
$(CP) \
|
||||
$(STAGING_DIR)/usr/lib/grub/i386-pc/stage1 \
|
||||
$(STAGING_DIR)/usr/lib/grub/i386-pc/stage2 \
|
||||
$(STAGING_DIR)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
|
||||
$(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage1 \
|
||||
$(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage2 \
|
||||
$(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
|
||||
$(KDIR)/
|
||||
$(CP) $(STAGING_DIR)/usr/sbin/grub $(STAGING_DIR)/bin
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
@@ -65,8 +65,9 @@ endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
DESTDIR="$(STAGING_DIR)" \
|
||||
DESTDIR="$(STAGING_DIR_HOST)" \
|
||||
install
|
||||
mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
|
||||
endef
|
||||
|
||||
$(eval $(call Build/DefaultTargets))
|
||||
|
||||
Reference in New Issue
Block a user