mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 18:47:06 +00:00
6f528dfbd9
IMG_PREFIX can be modified in ImageBuilder by passing EXTRA_IMAGE_NAME on command line, but Image/Prepare is not run in ImageBuilder. This causes missing files when IMG_PREFIX is used for target file names in Image/Prepare, then as source file names in Image/BuildKernel or Image/Build. Fix this by using a fixed output file name in Image/Prepare, and copy to the expected file name in Image/BuildKernel instead, which is run by ImageBuilder. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
52 lines
1.4 KiB
Makefile
52 lines
1.4 KiB
Makefile
#
|
|
# Copyright (C) 2010 OpenWrt.org
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
include $(TOPDIR)/rules.mk
|
|
include $(INCLUDE_DIR)/image.mk
|
|
|
|
define CompressLzma
|
|
$(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
|
|
endef
|
|
|
|
define CompressGzip
|
|
gzip -9n -c $(1) > $(2)
|
|
endef
|
|
|
|
define MkuImage
|
|
mkimage -A mips -O linux -T kernel -a 0x80100000 -C $(1) $(2) \
|
|
-e 0x80100000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
|
|
-d $(3) $(4)
|
|
endef
|
|
|
|
define Image/Prepare
|
|
$(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
|
|
$(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
|
|
$(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
|
|
$(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(KDIR)/uImage.gz)
|
|
endef
|
|
|
|
define Image/BuildKernel
|
|
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
|
|
cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(IMG_PREFIX)-uImage-lzma
|
|
cp $(KDIR)/uImage.gz $(BIN_DIR)/$(IMG_PREFIX)-uImage-gzip
|
|
endef
|
|
|
|
define Image/Build/squashfs
|
|
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
|
|
endef
|
|
|
|
define Image/Build/Initramfs
|
|
cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.elf
|
|
cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.bin
|
|
endef
|
|
|
|
define Image/Build
|
|
$(call Image/Build/$(1))
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
|
|
endef
|
|
|
|
$(eval $(call BuildImage))
|