mkits.ssh helper currently does not support ramdisk node support. To add
ramdisk suppport, we add extra two additional options -r and -z to
specify the ramdisk image and compression type.

Signed-off-by: Jason Wu <jason.wu.m...@gmail.com>

diff --git a/include/image.mk b/include/image.mk
index 4eee4ad..84307cf 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -126,7 +126,7 @@ endef
 define Image/BuildKernel/MkFIT
        $(TOPDIR)/scripts/mkits.sh \
                -D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C 
$(4) -a $(5) -e $(6) \
-               -A $(ARCH) -v $(LINUX_VERSION)
+               -A $(ARCH) -v $(LINUX_VERSION) $(if $(8),-r $(8)) $(if $(9),-z 
$(9))
        PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its 
$(KDIR)/fit-$(1)$(7).itb
 endef
 
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 6b5100e..2b00d0f 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -25,11 +25,13 @@ usage() {
        echo -e "\t-k ==> include kernel image 'kernel'"
        echo -e "\t-D ==> human friendly Device Tree Blob 'name'"
        echo -e "\t-d ==> include Device Tree Blob 'dtb'"
+       echo -e "\t-r ==> include ramdisk"
+       echo -e "\t-z ==> ramdisk compression type"
        echo -e "\t-o ==> create output file 'its_file'"
        exit 1
 }
 
-while getopts ":A:a:C:D:d:e:k:o:v:" OPTION
+while getopts ":A:a:C:D:d:e:k:o:v:r:z:" OPTION
 do
        case $OPTION in
                A ) ARCH=$OPTARG;;
@@ -41,6 +43,8 @@ do
                k ) KERNEL=$OPTARG;;
                o ) OUTPUT=$OPTARG;;
                v ) VERSION=$OPTARG;;
+               r ) RAMDISK=$OPTARG;;
+               z ) RD_COMPRESS=$OPTARG;;
                * ) echo "Invalid option passed to '$0' (options:$@)"
                usage;;
        esac
@@ -72,6 +76,34 @@ if [ -n "${DTB}" ]; then
                        };
                };
 "
+               CONF="                  fdt = \"fdt@1\";"
+fi
+
+# Conditionally create ramdisk node
+if [ -n "${RAMDISK}" ]; then
+       RD_COMPRESS=${RD_COMPRESS:-none}
+       RD="
+               ramdisk@1 {
+                       description = \"${ARCH_UPPER} OpenWrt ${DEVICE} 
ramdisk\";
+                       data = /incbin/(\"${RAMDISK}\");
+                       type = \"ramdisk\";
+                       arch = \"${ARCH}\";
+                       os = \"linux\";
+                       compression = \"${RD_COMPRESS}\";
+                       hash@1 {
+                               algo = \"crc32\";
+                       };
+                       hash@2 {
+                               algo = \"sha1\";
+                       };
+               };
+"
+       if [ -z "${CONF}" ]; then
+               CONF="                  ramdisk = \"ramdisk@1\";"
+       else
+               CONF="$CONF
+                       ramdisk = \"ramdisk@1\";"
+       fi
 fi
 
 # Create a default, fully populated DTS file
@@ -99,6 +131,7 @@ DATA="/dts-v1/;
                        };
                };
 
+${RD}
 ${FDT}
 
        };
@@ -108,7 +141,7 @@ ${FDT}
                config@1 {
                        description = \"OpenWrt\";
                        kernel = \"kernel@1\";
-                       fdt = \"fdt@1\";
+${CONF}
                };
        };
 };"
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to