2010-02-28 11:09:34 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2013-01-12 12:29:52 +00:00
|
|
|
define CompressLzma
|
|
|
|
$(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define CompressGzip
|
2015-07-14 09:57:45 +00:00
|
|
|
gzip -9n -c $(1) > $(2)
|
2013-01-12 12:29:52 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define MkuImage
|
|
|
|
mkimage -A mips -O linux -T kernel -a 0x80100000 -C $(1) $(2) \
|
2017-01-13 18:19:34 +00:00
|
|
|
-e 0x80100000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
|
2013-01-12 12:29:52 +00:00
|
|
|
-d $(3) $(4)
|
|
|
|
endef
|
|
|
|
|
2015-05-28 12:05:57 +00:00
|
|
|
define Image/Prepare
|
2013-01-12 12:29:52 +00:00
|
|
|
$(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
|
2015-05-28 12:05:57 +00:00
|
|
|
$(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
|
2013-01-12 12:29:52 +00:00
|
|
|
$(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
|
2015-05-28 12:05:57 +00:00
|
|
|
$(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(KDIR)/uImage.gz)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/BuildKernel
|
2017-10-13 12:21:53 +00:00
|
|
|
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
|
2015-05-28 12:05:57 +00:00
|
|
|
cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(IMG_PREFIX)-uImage-lzma
|
|
|
|
cp $(KDIR)/uImage.gz $(BIN_DIR)/$(IMG_PREFIX)-uImage-gzip
|
2010-02-28 11:09:34 +00:00
|
|
|
endef
|
|
|
|
|
2015-01-14 12:09:33 +00:00
|
|
|
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
|
|
|
|
|
2019-03-28 14:34:26 +00:00
|
|
|
define Image/Build/gzip
|
|
|
|
gzip -f9n $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call Image/gzip-ext4-padded-squashfs))
|
|
|
|
|
2010-02-28 11:09:34 +00:00
|
|
|
define Image/Build
|
|
|
|
$(call Image/Build/$(1))
|
2019-03-28 14:34:26 +00:00
|
|
|
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img
|
|
|
|
$(call Image/Build/gzip/$(1))
|
2010-02-28 11:09:34 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildImage))
|