User Tools

Site Tools


doc:techref:image.makefile

image/Makefile Details

FIXME This section is new and deliberately not linked too by other pages yet. once a person of some experience has a chance to look over this they may then choose to add it.

I think its(this page) needed to clarify the intent, preferred style and function of the image/Makefile.

I believe it should be placed here:

  • Adding a new platform (new buildroot howto section?)
    OR
  • OpenWrt Buildroot - new platform (new page/how-to on adding platform support to the buildroot system)

image/Makefile from scratch or modify

Inside your platform directory you will need to create a file to tell the buildroot system how to process the results of a compiled kernel. Most of the work is done automatically by image.mk but different platforms and individual devices will need specific work for images to be useful.

Basic Function

see example.

Image/Prepare

can be used to append data to image but often used simply to move to another directory such as $(KDIR)

for example:

cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(call zimage_name,$(1))

Image/Build/Initramfs

This section allows automated modification of the elf file before loading onto the device. The file can be found with this line

$(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf

Image/Build/jffs2-64k

Image/Build/jffs2-128k

Image/Build/squashfs

Image/Build

Appears to be used to call the other build defines (squashfs, jffs2-64k, jffs2-128k, etc) after they were processed and their resulting files were placed into $(TARGET_DIR)

to call a define for each use:

$(call Image/Build/$(1),$(1))

Example

Example of: trunk/target/linux/platform/image/Makefile

# 
# Copyright (C) 2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
 
define Image/Prepare
 
endef
 
define Image/Build/Initramfs
 
	$(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
 
endef
 
define Image/BuildKernel
 
endef
 
define Image/Build/jffs2-64k
	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=65536 conv=sync
endef
 
define Image/Build/jffs2-128k
	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync
endef
 
define Image/Build/squashfs
	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
 
endef
 
define Image/Build
	$(call Image/Build/$(1),$(1))
endef

See also

have a look at your copy of trunk/include/image.mk

david_ausengineer 2012/05/15 03:10

doc/techref/image.makefile.txt · Last modified: 2012/05/15 05:27 by david_ausengineer