madwifi: fix static bssid setting for ad-hoc mode
[openwrt.git] / include / image.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(INCLUDE_DIR)/prereq.mk
9 include $(INCLUDE_DIR)/kernel.mk
10 include $(INCLUDE_DIR)/host.mk
11 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
12
13 ifneq ($(CONFIG_BIG_ENDIAN),y)
14 JFFS2OPTS := --pad --little-endian --squash
15 SQUASHFS_OPTS := -le
16 else
17 JFFS2OPTS := --pad --big-endian --squash
18 SQUASHFS_OPTS := -be
19 endif
20
21 define add_jffs2_mark
22 echo -ne '\xde\xad\xc0\xde' >> $(1)
23 endef
24
25 # pad to 64k and add jffs2 end-of-filesystem mark
26 # do this twice to make sure that this works with 128k blocksize as well
27 define prepare_generic_squashfs
28 dd if=$(1) of=$(KDIR)/tmpfile.1 bs=64k conv=sync
29 $(call add_jffs2_mark,$(KDIR)/tmpfile.1)
30 dd of=$(1) if=$(KDIR)/tmpfile.1 bs=64k conv=sync
31 $(call add_jffs2_mark,$(1))
32 endef
33
34 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
35 ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
36 define Image/mkfs/jffs2
37 rm -rf $(BUILD_DIR)/root/jffs
38
39 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $(KDIR)/root.jffs2-64k -d $(BUILD_DIR)/root
40 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $(KDIR)/root.jffs2-128k -d $(BUILD_DIR)/root
41
42
43 # add End-of-Filesystem markers
44 $(call add_jffs2_mark,$(KDIR)/root.jffs2-64k)
45 $(call add_jffs2_mark,$(KDIR)/root.jffs2-128k)
46
47 $(call Image/Build,jffs2-64k)
48 $(call Image/Build,jffs2-128k)
49 endef
50 endif
51
52 ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y)
53 define Image/mkfs/squashfs
54 @mkdir -p $(BUILD_DIR)/root/jffs
55 $(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS)
56 $(call Image/Build,squashfs)
57 endef
58 endif
59
60 ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y)
61 define Image/mkfs/tgz
62 tar -zcf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tgz --owner=root --group=root -C $(BUILD_DIR)/root/ .
63 endef
64 endif
65 else
66 define Image/BuildKernel
67 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf
68 endef
69 endif
70
71
72 ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS),y)
73 E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_FSPART)*1024)))
74
75 define Image/mkfs/ext2
76 $(STAGING_DIR)/bin/genext2fs -U -b $(E2SIZE) -I $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
77 $(call Image/Build,ext2)
78 endef
79 endif
80
81
82 define Image/mkfs/prepare/default
83 find $(BUILD_DIR)/root -type f -not -perm +0100 -not -name 'ssh_host*' | $(XARGS) chmod 0644
84 find $(BUILD_DIR)/root -type f -perm +0100 | $(XARGS) chmod 0755
85 find $(BUILD_DIR)/root -type d | $(XARGS) chmod 0755
86 mkdir -p $(BUILD_DIR)/root/tmp
87 chmod 0777 $(BUILD_DIR)/root/tmp
88 endef
89
90 define Image/mkfs/prepare
91 $(call Image/mkfs/prepare/default)
92 endef
93
94 define BuildImage
95 download:
96 prepare:
97 ifneq ($(IB),1)
98 compile: compile-targets
99 $(call Build/Compile)
100 else
101 compile:
102 endif
103
104 ifneq ($(IB),1)
105 install: compile install-targets
106 $(call Image/Prepare)
107 $(call Image/mkfs/prepare)
108 $(call Image/BuildKernel)
109 $(call Image/mkfs/jffs2)
110 $(call Image/mkfs/squashfs)
111 $(call Image/mkfs/tgz)
112 $(call Image/mkfs/ext2)
113 else
114 install: compile install-targets
115 $(call Image/BuildKernel)
116 $(call Image/mkfs/jffs2)
117 $(call Image/mkfs/squashfs)
118 $(call Image/mkfs/tgz)
119 $(call Image/mkfs/ext2)
120 endif
121
122 ifneq ($(IB),1)
123 clean: clean-targets
124 $(call Build/Clean)
125 else
126 clean:
127 endif
128
129 compile-targets:
130 install-targets:
131 clean-targets:
132 endef
133
134
This page took 0.053187 seconds and 5 git commands to generate.