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 define Image
/cmdline
/squashfs
18 block2mtd.block2mtd
=$(ROOTPART
),65536,rootfs root
=/dev
/mtdblock0 rootfstype
=squashfs init
=/etc
/preinit
21 define Image
/cmdline
/jffs2-64k
22 block2mtd.block2mtd
=$(ROOTPART
),65536,rootfs root
=/dev
/mtdblock0 rootfstype
=jffs2 init
=/etc
/preinit
25 define Image
/cmdline
/jffs2-128k
26 block2mtd.block2mtd
=$(ROOTPART
),131072,rootfs root
=/dev
/mtdblock0 rootfstype
=jffs2 init
=/etc
/preinit
29 define Image
/cmdline
/ext2
30 root
=$(ROOTPART
) rootfstype
=ext2 init
=/etc
/preinit
33 define Image
/Build
/grub
34 # left here because the image builder doesnt need these
35 $(INSTALL_DIR
) $(KDIR
)/root.grub
/boot
/grub
38 $(KDIR
)/root.grub
/boot
/grub
/
39 $(CP
) $(KDIR
)/bzImage
$(KDIR
)/root.grub
/boot
/vmlinuz
41 -e
's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
42 -e
's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
43 .
/menu.lst
> $(KDIR
)/root.grub
/boot
/grub
/menu.lst
44 PADDING
="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH
="$(TARGET_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)
45 $(call Image
/Build
/grub
/$(1))
49 ifeq ($(CONFIG_X86_GRUB_IMAGES
),y
)
50 define Image
/Prepare
/grub
51 # for the image builder
53 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage1 \
54 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage2 \
55 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/e2fs_stage1_5 \
61 $(CP
) $(LINUX_DIR
)/arch
/i386
/boot
/bzImage
$(KDIR
)/bzImage
62 $(call Image
/Prepare
/grub
)
65 define Image
/Build
/squashfs
66 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
69 define Image
/Build
/iso
71 $(STAGING_DIR_HOST
)/usr
/lib
/grub
/i386-pc
/stage2_eltorito \
72 $(KDIR
)/root.grub
/boot
/grub
/stage2_eltorito
74 -e
's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
75 -e
's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
76 -e
's#(hd0,0)#(cd)#g' \
77 $(KDIR
)/root.grub
/boot
/grub
/menu.lst
78 $(CP
) $(KDIR
)/bzImage
$(KDIR
)/root.grub
/boot
/vmlinuz
79 mkisofs
-R
-b boot
/grub
/stage2_eltorito
-no-emul-boot
-boot-load-size
4 -boot-info-table \
80 -o
$(KDIR
)/root.iso
$(KDIR
)/root.grub
83 define Image
/BuildKernel
84 $(CP
) $(KDIR
)/bzImage
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(KERNEL
)-vmlinuz
88 $(call Image
/Build
/$(1))
89 $(call Image
/Build
/grub
,$(1))
90 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/openwrt-
$(BOARD
)-$(KERNEL
)-$(1).fs
91 $(CP
) $(KDIR
)/bzImage
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(KERNEL
)-vmlinuz
94 $(eval
$(call BuildImage
))