2010-02-28 19:09:34 +08: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 20:29:52 +08:00
|
|
|
define get_kernel_entry
|
|
|
|
0x$(shell $(TARGET_CROSS)nm $(1) 2>/dev/null | grep " kernel_entry" | cut -f1 -d ' ')
|
|
|
|
endef
|
|
|
|
|
|
|
|
define CompressLzma
|
|
|
|
$(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define CompressGzip
|
|
|
|
gzip -9 -c $(1) > $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define MkuImage
|
|
|
|
mkimage -A mips -O linux -T kernel -a 0x80100000 -C $(1) $(2) \
|
2014-07-22 02:42:11 +08:00
|
|
|
-e $(call get_kernel_entry,$(KDIR)/vmlinux.debug) -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
|
2013-01-12 20:29:52 +08:00
|
|
|
-d $(3) $(4)
|
|
|
|
endef
|
|
|
|
|
2010-02-28 19:09:34 +08:00
|
|
|
define Image/BuildKernel
|
2010-04-13 07:15:56 +08:00
|
|
|
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
|
2013-01-12 20:29:52 +08:00
|
|
|
$(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
|
|
|
|
$(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(BIN_DIR)/$(IMG_PREFIX)-uImage-lzma)
|
|
|
|
$(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
|
|
|
|
$(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(IMG_PREFIX)-uImage-gzip)
|
2010-02-28 19:09:34 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/squashfs
|
|
|
|
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build
|
|
|
|
$(call Image/Build/$(1))
|
2010-04-13 07:15:56 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
|
2010-02-28 19:09:34 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildImage))
|