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
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
$(KDIR
)/vmlinux.elf.stripped
15 define Image
/BuildKernel
/Template
16 $(CP
) $(KDIR
)/vmlinux.elf.stripped
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64
17 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64 '$(strip $(2))'
18 md5sum
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64 | cut
-d
" " -f
1 | tee
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
.64.md5
21 define Image
/BuildKernel
/Initramfs
/Template
22 $(TARGET_CROSS
)strip -R .notes
$(KDIR
)/vmlinux-initramfs.elf
-o
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs.elf
23 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs.elf
'$(strip $(2))'
26 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
27 ERLITE_CMDLINE
:=-mtdparts
=phys_mapped_flash
:512k
(boot0
),512k
(boot1
),64k@
1024k
(eeprom
) block2mtd.block2mtd
=/dev
/sda2
,65536,rootfs
,5 root
=/dev
/mtdblock3 rootfstype
=squashfs rootwait
29 define Image
/BuildKernel
30 $(call Image
/BuildKernel
/Template
,generic
,)
31 $(call Image
/BuildKernel
/Template
,er
,$(ER_CMDLINE
))
32 $(call Image
/BuildKernel
/Template
,erlite
,$(ERLITE_CMDLINE
))
35 define Image
/BuildKernel
/Initramfs
36 $(call Image
/BuildKernel
/Initramfs
/Template
,generic
,)
37 $(call Image
/BuildKernel
/Initramfs
/Template
,er
,$(ER_CMDLINE
))
38 $(call Image
/BuildKernel
/Initramfs
/Template
,erlite
,$(ERLITE_CMDLINE
))
41 define Image
/Build
/sysupgrade
42 mkdir
-p
$(KDIR
)/sysupgrade-
$(1)/
43 echo
"BOARD=$(1)" > $(KDIR
)/sysupgrade-
$(1)/CONTROL
44 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-vmlinux
.64 $(KDIR
)/sysupgrade-
$(1)/kernel
45 $(CP
) $(KDIR
)/root.
$(3) $(KDIR
)/sysupgrade-
$(1)/root
46 (cd
$(KDIR
); $(TAR
) cvf \
47 $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-$(3)-sysupgrade.
tar sysupgrade-
$(1))
50 define Image
/Build
/ext4
51 $(call Image
/Build
/sysupgrade
,erlite
,generic
,ext4
)
54 define Image
/Build
/squashfs
55 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
56 $(call Image
/Build
/sysupgrade
,er
,er
,squashfs
)
57 $(call Image
/Build
/sysupgrade
,erlite
,erlite
,squashfs
)
61 $(call Image
/Build
/$(1))
62 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=128k conv
=sync
65 $(eval
$(call BuildImage
))