make kernels use /etc/preinit by default
[openwrt/openwrt.git] / target / linux / olpc / image / Makefile
1 #
2 # Copyright (C) 2007-2008 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 ROOTDELAY=5
15
16 ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y)
17 define Image/cmdline/squashfs
18 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootdelay=$(ROOTDELAY)
19 endef
20
21 define Image/cmdline/jffs2-64k
22 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
23 endef
24
25 define Image/cmdline/jffs2-128k
26 block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
27 endef
28
29 define Image/cmdline/ext2
30 root=$(ROOTPART) rootfstype=ext2
31 endef
32
33 define Image/Build/bootscript
34 # left here because the image builder doesnt need these
35 $(INSTALL_DIR) $(KDIR)/root.bootscript/boot
36 $(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz
37 sed -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
38 ./olpc.fth > $(KDIR)/root.bootscript/boot/olpc.fth
39 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)
40 endef
41 endif
42
43 define Image/Prepare
44 cp $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
45 $(call Image/Prepare/bootscript)
46 endef
47
48 define Image/Build/squashfs
49 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
50 endef
51
52 define Image/BuildKernel
53 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
54 endef
55
56 define Image/Build
57 $(call Image/Build/$(1))
58 $(call Image/Build/bootscript,$(1))
59 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1).fs
60 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
61 endef
62
63 $(eval $(call BuildImage))
64