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_uimage
,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
)
64 cat
$(KDIR
)/$(call uimage_name
,ns-k330
) > $(BIN_DIR
)/$(call uimage_name
,ns-k330
)
67 define Image
/Build
/Generic
68 if
[ `stat -c%s "$(KDIR)/$(call zimage_name,$(2))"` -gt
1048576 ]; then \
69 echo
"Warning: $(KDIR)/$(call zimage_name,$(2)) is too big"; \
70 else if
[ `stat -c%s $(KDIR)/root.$(1)` -gt
$(3) ]; then \
71 echo
"Warning: of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) is too big"; \
73 cat
$(KDIR
)/root.
$(1) > $(call rootfsname
,$(1),$(2)); \
75 dd if
=$(KDIR
)/$(call zimage_name
,$(2)) bs
=1024k conv
=sync
; \
76 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) \
77 ) > $(call imgname
,$(1),$(2)).img
; \
81 define Image
/Build
/uImage
82 if
[ `stat -c%s "$(KDIR)/$(call uimage_name,$(2))"` -gt
1048576 ]; then \
83 echo
"Warning: $(KDIR)/$(call uimage_name,$(2)) is too big"; \
84 else if
[ `stat -c%s $(KDIR)/root.$(1)` -gt
$(3) ]; then \
85 echo
"Warning: of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) is too big"; \
87 cat
$(KDIR
)/root.
$(1) > $(call rootfsname
,$(1),$(2)); \
89 dd if
=$(KDIR
)/$(call uimage_name
,$(2)) bs
=1024k conv
=sync
; \
90 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) \
91 ) > $(call imgname
,$(1),$(2))-uImage.img
; \
95 define Image
/Build
/NSB3AST
96 $(call Image
/Build
/Generic
,$(1),nsb3ast
,7077888)
99 define Image
/Build
/NSK330
100 $(call Image
/Build
/Generic
,$(1),ns-k330
,2686976)
101 $(call Image
/Build
/uImage
,$(1),ns-k330
,2686976)
104 define Image
/Build
/squashfs
105 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
107 $(call build_squashfs
,64k
)
108 $(call Image
/Build
/NSB3AST
,squashfs-64k
)
109 $(call Image
/Build
/NSK330
,squashfs-64k
)
112 define Image
/Build
/jffs2-64k
113 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=64k conv
=sync
117 $(call Image
/Build
/$(1),$(1))
120 $(eval
$(call BuildImage
))