Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. export PATH=$(TARGET_PATH):/sbin
  10. ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_BOOTSCRIPT_ROOTPART)))
  11. #"))")) # fix vim's broken syntax highlighting
  12. ROOTDELAY=5
  13. ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y)
  14. define Image/cmdline/squashfs
  15. block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootdelay=$(ROOTDELAY)
  16. endef
  17. define Image/cmdline/jffs2-64k
  18. block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
  19. endef
  20. define Image/cmdline/jffs2-128k
  21. block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY)
  22. endef
  23. define Image/cmdline/ext2
  24. root=$(ROOTPART) rootfstype=ext2
  25. endef
  26. define Image/Build/bootscript
  27. # left here because the image builder doesnt need these
  28. $(INSTALL_DIR) $(KDIR)/root.bootscript/boot
  29. $(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz
  30. sed -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
  31. ./olpc.fth > $(KDIR)/root.bootscript/boot/olpc.fth
  32. 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)
  33. endef
  34. endif
  35. define Image/Prepare
  36. cp $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
  37. $(call Image/Prepare/bootscript)
  38. endef
  39. define Image/Build/squashfs
  40. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  41. endef
  42. define Image/BuildKernel
  43. $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
  44. endef
  45. define Image/Build
  46. $(call Image/Build/$(1))
  47. $(call Image/Build/bootscript,$(1))
  48. $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1).fs
  49. $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-vmlinuz
  50. endef
  51. $(eval $(call BuildImage))