realtek: move Netgear recipe to subtarget Makefile
[openwrt/staging/nbd.git] / target / linux / realtek / image / Makefile
index cf779002e86ee6e65bc2e991a6c9ce4d529ce388..6c7be4aa90a644ccfc528e485156e8a791cf36bf 100644 (file)
@@ -8,6 +8,7 @@ KERNEL_ENTRY = 0x80000400
 
 DEVICE_VARS += ZYXEL_VERS DLINK_KERNEL_PART_SIZE
 DEVICE_VARS += CAMEO_KERNEL_PART CAMEO_ROOTFS_PART CAMEO_CUSTOMER_SIGNATURE CAMEO_BOARD_VERSION
+DEVICE_VARS += H3C_PRODUCT_ID H3C_DEVICE_ID
 
 define Build/zyxel-vers
        ( echo VERS;\
@@ -41,6 +42,43 @@ define Build/dlink-headers
         cat $@.kernel_part.hex $@.rootfs_part.hex > $@
 endef
 
+define Build/7z
+       $(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
+       mv $@.new $@
+endef
+
+define Build/h3c-image
+       $(STAGING_DIR_HOST)/bin/mkh3cimg \
+               -i $(@) \
+               -o $(@).new \
+               -c 7z \
+               -p $(H3C_PRODUCT_ID) \
+               -d $(H3C_DEVICE_ID)
+       mv $@.new $@
+endef
+
+define Build/h3c-vfs
+       $(STAGING_DIR_HOST)/bin/mkh3cvfs \
+               -i $(@) \
+               -o $(@).new \
+               -f openwrt-kernel.bin
+       mv $@.new $@
+endef
+
+define Build/relocate-kernel
+       rm -rf $@.relocate
+       $(CP) ../../generic/image/relocate $@.relocate
+       $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) LZMA_TEXT_START=0x82000000 \
+               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 Device/Default
   PROFILES = Default
   KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
@@ -52,16 +90,6 @@ define Device/Default
        check-size | append-metadata
 endef
 
-# "NGE" refers to the uImage magic
-define Device/netgear_nge
-  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
-  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
-  SOC := rtl8380
-  IMAGE_SIZE := 14848k
-  UIMAGE_MAGIC := 0x4e474520
-  DEVICE_VENDOR := NETGEAR
-endef
-
 include $(SUBTARGET).mk
 
 $(eval $(call BuildImage))