2 # Copyright (C) 2006 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
8 include $(INCLUDE_DIR
)/image.mk
10 export PATH
=$(TARGET_PATH
):/sbin
11 BOOTOPTS
=$(strip $(subst ",, $(CONFIG_X86_GRUB_BOOTOPTS)))
12 ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART
)))
13 #"))")) # fix vim's broken syntax highlighting
16 ifeq ($(CONFIG_X86_GRUB_IMAGES
),y
)
17 ifneq ($(HOST_OS
),Darwin
)
18 define Image
/cmdline
/squashfs
19 block2mtd.block2mtd
=$(ROOTPART
),65536,rootfs root
=/dev
/mtdblock0 rootfstype
=squashfs init
=/etc
/preinit
22 define Image
/cmdline
/jffs2-64k
23 block2mtd.block2mtd
=$(ROOTPART
),65536,rootfs root
=/dev
/mtdblock0 rootfstype
=jffs2 init
=/etc
/preinit
26 define Image
/cmdline
/jffs2-128k
27 block2mtd.block2mtd
=$(ROOTPART
),131072,rootfs root
=/dev
/mtdblock0 rootfstype
=jffs2 init
=/etc
/preinit
30 define Image
/cmdline
/ext2
31 root
=$(ROOTPART
) rootfstype
=ext2 init
=/etc
/preinit
34 define Image
/Build
/grub
35 # left here because the image builder doesnt need these
36 $(INSTALL_DIR
) $(KDIR
)/root.grub
/boot
/grub
39 $(KDIR
)/root.grub
/boot
/grub
/
40 $(CP
) $(KDIR
)/bzImage
$(KDIR
)/root.grub
/boot
/vmlinuz
42 -e
's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
43 -e
's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
44 .
/menu.lst
> $(KDIR
)/root.grub
/boot
/grub
/menu.lst
45 PADDING
="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH
="$(TARGET_PATH)" .
/gen_image.sh
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(1).image
$(CONFIG_X86_GRUB_KERNELPART
) $(KDIR
)/root.grub
$(CONFIG_TARGET_ROOTFS_FSPART
) $(KDIR
)/root.
$(1)
46 $(call Image
/Build
/grub
/$(1))
49 define Image
/Prepare
/grub
50 # for the image builder
52 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage1 \
53 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage2 \
54 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/e2fs_stage1_5 \
58 define Image
/Build
/grub
59 PADDING
="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH
="$(TARGET_PATH)" NOGRUB
=1 .
/gen_image.sh
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(1).image
$(CONFIG_X86_GRUB_KERNELPART
) "" $(CONFIG_TARGET_ROOTFS_FSPART
) $(KDIR
)/root.
$(1)
64 ifeq ($(CONFIG_X86_VDI_IMAGES
),y
)
65 define Image
/Build
/vdi
66 # left here because the image builder doesnt need these
68 rm $(BIN_DIR
)/openwrt-
$(BOARD
)-ext2.vdi || true
69 vditool DD
$(BIN_DIR
)/openwrt-
$(BOARD
)-ext2.vdi
$(BIN_DIR
)/openwrt-
$(BOARD
)-ext2.image
76 $(CP
) $(LINUX_DIR
)/arch
/x86
/boot
/bzImage
$(KDIR
)/bzImage
77 $(call Image
/Prepare
/grub
)
80 define Image
/Build
/squashfs
81 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
84 define Image
/Build
/iso
86 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage2_eltorito \
87 $(KDIR
)/root.grub
/boot
/grub
/stage2_eltorito
89 -e
's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
90 -e
's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
91 -e
's#(hd0,0)#(cd)#g' \
92 $(KDIR
)/root.grub
/boot
/grub
/menu.lst
93 $(CP
) $(KDIR
)/bzImage
$(KDIR
)/root.grub
/boot
/vmlinuz
94 mkisofs
-R
-b boot
/grub
/stage2_eltorito
-no-emul-boot
-boot-load-size
4 -boot-info-table \
95 -o
$(KDIR
)/root.iso
$(KDIR
)/root.grub
98 define Image
/BuildKernel
99 $(CP
) $(KDIR
)/bzImage
$(BIN_DIR
)/openwrt-
$(BOARD
)-vmlinuz
103 $(call Image
/Build
/$(1))
104 $(call Image
/Build
/grub
,$(1))
105 $(call Image
/Build
/vdi
,$(1))
106 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/openwrt-
$(BOARD
)-$(1).fs
107 $(CP
) $(KDIR
)/bzImage
$(BIN_DIR
)/openwrt-
$(BOARD
)-vmlinuz
110 $(eval
$(call BuildImage
))
112 ifeq ($(CONFIG_X86_VDI_IMAGES
),y
)
113 $(eval
$(call RequireCommand
,vditool
, \
114 You need vditool to generate VirtualBox images. \