Skip to content

Commit

Permalink
targets: prepare for supporting normal and initramfs images
Browse files Browse the repository at this point in the history
In order to support both normal images and initramfs, ensure that each
target sets KERNELNAME properly so that the generic kernel building code
can copy the corresponding files over $(KDIR) with the appropriate
extension. Update the various paths to the kernel and wrapper images
from $(LINUX_DIR)/arch/$(ARCH)/boot/$(foo) to $(KDIR)/$(foo).

Signed-off-by: Florian Fainelli <[email protected]>

SVN-Revision: 37049
  • Loading branch information
ffainelli committed Jun 27, 2013
1 parent eab95ea commit 6a4f292
Show file tree
Hide file tree
Showing 41 changed files with 117 additions and 118 deletions.
12 changes: 4 additions & 8 deletions target/linux/adm5120/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ fs_all:=all
fs_4k:=4k
fs_64k:=64k
fs_128k:=128k
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
fs_squash:=initramfs
fs_all:=initramfs
fs_4k:=initramfs
fs_64k:=initramfs
fs_128k:=initramfs
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
endif

define Build/Clean
$(LOADER_MAKE) clean
Expand Down Expand Up @@ -111,6 +103,10 @@ endef
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
cp $(KDIR)/vmlinux $(VMLINUX).bin
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin
endif
endef

$(eval $(call BuildImage))
10 changes: 6 additions & 4 deletions target/linux/adm8668/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ include $(INCLUDE_DIR)/image.mk

VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
UIMAGE:=$(IMG_PREFIX)-uImage
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
UIMAGE:=$(IMG_PREFIX)-uImage-initramfs
endif

define kernel_entry
-a 0x80002000 -e 0x80002000
Expand Down Expand Up @@ -53,6 +49,12 @@ define Image/BuildKernel
cp $(KDIR)/vmlinux $(VMLINUX).bin
$(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
$(call MkImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(UIMAGE)-gzip.bin)
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin
$(call CompressGzip,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.gz)
$(call MkImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(BIN_DIR)/$(UIMAGE)-initramfs-gzip.bin)
endif
endef

$(eval $(call BuildImage))
7 changes: 6 additions & 1 deletion target/linux/ar7/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ define Image/Prepare
$(OBJCOPY_SREC) $(KDIR)/vmlinux.elf $(KDIR)/vmlinux.srec
srec2bin $(KDIR)/loader.srec $(KDIR)/loader.bin
srec2bin $(KDIR)/vmlinux.srec $(KDIR)/vmlinux.bin
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
$(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf \
$(KDIR)/vmlinux-initramfs.srec
srec2bin $(KDIR)/vmlinux-initramfs.srec $(KDIR)/vmlinux-initramfs.bin
endif
endef

define align/jffs2-64k
Expand Down Expand Up @@ -86,7 +91,7 @@ define Image/Build/EVA
endef

define Image/Build/Initramfs
$(CP) $(KDIR)/vmlinux.bin $(BIN_DIR)/$(IMG_PREFIX)-initramfs.bin
$(CP) $(KDIR)/vmlinux-initramfs.bin $(BIN_DIR)/$(IMG_PREFIX)-initramfs.bin
endef

ifeq ($(CONFIG_AR7_TI),y)
Expand Down
22 changes: 13 additions & 9 deletions target/linux/ar71xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ fs_64k:=64k
fs_64kraw:=64kraw
fs_128k:=128k
fs_256k:=256k
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
fs_squash:=initramfs
fs_64k:=initramfs
fs_64kraw:=initramfs
fs_128k:=initramfs
fs_256k:=initramfs
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
endif

define CompressLzma
$(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(3) $(2)
Expand Down Expand Up @@ -200,6 +191,15 @@ define Image/BuildKernel
$(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
$(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
cp $(KDIR)/loader-generic.elf $(VMLINUX)-lzma.elf
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
cp $(KDIR)/vmlinux-initramfs $(VMLINUX)-initramfs.bin
dd if=$(KDIR)/vmlinux-initramfs.bin.lzma of=$(VMLINUX)-initramfs.lzma bs=65536 conv=sync
dd if=$(KDIR)/vmlinux-initramfs.bin.gz of=$(VMLINUX)-initramfs.gz bs=65536 conv=sync
$(call MkuImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(UIMAGE)-initramfs-gzip.bin)
$(call MkuImage,lzma,,$(KDIR)/vmlinux-initramfs.bin.lzma,$(UIMAGE)-initramfs-lzma.bin)
cp $(KDIR)/loader-generic.elf $(VMLINUX)-initramfs-lzma.elf
endif
-mkdir -p $(KDIR_TMP)
$(call Image/Build/Initramfs)
endef
Expand Down Expand Up @@ -1030,6 +1030,10 @@ endef
define Image/Prepare
gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
$(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
gzip -9 -c $(KDIR)/vmlinux-initramfs > $(KDIR)/vmlinux-initramfs.bin.gz
$(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
endif
$(call Image/BuildLoader,generic,elf)
$(call Image/Build/Profile/$(if $(CONFIG_IB),Default,$(PROFILE)),loader)
endef
Expand Down
2 changes: 1 addition & 1 deletion target/linux/au1000/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ define Image/Prepare
endef

define Image/Build/Initramfs
$(OBJCOPY_SREC) $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.srec
$(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.srec
endef

define Image/Build
Expand Down
2 changes: 2 additions & 0 deletions target/linux/avr32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ define Target/Description
Build firmware images for ATNGW100 board
endef

KERNELNAME:="uImage"

$(eval $(call BuildTarget))
4 changes: 0 additions & 4 deletions target/linux/avr32/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ ifneq ($(CONFIG_AVR32_UBOOT),)
endef
endif

define Image/Prepare
cp $(LINUX_DIR)/arch/avr32/boot/images/uImage $(KDIR)/uImage
endef

define Image/BuildKernel
cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage

Expand Down
8 changes: 7 additions & 1 deletion target/linux/brcm47xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ endef

define Image/Prepare
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
cat $(KDIR)/vmlinux-initramfs | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux-initramfs.lzma
endif
rm -f $(KDIR)/loader.gz
$(MAKE) -C lzma-loader \
BUILD_DIR="$(KDIR)" \
Expand Down Expand Up @@ -120,7 +123,7 @@ define Image/Build/squashfs
endef

define Image/Build/Initramfs
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-initramfs.trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-initramfs.trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux-initramfs.lzma
endef

define Image/Build/Chk
Expand Down Expand Up @@ -148,6 +151,9 @@ define Image/Build
# $(call Image/Build/Chk,$(1),wnr3500U,U12H136T00_NETGEAR,2,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/Chk,$(1),wnr3500v2,U12H127T00_NETGEAR,2,$(patsubst jffs2-%,jffs2,$(1)))
# $(call Image/Build/Chk,$(1),wnr3500v2_VC,U12H127T70_NETGEAR,2,$(patsubst jffs2-%,jffs2,$(1)))
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
$(call Image/Build/Initramfs)
endif
endef

$(eval $(call BuildImage))
2 changes: 1 addition & 1 deletion target/linux/brcm63xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ endef

define Image/Build/Initramfs
# Netgear CVG834G
$(call Image/Build/HCS,initramfs,cvg834g,a020,0001,0022,$(KDIR)/vmlinux)
$(call Image/Build/HCS,initramfs,cvg834g,a020,0001,0022,$(KDIR)/vmlinux-initramfs)
endef

define Image/Build
Expand Down
2 changes: 2 additions & 0 deletions target/linux/cns21xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ define Target/Description
Build firmware images for Cavium Networks CNS21XX based boards.
endef

KERNELNAME:="zImage uImage"

$(eval $(call BuildTarget))
2 changes: 1 addition & 1 deletion target/linux/cns21xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endef

define prepare_zimage
echo -en "\x$(2)\x1c\xa0\xe3\x$(3)\x10\x81\xe3" > $(KDIR)/$(call zimage_name,$(1))
cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(call zimage_name,$(1))
cat $(KDIR)/zImage >> $(KDIR)/$(call zimage_name,$(1))
endef

define prepare_uimage
Expand Down
2 changes: 1 addition & 1 deletion target/linux/cns3xxx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define Target/Description
eg. the Gateworks Laguna family
endef

KERNELNAME:="uImage"
KERNELNAME:="zImage uImage"

DEFAULT_PACKAGES += kmod-ath9k kmod-usb2 wpad-mini

Expand Down
2 changes: 1 addition & 1 deletion target/linux/cns3xxx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

define mkimage
mkimage -A arm -O linux -T kernel -C none -a $(2) -e $(2) -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/uImage-$(1)
mkimage -A arm -O linux -T kernel -C none -a $(2) -e $(2) -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage $(KDIR)/uImage-$(1)
endef

define Image/Prepare
Expand Down
16 changes: 3 additions & 13 deletions target/linux/ep93xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,12 @@ fs_all:=all
fs_4k:=4k
fs_64k:=64k
fs_128k:=128k
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
fs_squash:=initramfs
fs_all:=initramfs
fs_4k:=initramfs
fs_64k:=initramfs
fs_128k:=initramfs
UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
endif


define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
endef

define Image/BuildKernel
cp $(KDIR)/uImage $(UIMAGE)
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
cp $(KDIR)/uImage-initramfs $(UIMAGE)-initramfs
endif
endef

define Image/Build/jffs2-64k
Expand Down
2 changes: 2 additions & 0 deletions target/linux/gemini/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ MAINTAINER:=Imre Kaloz <[email protected]>

LINUX_VERSION:=3.9.4

KERNELNAME:="zImage"

include $(INCLUDE_DIR)/target.mk

$(eval $(call BuildTarget))
4 changes: 2 additions & 2 deletions target/linux/gemini/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/image.mk
define Image/Prepare
# WBD111: mach id 1690 (0x69a)
echo -en "\x06\x1c\xa0\xe3\x9a\x10\x81\xe3" > $(KDIR)/$(IMG_PREFIX)-wbd111-zImage
cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd111-zImage
cat $(KDIR)/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd111-zImage
# WBD222: mach id 2753 (0xAC1)
echo -en "\x0a\x1c\xa0\xe3\xc1\x10\x81\xe3" > $(KDIR)/$(IMG_PREFIX)-wbd222-zImage
cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd222-zImage
cat $(KDIR)/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd222-zImage
endef

define Image/BuildKernel
Expand Down
2 changes: 1 addition & 1 deletion target/linux/imx6/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define Image/BuildKernel
$(call mkfit,$(board),0x10008000)
cp $(LINUX_DIR)/arch/arm/boot/dts/$(board).dtb $(BIN_DIR)
)
cp $(LINUX_DIR)/arch/arm/boot/zImage $(BIN_DIR)/openwrt-$(BOARD)-zImage
cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-zImage
endef

# board-specific sysupgrade image
Expand Down
2 changes: 2 additions & 0 deletions target/linux/iop32x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ LINUX_VERSION:=3.3.8

include $(INCLUDE_DIR)/target.mk

KERNELNAME:="zImage"

$(eval $(call BuildTarget))
4 changes: 0 additions & 4 deletions target/linux/iop32x/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
endef

define Image/BuildKernel
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
#
Expand Down
1 change: 1 addition & 0 deletions target/linux/ixp4xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ LINUX_VERSION:=3.3.8
include $(INCLUDE_DIR)/target.mk

DEFAULT_PACKAGES += ixp4xx-microcode fconfig
KERNELNAME:="zImage"

$(eval $(call BuildTarget))
4 changes: 0 additions & 4 deletions target/linux/ixp4xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ define Image/Build/Freecom
rm -f $(TARGET_DIR)/zImage
endef

define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
endef

define Image/BuildKernel
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
BIN_DIR=$(BIN_DIR) IMG_PREFIX="$(IMG_PREFIX)" $(TOPDIR)/scripts/arm-magic.sh
Expand Down
4 changes: 0 additions & 4 deletions target/linux/kirkwood/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ include $(INCLUDE_DIR)/image.mk

NAND_BLOCKSIZE := 2048:128k

define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
endef

define Image/BuildKernel
# do mach-id fixup here, if needed
cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
Expand Down
23 changes: 11 additions & 12 deletions target/linux/mcs814x/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,17 @@ LOADADDR:=0x00008000
JFFS2_BLOCKSIZE = 128k

UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
endif

define Image/Build/MkuImage
mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
-n 'ARM OpenWrt Linux-$(LINUX_VERSION)' -d $(1) $(2);
endef

define Image/Build/DTB
cp $(KDIR)/zImage $(KDIR)/zImage-$(1);
cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(1).dtb >> $(KDIR)/zImage-$(1);
$(call Image/Build/MkuImage,$(KDIR)/zImage-$(1),$(KDIR)/uImage-$(1))
cp $(KDIR)/uImage-$(1) $(UIMAGE)-$(1);
endef

define Image/Prepare
cp $(LINUX_DIR)/arch/$(ARCH)/boot/zImage $(KDIR)/zImage
cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1);
cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
$(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
endef

define Image/Build/Profile/dLAN_USB_Extender
Expand All @@ -42,7 +35,10 @@ endef

define Image/BuildKernel
$(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
$(call Image/Build/Initramfs)
endef

define Image/Build/Initramfs
$(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
endef

define Image/Build/squashfs
Expand All @@ -53,6 +49,9 @@ define Image/Build
$(call Image/Build/$(1))
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
$(call Image/Build/Profile/$(PROFILE),$(1))
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
$(call Image/Build/Initramfs)
endif
endef

$(eval $(call BuildImage))
2 changes: 2 additions & 0 deletions target/linux/mpc52xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ define Target/Description
Build images for the Freescale MPC52xx based boards.
endef

KERNELNAME:="zImage"

$(eval $(call BuildTarget))
4 changes: 0 additions & 4 deletions target/linux/mpc52xx/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

define Image/Prepare
cp $(LINUX_DIR)/arch/powerpc/boot/zImage $(KDIR)/zImage
endef

define Image/BuildKernel
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
endef
Expand Down
2 changes: 2 additions & 0 deletions target/linux/mpc83xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ define Target/Description
Build firmware images for Freescale MPC83xx based boards (eg. RouterBoard 600).
endef

KERNELNAME:="uImage"

$(eval $(call BuildTarget))
Loading

0 comments on commit 6a4f292

Please sign in to comment.