Initial OLPC target
[openwrt.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 BOOTOPTS=$(strip $(subst ",, $(CONFIG_OLPC_GRUB_BOOTOPTS)))
12 ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_GRUB_ROOTPART)))
13 #"))")) # fix vim's broken syntax highlighting
14
15
16 ifeq ($(CONFIG_OLPC_GRUB_IMAGES),y)
17 define Image/cmdline/squashfs
18 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs init=/etc/preinit
19 endef
20
21 define Image/cmdline/jffs2-64k
22 block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
23 endef
24
25 define Image/cmdline/jffs2-128k
26 block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
27 endef
28
29 define Image/cmdline/ext2
30 root=$(ROOTPART) rootfstype=ext2 init=/etc/preinit
31 endef
32
33 define Image/Build/grub
34 # left here because the image builder doesnt need these
35 $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
36 $(CP) \
37 $(KDIR)/*stage* \
38 $(KDIR)/root.grub/boot/grub/
39 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
40 $(CP) ./olpc.fth $(KDIR)/root.grub/boot/olpc.fth
41 sed \
42 -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
43 -e 's#@BAUDRATE@#$(CONFIG_OLPC_GRUB_BAUDRATE)#g' \
44 ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
45 PADDING="$(CONFIG_OLPC_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_OLPC_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
46 $(call Image/Build/grub/$(1))
47 endef
48 endif
49
50 ifeq ($(CONFIG_OLPC_GRUB_IMAGES),y)
51 define Image/Prepare/grub
52 # for the image builder
53 $(CP) \
54 $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage1 \
55 $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/stage2 \
56 $(STAGING_DIR_HOST)/usr/lib/grub/i386-pc/e2fs_stage1_5 \
57 $(KDIR)/
58 endef
59 endif
60
61 define Image/Prepare
62 $(CP) $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage
63 $(call Image/Prepare/grub)
64 endef
65
66 define Image/Build/squashfs
67 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
68 endef
69
70 define Image/BuildKernel
71 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
72 endef
73
74 define Image/Build
75 $(call Image/Build/$(1))
76 $(call Image/Build/grub,$(1))
77 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).fs
78 $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
79 endef
80
81 $(eval $(call BuildImage))
82
This page took 0.051828 seconds and 5 git commands to generate.