at91: add Device Tree based board detection
[openwrt/openwrt.git] / include / image.mk
index 8e8ddc29ac0eb6d31adc6391315a3e30551a8798..814e7dc5d17f4e651af03e1c3aba307da4375cf2 100644 (file)
@@ -304,6 +304,11 @@ define Build/append-rootfs
        dd if=$(word 2,$^) $(if $(1),bs=$(1) conv=sync) >> $@
 endef
 
+define Build/pad-to
+       dd if=$@ of=$@.new bs=$(1) conv=sync
+       mv $@.new $@
+endef
+
 define Build/pad-rootfs
        $(call prepare_generic_squashfs,$@ $(1))
 endef
@@ -326,6 +331,13 @@ define Build/check-size
        }
 endef
 
+define Build/combined-image
+       -sh $(TOPDIR)/scripts/combined-image.sh \
+               "$(word 1,$^)" \
+               "$@" \
+               "$@.new"
+       @mv $@.new $@
+endef
 
 define Device/Init
   PROFILES := $(PROFILE)
@@ -397,10 +409,15 @@ define Device/Build/kernel
   $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
   $(BIN_DIR)/$$(KERNEL_IMAGE): $(KDIR)/$$(KERNEL_IMAGE)
        cp $$^ $$@
-  $(KDIR)/$$(KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME)
+  ifndef IB
+    ifdef CONFIG_IB
+      install: $(KDIR)/$$(KERNEL_IMAGE)
+    endif
+    $(KDIR)/$$(KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME)
        @rm -f $$@
        $$(call concat_cmd,$$(KERNEL))
        $$(if $$(KERNEL_SIZE),$$(call Device/Build/check_size,$$(KERNEL_SIZE)))
+  endif
 endef
 
 define Device/Build/image
@@ -459,6 +476,9 @@ define BuildImage
     image_prepare: compile
                mkdir -p $(KDIR)/tmp
                $(call Image/Prepare)
+  else
+    image_prepare:
+               mkdir -p $(KDIR)/tmp
   endif
 
   mkfs_prepare: image_prepare
@@ -466,7 +486,7 @@ define BuildImage
 
   kernel_prepare: mkfs_prepare
        $(call Image/BuildKernel)
-       $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Image/BuildKernel/Initramfs))
+       $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(if $(IB),,$(call Image/BuildKernel/Initramfs)))
        $(call Image/InstallKernel)
 
   $(foreach device,$(TARGET_DEVICES),$(call Device,$(device)))