-define Build/relocate-kernel
- rm -rf $@.relocate
- $(CP) ../../generic/image/relocate $@.relocate
- $(MAKE) -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("V", @s[7])' && \
- cat $@ \
- ) > $@.new
- mv $@.new $@
- rm -rf $@.relocate
-endef
-
-define Build/elx-header
- $(eval hw_id=$(word 1,$(1)))
- $(eval xor_pattern=$(word 2,$(1)))
- ( \
- echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \
- dd bs=42 count=1 conv=sync; \
- hw_id="$(hw_id)"; \
- echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \
- dd bs=20 count=1 conv=sync; \
- echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
- dd bs=8 count=1 conv=sync; \
- echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
- dd bs=58 count=1 conv=sync; \
- ) > $(KDIR)/tmp/$(DEVICE_NAME).header
- $(call Build/xor-image,-p $(xor_pattern) -x)
- cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new
- mv $@.new $@
- rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
-endef
-
-define Build/umedia-header
- fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
-endef
-
-define Build/edimax-header
- $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
- @mv $@.new $@
-endef
-
-define Build/poray-header
- $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new
- mv $@.new $@
+define Build/loader-okli-compile
+ $(call Build/loader-common, \
+ FLASH_START=$(LOADER_FLASH_START) \
+ FLASH_OFFS=$(LOADER_FLASH_OFFS) \
+ FLASH_MAX=0 \
+ )