How to customize initramfs image for this device?

Hi guys,

I am trying to flash a initramfs image to my device where I have no uboot access and no terminal access. The device allows me to upload an image file to flash. I dumped the filesystem and found where it checks the image:

#! /bin/sh

firmware=$1
firmware_check_dir=/tmp/firmware_check
NULL=/dev/null

ASKEY_KEY=askey,rt5010w-d187

image_list=`dumpimage -l $firmware| grep -w Image | cut -d '(' -f2|cut -d ')' -f1`
check=0
mkdir -p $firmware_check_dir 2> $NULL
pos=0

for i in $image_list
do
		echo $i
        dumpimage -i $firmware -o $firmware_check_dir/$i.bin -T flat_dt -p $pos $i > $NULL
        case $i in
                *u-boot*|*hlos*)
                        if [ -z "$(grep -nr "$ASKEY_KEY" $firmware_check_dir/$i.bin 2> $NULL)" ];then
                                errstring="$errstring $i"
                        else
                                check=1
                        fi
                        ;;

                #Don't check tz rpm sbl1 devcfg
                *tz*|*rpm*|*sbl1*|*devcfg*)
                        check=1
                        ;;
        esac
        pos=$(($pos + 1))
done

if [ -z "$errstring" -a "$check" = "1" ];then
        echo "Legal Askey firmware"
        exit 0
else
        echo "$errstring invalid"
        exit 1
fi


All I need to do is create initramfs in a way that it satisfies the above bash script.

This seems to be an old version of dumpimage, as the newer version doesnt support the -i parameter.
It also seems to be looking for multiple sub images. I guess the initramfs image I make, I will need to use the mkimage tool. But what should I include in this image? Current openwrt source for this platform compiles initramfs to a .itb that the script does not like. I need this old school multi-file type of thing.

My question is, what is the bare minimum that I need to take into consideration when attempting to make an initramfs image that my router will accept? If you have done it before, any insight would be much appreciated. Im going in blind and potentially will only have 1 shot at flashing something that works.

Thank you so much!

Oh yes, when they dumpimage a normal oem firmware, it looks something like this (im guessing),

dumpimage -l  lsdk2004_ubuntu_main_LS_arm64.itb
FIT description: arm64 kernel, ramdisk and FDT blob
Created:         Tue Feb  2 18:54:19 2021
 Image 0 (kernel)
  Description:  ARM64 Kernel
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Kernel Image
  Compression:  gzip compressed
  Data Size:    14086432 Bytes = 13756.28 kB = 13.43 MB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0x84080000
  Entry Point:  0x84080000
  Hash algo:    crc32
  Hash value:   1980d6fd
 Image 1 (initrd)
  Description:  initrd for arm64
  Created:      Tue Feb  2 18:54:19 2021
  Type:         RAMDisk Image
  Compression:  uncompressed
  Data Size:    668988861 Bytes = 653309.43 kB = 638.00 MB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0x00000000
  Entry Point:  0x00000000
  Hash algo:    crc32
  Hash value:   24aa3c08
 Image 2 (ls1012ardb-dtb)
  Description:  ls1012ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    14335 Bytes = 14.00 kB = 0.01 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   383a8118
 Image 3 (ls1012aqds-dtb)
  Description:  ls1012aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    15972 Bytes = 15.60 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   7d133305
 Image 4 (ls1012afrwy-dtb)
  Description:  ls1012afrwy-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    15316 Bytes = 14.96 kB = 0.01 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   7c456ca3
 Image 5 (ls1028ardb-dtb)
  Description:  ls1028ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    19767 Bytes = 19.30 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   db86fa4f
 Image 6 (ls1028aqds-dtb)
  Description:  ls1028aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    24733 Bytes = 24.15 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   e0b7a722
 Image 7 (ls1043ardb-dtb)
  Description:  ls1043ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    41085 Bytes = 40.12 kB = 0.04 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   fcc6502c
 Image 8 (ls1043aqds-dtb)
  Description:  ls1043aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    34544 Bytes = 33.73 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   45f82fba
 Image 9 (ls1046ardb-dtb)
  Description:  ls1046ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    40270 Bytes = 39.33 kB = 0.04 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   013f5024
 Image 10 (ls1046aqds-dtb)
  Description:  ls1046aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    34317 Bytes = 33.51 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   be066013
 Image 11 (ls1046afrwy-dtb)
  Description:  ls1046afrwy-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    31528 Bytes = 30.79 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   d872df6c
 Image 12 (ls1088ardb-dtb)
  Description:  ls1088ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    19523 Bytes = 19.07 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   403066bc
 Image 13 (ls1088aqds-dtb)
  Description:  ls1088aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    19415 Bytes = 18.96 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   a2bf2786
 Image 14 (ls2088ardb-dtb)
  Description:  ls2088ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    29838 Bytes = 29.14 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   0069fe03
 Image 15 (ls2088aqds-dtb)
  Description:  ls2088aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    23557 Bytes = 23.00 kB = 0.02 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   e8e9dfa7
 Image 16 (lx2160ardb-dtb)
  Description:  lx2160ardb-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    32643 Bytes = 31.88 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   e5859b31
 Image 17 (lx2160aqds-dtb)
  Description:  lx2160aqds-dtb
  Created:      Tue Feb  2 18:54:19 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    27740 Bytes = 27.09 kB = 0.03 MB
  Architecture: AArch64
  Hash algo:    crc32
  Hash value:   f644de1e