2 # Copyright (C) 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
11 include $(INCLUDE_DIR
)/image.mk
15 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),y
)
16 INITRAMFS_SUFFIX
:=-initramfs
20 $(IMG_PREFIX
)-$(1)-zImage
$(INITRAMFS_SUFFIX
)
24 $(IMG_PREFIX
)-$(1)-uImage
$(INITRAMFS_SUFFIX
)
28 $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(patsubst jffs2-
%,jffs2
,$(patsubst squashfs-
%,squashfs
,$(1)))
32 $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-root.
$(patsubst jffs2-
%,jffs2
,$(patsubst squashfs-
%,squashfs
,$(1)))
36 dd if
=$(KDIR
)/root.squashfs of
=$(KDIR
)/root.squashfs-
$(1) bs
=$(1) conv
=sync
37 $(call add_jffs2_mark
,$(KDIR
)/root.squashfs-
$(1))
38 dd if
=$(KDIR
)/root.squashfs-
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.squashfs-
$(1) bs
=$(1) conv
=sync
42 echo
-en
"\x$(2)\x1c\xa0\xe3\x$(3)\x10\x81\xe3" > $(KDIR
)/$(call zimage_name
,$(1))
43 cat
$(LINUX_DIR
)/arch
/arm
/boot
/zImage
>> $(KDIR
)/$(call zimage_name
,$(1))
47 $(call prepare_zimage
,$(1),$(2),$(3))
48 mkimage
-A arm
-O linux
-T kernel
-a
0x100000 -e
0x100000 -C none \
49 -n
'OpenWrt Linux-$(LINUX_VERSION)' \
50 -d
$(KDIR
)/$(call zimage_name
,$(1)) \
51 $(KDIR
)/$(call uimage_name
,$(1))
55 # NSB3AST : mach id 2917 (0xb65)
56 $(call prepare_zimage
,nsb3ast
,0b
,65)
57 # NS-K330 : mach id 3108 (0xc24)
58 $(call prepare_zimage
,ns-k330
,0c
,24)
61 define Image
/BuildKernel
62 cat
$(KDIR
)/$(call zimage_name
,nsb3ast
) > $(BIN_DIR
)/$(call zimage_name
,nsb3ast
)
63 cat
$(KDIR
)/$(call zimage_name
,ns-k330
) > $(BIN_DIR
)/$(call zimage_name
,ns-k330
)
66 define Image
/Build
/Generic
67 if
[ `stat -c%s "$(KDIR)/$(call zimage_name,$(2))"` -gt
1048576 ]; then \
68 echo
"Warning: $(KDIR)/$(call zimage_name,$(2)) is too big"; \
69 else if
[ `stat -c%s $(KDIR)/root.$(1)` -gt
$(3) ]; then \
70 echo
"Warning: of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) is too big"; \
72 cat
$(KDIR
)/root.
$(1) > $(call rootfsname
,$(1),$(2)); \
74 dd if
=$(KDIR
)/$(call zimage_name
,$(2)) bs
=1024k conv
=sync
; \
75 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) \
76 ) > $(call imgname
,$(1),$(2)).img
; \
80 define Image
/Build
/uImage
81 if
[ `stat -c%s "$(KDIR)/$(call uimage_name,$(2))"` -gt
1048576 ]; then \
82 echo
"Warning: $(KDIR)/$(call uimage_name,$(2)) is too big"; \
83 else if
[ `stat -c%s $(KDIR)/root.$(1)` -gt
$(3) ]; then \
84 echo
"Warning: of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) is too big"; \
86 cat
$(KDIR
)/root.
$(1) > $(call rootfsname
,$(1),$(2)); \
88 dd if
=$(KDIR
)/$(call uimage_name
,$(2)) bs
=1024k conv
=sync
; \
89 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) \
90 ) > $(call imgname
,$(1),$(2))-uImage.img
; \
94 define Image
/Build
/NSB3AST
95 $(call Image
/Build
/Generic
,$(1),nsb3ast
,7077888)
98 define Image
/Build
/NSK330
99 $(call Image
/Build
/Generic
,$(1),ns-k330
,2686976)
102 define Image
/Build
/squashfs
103 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
105 $(call build_squashfs
,64k
)
106 $(call Image
/Build
/NSB3AST
,squashfs-64k
)
107 $(call Image
/Build
/NSK330
,squashfs-64k
)
110 define Image
/Build
/jffs2-64k
111 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=64k conv
=sync
115 $(call Image
/Build
/$(1),$(1))
118 $(eval
$(call BuildImage
))