2006-06-27 00:35:46 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-06-21 03:13:25 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
2006-06-21 02:32:39 +00:00
|
|
|
include $(INCLUDE_DIR)/image.mk
|
2005-07-25 15:40:23 +00:00
|
|
|
|
2006-11-18 21:14:45 +00:00
|
|
|
export PATH=$(TARGET_PATH):/sbin
|
2006-10-31 22:49:02 +00:00
|
|
|
ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART)))
|
2006-10-31 22:53:31 +00:00
|
|
|
#")) # fix vim's broken syntax highlighting
|
2006-10-31 22:49:02 +00:00
|
|
|
|
|
|
|
|
2006-10-08 15:48:56 +00:00
|
|
|
ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
|
|
|
|
define Build/Compile
|
|
|
|
$(MAKE) -C grub compile
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Clean
|
|
|
|
$(MAKE) -C grub clean
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/jffs2-64k
|
2006-10-31 22:49:02 +00:00
|
|
|
block2mtd.block2mtd=$(ROOTPART),65536 root=/dev/mtdblock0 rootfstype=jffs2
|
2006-10-08 15:48:56 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/jffs2-128k
|
2006-10-31 22:49:02 +00:00
|
|
|
block2mtd.block2mtd=$(ROOTPART),131072 root=/dev/mtdblock0 rootfstype=jffs2
|
2006-10-08 15:48:56 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/ext2
|
2007-01-07 16:13:39 +00:00
|
|
|
root=$(ROOTPART) rootfstype=ext2
|
2006-10-08 15:48:56 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/grub
|
2006-10-25 23:52:17 +00:00
|
|
|
mkdir -p $(KDIR)/root.grub/boot/grub
|
2006-10-08 15:48:56 +00:00
|
|
|
$(CP) \
|
2007-01-14 22:59:51 +00:00
|
|
|
$(KDIR)/*stage* \
|
2006-10-08 15:48:56 +00:00
|
|
|
$(KDIR)/root.grub/boot/grub/
|
2007-01-14 22:59:51 +00:00
|
|
|
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
|
2006-10-08 15:48:56 +00:00
|
|
|
sed \
|
2007-01-07 16:13:39 +00:00
|
|
|
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(CONFIG_X86_GRUB_BOOTOPTS)#g' \
|
2006-10-08 15:48:56 +00:00
|
|
|
-e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
|
|
|
|
./grub/menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
|
2006-10-19 03:27:24 +00:00
|
|
|
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)
|
2006-10-08 15:48:56 +00:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2007-01-10 21:52:28 +00:00
|
|
|
define Image/Prepare
|
|
|
|
cp $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage
|
2007-01-14 22:59:51 +00:00
|
|
|
# for the image builder
|
|
|
|
$(CP) \
|
|
|
|
$(STAGING_DIR)/usr/lib/grub/i386-pc/stage1 \
|
|
|
|
$(STAGING_DIR)/usr/lib/grub/i386-pc/stage2 \
|
|
|
|
$(STAGING_DIR)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
|
|
|
|
$(KDIR)/
|
|
|
|
$(CP) $(STAGING_DIR)/usr/sbin/grub $(STAGING_DIR)/bin
|
2007-01-10 21:52:28 +00:00
|
|
|
endef
|
|
|
|
|
2006-06-04 21:57:59 +00:00
|
|
|
define Image/Build
|
2006-10-08 15:48:56 +00:00
|
|
|
$(call Image/Build/grub,$(1))
|
|
|
|
cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).fs
|
2007-01-10 21:52:28 +00:00
|
|
|
cp $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
|
2006-06-04 21:57:59 +00:00
|
|
|
endef
|
2005-07-25 15:40:23 +00:00
|
|
|
|
2006-06-04 21:57:59 +00:00
|
|
|
$(eval $(call BuildImage))
|