ar71xx: fix WLAN mac address on the TL-WR1043ND
[openwrt.git] / target / linux / x86 / image / Makefile
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 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 export PATH=$(TARGET_PATH):/sbin
11
12 ifneq ($(CONFIG_TARGET_x86_olpc),y)
13 BOOTOPTS=$(strip $(subst ",, $(CONFIG_X86_GRUB_BOOTOPTS)))
14 ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART)))
15 #"))")) # fix vim's broken syntax highlighting
16 endif
17
18 ifeq ($(CONFIG_TARGET_x86_olpc),y)
19 ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_BOOTSCRIPT_ROOTPART)))
20 endif
21 #"))")) # fix vim's broken syntax highlighting
22
23 ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
24 ifneq ($(HOST_OS),Darwin)
25 define Image/cmdline/squashfs
26 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootwait
27 endef
28
29 define Image/cmdline/jffs2-64k
30 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootwait
31 endef
32
33 define Image/cmdline/jffs2-128k
34 block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootwait
35 endef
36
37 define Image/cmdline/ext2
38 root=$(ROOTPART) rootfstype=ext2 rootwait
39 endef
40
41 define Image/Build/grub
42 # left here because the image builder doesnt need these
43 $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
44 $(CP) \
45 $(KDIR)/*stage* \
46 $(KDIR)/root.grub/boot/grub/
47 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
48 sed \
49 -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
50 -e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
51 ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
52 PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_x86.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
53 $(call Image/Build/grub/$(1))
54 endef
55
56 define Image/Prepare/grub
57 # for the image builder
58 $(CP) \
59 $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/stage1 \
60 $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/stage2 \
61 $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/e2fs_stage1_5 \
62 $(KDIR)/
63 endef
64 else
65 define Image/Build/grub
66 PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" NOGRUB=1 ./gen_image_x86.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) "" $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
67 endef
68 endif
69 endif
70
71 ifeq ($(CONFIG_X86_VDI_IMAGES),y)
72 define Image/Build/vdi
73 # left here because the image builder doesnt need these
74 ifeq ($(1),ext2)
75 rm $(BIN_DIR)/openwrt-$(BOARD)-ext2.vdi || true
76 VBoxManage convertfromraw -format VDI $(BIN_DIR)/openwrt-$(BOARD)-ext2.image $(BIN_DIR)/openwrt-$(BOARD)-ext2.vdi
77 endif
78 endef
79 endif
80
81 ifeq ($(CONFIG_X86_VMDK_IMAGES),y)
82 define Image/Build/vmdk
83 # left here because the image builder doesnt need these
84 ifeq ($(1),ext2)
85 rm $(BIN_DIR)/openwrt-$(BOARD)-ext2.vmdk || true
86 qemu-img convert -f raw $(BIN_DIR)/openwrt-$(BOARD)-ext2.image \
87 -O vmdk $(BIN_DIR)/openwrt-$(BOARD)-ext2.vmdk
88 endif
89 endef
90 endif
91
92 ROOTDELAY=10
93
94 ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y)
95 define Image/cmdline/squashfs
96 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootdelay=$(ROOTDELAY)
97 endef
98
99 define Image/cmdline/jffs2-64k
100 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
101 endef
102
103 define Image/cmdline/jffs2-128k
104 block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
105 endef
106
107 define Image/cmdline/ext2
108 root=$(ROOTPART) rootfstype=ext2 rootwait
109 endef
110
111 define Image/Build/bootscript
112 # left here because the image builder doesnt need these
113 $(INSTALL_DIR) $(KDIR)/root.bootscript/boot
114 $(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz
115 sed -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
116 ./olpc.fth > $(KDIR)/root.bootscript/boot/olpc.fth
117 PADDING="$(CONFIG_OLPC_BOOTSCRIPT_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_olpc.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_OLPC_BOOTSCRIPT_KERNELPART) $(KDIR)/root.bootscript $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
118 endef
119 endif
120
121 define Image/Prepare
122 $(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
123 ifeq ($(CONFIG_TARGET_x86_olpc),y)
124 $(call Image/Prepare/bootscript)
125 else
126 $(call Image/Prepare/grub)
127 endif
128 endef
129
130 define Image/Build/squashfs
131 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
132 endef
133
134 define Image/Build/iso
135 $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
136 $(CP) \
137 $(STAGING_DIR_HOST)/usr/lib/grub/i386-openwrt/stage2_eltorito \
138 $(KDIR)/root.grub/boot/grub/stage2_eltorito
139 sed \
140 -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
141 -e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
142 -e 's#(hd0,0)#(cd)#g' \
143 ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
144 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
145 mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table \
146 -o $(KDIR)/root.iso $(KDIR)/root.grub
147 endef
148
149 define Image/BuildKernel
150 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
151 endef
152
153 define Image/Build
154 $(call Image/Build/$(1))
155 $(call Image/Build/bootscript,$(1))
156 ifneq ($(1),iso)
157 $(call Image/Build/grub,$(1))
158 $(call Image/Build/vdi,$(1))
159 $(call Image/Build/vmdk,$(1))
160 endif
161 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1).fs
162 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
163 endef
164
165 $(eval $(call BuildImage))
166
167 ifeq ($(CONFIG_X86_VDI_IMAGES),y)
168 $(eval $(call RequireCommand,VBoxManage, \
169 You need VBoxManage to generate VirtualBox images. \
170 ))
171 endif
172
173 ifeq ($(CONFIG_X86_VMDK_IMAGES),y)
174 $(eval $(call RequireCommand,qemu-img, \
175 You need qemu-img to generate VMware images. \
176 ))
177 endif
This page took 0.047558 seconds and 5 git commands to generate.