57eebb1958252d2290ee1bf575434333267a908c
[openwrt/openwrt.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 VMLINUX:=openwrt-$(BOARD)-vmlinux
11
12 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
13 VMLINUX:=openwrt-$(BOARD)-vmlinux-initramfs
14 endif
15
16 define Image/BuildKernel
17 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
18 cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
19 gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
20 $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
21 dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/$(VMLINUX).lzma bs=65536 conv=sync
22 dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/$(VMLINUX).gz bs=65536 conv=sync
23 $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma
24 mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \
25 0x80060000 \
26 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
27 -d $(KDIR)/vmlinux.bin.gz $(BIN_DIR)/openwrt-$(BOARD)-uImage.gz
28 endef
29
30 define Image/Build/squashfs
31 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
32 endef
33
34 define Image/Build
35 $(call Image/Build/$(1))
36 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync
37 endef
38
39
40 $(eval $(call BuildImage))