danube to ifxmips transition
[openwrt-10.03/.git] / target / linux / olpc / image / Makefile
1
2 # Copyright (C) 2007 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 ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_BOOTSCRIPT_ROOTPART)))
12 #"))")) # fix vim's broken syntax highlighting
13
14
15 ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y)
16   define Image/cmdline/squashfs
17     block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs init=/etc/preinit
18   endef
19
20   define Image/cmdline/jffs2-64k
21     block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
22   endef
23
24   define Image/cmdline/jffs2-128k
25     block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
26   endef
27
28   define Image/cmdline/ext2
29     root=$(ROOTPART) rootfstype=ext2 init=/etc/preinit
30   endef
31   
32   define Image/Build/bootscript
33         # left here because the image builder doesnt need these
34         $(INSTALL_DIR) $(KDIR)/root.bootscript/boot
35         $(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz
36         $(CP) ./olpc.fth $(KDIR)/root.bootscript/boot/olpc.fth
37         PADDING="$(CONFIG_OLPC_BOOTSCRIPT_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_OLPC_BOOTSCRIPT_KERNELPART) $(KDIR)/root.bootscript $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
38   endef
39 endif
40
41 define Image/Prepare
42         $(CP) $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage
43         $(call Image/Prepare/bootscript)
44 endef
45   
46 define Image/Build/squashfs
47     $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
48 endef
49
50 define Image/BuildKernel
51         $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
52 endef
53
54 define Image/Build
55         $(call Image/Build/$(1))
56         $(call Image/Build/bootscript,$(1))
57         $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1).fs
58         $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
59 endef
60
61 $(eval $(call BuildImage))
62