ath79: Ubiquiti Airmax M: add relocate-kernel to invalidate cache
[openwrt/openwrt.git] / target / linux / ath79 / image / Makefile
index 5f1edcbdb262a2c5b865edbc5fbc88bab6b1d5da..cc71c319978080eeb1a963fce244252bc10a1824 100644 (file)
@@ -36,6 +36,19 @@ define Build/loader-okli
        mv "$@.new" "$@"
 endef
 
+define Build/relocate-kernel
+       rm -rf $@.relocate
+       $(CP) ../../generic/image/relocate $@.relocate
+       $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
+       ( \
+               dd if=$@.relocate/loader.bin bs=32 conv=sync && \
+               perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
+               cat "$@" \
+       ) > "$@.new"
+       mv "$@.new" "$@"
+       rm -rf $@.relocate
+endef
+
 define Build/copy-file
        cat "$(1)" > "$@"
 endef