adace07dc42970c13697f8e19e2ed7e35caf63f2
[openwrt/svn-archive/archive.git] / target / image / x86 / 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 ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART)))
11 #")) # fix vim's broken syntax highlighting
12
13
14 ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
15 define Build/Compile
16 $(MAKE) -C grub compile
17 endef
18
19 define Build/Clean
20 $(MAKE) -C grub clean
21 endef
22
23 define Image/cmdline/jffs2-64k
24 block2mtd.block2mtd=$(ROOTPART),65536 root=/dev/mtdblock0 rootfstype=jffs2
25 endef
26
27 define Image/cmdline/jffs2-128k
28 block2mtd.block2mtd=$(ROOTPART),131072 root=/dev/mtdblock0 rootfstype=jffs2
29 endef
30
31 define Image/cmdline/ext2
32 root=$(ROOTPART) rootfstype=ext2 $(CONFIG_X86_GRUB_BOOTOPTS)
33 endef
34
35 define Image/Build/grub
36 mkdir -p $(KDIR)/root.grub/boot/grub
37 $(CP) \
38 $(STAGING_DIR)/usr/lib/grub/i386-pc/stage1 \
39 $(STAGING_DIR)/usr/lib/grub/i386-pc/stage2 \
40 $(STAGING_DIR)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
41 $(KDIR)/root.grub/boot/grub/
42 $(CP) $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/root.grub/boot/vmlinuz
43 sed \
44 -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)))#g' \
45 -e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
46 ./grub/menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
47 PATH="$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/bin:$(PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
48 endef
49 endif
50
51 define Image/Build
52 $(call Image/Build/grub,$(1))
53 cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).fs
54 cp $(LINUX_DIR)/arch/i386/boot/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
55 endef
56
57
58 $(eval $(call BuildImage))