2 # Copyright (C) 2009-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
10 define Image
/BuildKernel
/Template
11 # Workaround pre-SDK-1.9.0 u-boot versions not handling the .notes section
12 $(TARGET_CROSS
)strip -R .notes
$(KDIR
)/vmlinux.elf
-o
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64
13 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64 '$(strip $(2))'
14 md5sum
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64 | cut
-d
" " -f
1 | tee
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64.md5
17 define Image
/BuildKernel
/Initramfs
/Template
18 $(TARGET_CROSS
)strip -R .notes
$(KDIR
)/vmlinux-initramfs.elf
-o
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs.elf
19 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs.elf
'$(strip $(2))'
22 ER_CMDLINE
:=-mtdparts
=phys_mapped_flash
:640k
(boot0
)ro
,640k
(boot1
)ro
,64k
(eeprom
)ro block2mtd.block2mtd
=/dev
/mmcblk0p2
,65536,rootfs
,5 root
=/dev
/mtdblock3 rootfstype
=squashfs rootwait
24 define Image
/BuildKernel
25 $(call Image
/BuildKernel
/Template
,generic
,)
26 $(call Image
/BuildKernel
/Template
,er
,$(ER_CMDLINE
))
29 define Image
/BuildKernel
/Initramfs
30 $(call Image
/BuildKernel
/Initramfs
/Template
,generic
,)
31 $(call Image
/BuildKernel
/Initramfs
/Template
,er
,$(ER_CMDLINE
))
34 define Image
/Build
/sysupgrade
35 mkdir
-p
$(KDIR
)/sysupgrade-
$(1)/
36 echo
"BOARD=er" > $(KDIR
)/sysupgrade-
$(1)/CONTROL
37 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-vmlinux
.64 $(KDIR
)/sysupgrade-
$(1)/kernel
38 $(CP
) $(KDIR
)/root.
$(3) $(KDIR
)/sysupgrade-
$(1)/root
39 (cd
$(KDIR
); $(TAR
) cvf \
40 $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-sysupgrade.
tar sysupgrade-
$(1))
43 define Image
/Build
/ext4
44 $(call Image
/Build
/sysupgrade
,erlite
,generic
,ext4
)
47 define Image
/Build
/squashfs
48 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
49 $(call Image
/Build
/sysupgrade
,er
,er
,squashfs
)
53 $(call Image
/Build
/$(1))
54 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=128k conv
=sync
57 $(eval
$(call BuildImage
))