How to make nand flash factory bin image?


When you make a NAND FLASH factory bin image, you need to use a factory bin delivery tool that QC engineer will provide to you.

1. How to make nand flash factory bin?

You can make a factory bin as below steps,

Step1. Create workspace directory

mkdir factory_work_space
mkdir factory_work_space/common_build_ipq
cd factory_work_space

Step2. Prepare for the partition bins

Copy the following partition bins to the common_build_ipq folder:
(you can find the image from your code path: {root_dir}/common/build/ipq/)

bootconfig.bin
cdt-AP-MP03.1_256M16_DDR3_LM512.bin
cdt-AP-MP03.1_256M16_DDR3_LM512.bin.padded
cdt-AP-MP03.3_512M16_DDR3_LM512.bin
cdt-AP-MP03.3_512M16_DDR3_LM512.bin.padded
devcfg.mbn
devcfg.mbn.padded
nand-system-partition-ipq5018.bin
openwrt-ipq5018-u-boot.mbn
openwrt-ipq5018-u-boot.mbn.padded
openwrt-ipq-ipq50xx-ubi-root.img
sbl1_nand.mbn
sbl1_nand.mbn.padded
tz.mbn
tz.mbn.padded

Step3. Create shell script

Create a shell script on the factory_work_space folder with following code:

About seek value, you can get the information on uboot command line via “smem” command.
You will see all partition’s start address, like this:

No.: Name             Attributes            Start             Size
  0: 0:SBL1           0x0000ffff              0x0         0x180000
  1: 0:SBL1_1         0x0000ffff         0x180000         0x180000
  2: 0:MIBIB          0x0000ffff         0x300000         0x100000
  3: 0:BOOTCONFIG     0x0000ffff         0x400000          0x80000
  4: 0:BOOTCONFIG1    0x0000ffff         0x480000          0x80000

You should turn the “start” hex value to decimal first.

And then, in the script,

  • seek = Decimal(start address)/1024, when you set bs to “1k”.
  • seek = Decimal(start address), when you set bs to “1”.

The script example as below:

#!/bin/bash

# Set ECC and OOB
ECC=8
OOB=128
# Set ECC and OOB END

file=factory_5018_nand.bin
file_with_ecc=$file.ecc$ECC.bin
parts_dir=common_build_ipq

if [ -a $file ]; then
    rm $file $file_with_ecc
fi

sync

tr '\000' '\377' < /dev/zero | dd of=$file bs=1024 count=128k

sync

dd conv=notrunc if=./$parts_dir/sbl1_nand.mbn                       of=$file bs=1k seek=0
dd conv=notrunc if=./$parts_dir/nand-system-partition-ipq5018.bin   of=$file bs=1k seek=512
dd conv=notrunc if=./$parts_dir/bootconfig.bin                      of=$file bs=1k seek=1024
dd conv=notrunc if=./$parts_dir/bootconfig.bin                      of=$file bs=1k seek=1280
dd conv=notrunc if=./$parts_dir/tz.mbn                              of=$file bs=1k seek=1536
dd conv=notrunc if=./$parts_dir/devcfg.mbn                          of=$file bs=1k seek=3584
dd conv=notrunc if=./$parts_dir/cdt-AP-MP03.3_512M16_DDR3_LM512.bin of=$file bs=1k seek=4096
dd conv=notrunc if=./$parts_dir/openwrt-ipq5018-u-boot.mbn          of=$file bs=1k seek=5120
dd conv=notrunc if=./$parts_dir/openwrt-ipq-ipq50xx-ubi-root.img    of=$file bs=1k seek=9216


./img_gen $file -h -$ECC -O $OOB -o $file_with_ecc
#./img_gen $file -h -$ECC -o $file_with_ecc


Step4. Delivery the factory bin image

Excecute your shell script.

chmod 777 {your_shell_script}
./{your_shell_script}

Then you just need to waiting for few minutes,
you will see the factory_5018_nand.bin.ecc8.bin on the workspace root folder.
It will cost about 20min for 8bit ecc bin, and less than 10min for 4bit ecc bin.

2. Script Example

Note,

  • seek = Decimal(start address)/1024, when you set bs to “1k”.
  • seek = Decimal(start address), when you set bs to “1”.

2.1 Alder

#!/bin/bash

# Set ECC and OOB
ECC=8
OOB=128
# Set ECC and OOB END

file=factory_9574_nand.bin
file_with_ecc=$file.ecc$ECC.bin
parts_dir=common_build_ipq

if [ -a $file ]; then
    rm $file $file_with_ecc
fi

sync

tr '\000' '\377' < /dev/zero | dd of=$file bs=1024 count=128k

sync

dd conv=notrunc if=./$parts_dir/xbl_nand.elf                            of=$file bs=1k seek=0        #SBL1
dd conv=notrunc if=./$parts_dir/xbl_nand.elf                            of=$file bs=1k seek=1536     #SBL1_1
dd conv=notrunc if=./$parts_dir/nand-system-partition-ipq9574.bin       of=$file bs=1k seek=3072     #MIBIB
dd conv=notrunc if=./$parts_dir/bootconfig.bin                          of=$file bs=1k seek=4096     #BOOTCONFIG
dd conv=notrunc if=./$parts_dir/bootconfig.bin                          of=$file bs=1k seek=4608     #BOOTCONFIG1
dd conv=notrunc if=./$parts_dir/tz.mbn                                  of=$file bs=1k seek=5120     #QSEE
dd conv=notrunc if=./$parts_dir/tz.mbn                                  of=$file bs=1k seek=8704     #QSEE_1
dd conv=notrunc if=./$parts_dir/devcfg.mbn                              of=$file bs=1k seek=12288    #DEVCFG
dd conv=notrunc if=./$parts_dir/devcfg.mbn                              of=$file bs=1k seek=12800    #DEVCFG_1
dd conv=notrunc if=./$parts_dir/apdp.mbn                                of=$file bs=1k seek=13312    #APDP
dd conv=notrunc if=./$parts_dir/apdp.mbn                                of=$file bs=1k seek=13824    #APDP_1
dd conv=notrunc if=./$parts_dir/tmel-ipq95xx-firmware.elf.padded        of=$file bs=1k seek=14336    #TME
dd conv=notrunc if=./$parts_dir/tmel-ipq95xx-firmware.elf.padded        of=$file bs=1k seek=14848    #TME_1
dd conv=notrunc if=./$parts_dir/rpm.mbn                                 of=$file bs=1k seek=15360    #RPM
dd conv=notrunc if=./$parts_dir/rpm.mbn                                 of=$file bs=1k seek=15872    #RPM_1
dd conv=notrunc if=./$parts_dir/cdt-AP-AL02-C1_256M16_DDR4.bin          of=$file bs=1k seek=16384    #CDT
dd conv=notrunc if=./$parts_dir/cdt-AP-AL02-C1_256M16_DDR4.bin          of=$file bs=1k seek=16896    #CDT_1
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=17408    #APPSBLENV
dd conv=notrunc if=./$parts_dir/openwrt-ipq9574-u-boot.mbn              of=$file bs=1k seek=17920    #APPSBL
dd conv=notrunc if=./$parts_dir/openwrt-ipq9574-u-boot.mbn              of=$file bs=1k seek=19456    #APPSBL_1
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=20992    #ART
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=22016    #ETHPHYFW
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=23040    #TRAINING
dd conv=notrunc if=./$parts_dir/openwrt-ipq95xx-ipq95xx_32-ubi-root.img of=$file bs=1k seek=23552    #rootfs
dd conv=notrunc if=./$parts_dir/openwrt-ipq95xx-ipq95xx_32-ubi-root.img of=$file bs=1k seek=105472   #rootfs_1
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=187392   #customfs
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=237568   #Jio-Reserved
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=239616   #MFG
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=241664   #BDF




./img_gen $file -h -$ECC -O $OOB -o $file_with_ecc
#./img_gen $file -h -$ECC -o $file_with_ecc

2.2 Miami

on testing…

#!/bin/bash

# Set ECC and OOB
ECC=8
OOB=128
# Set ECC and OOB END

file=factory_9574_nand.bin
file_with_ecc=$file.ecc$ECC.bin
parts_dir=common_build_ipq

if [ -a $file ]; then
    rm $file $file_with_ecc
fi

sync

tr '\000' '\377' < /dev/zero | dd of=$file bs=1024 count=128k

sync


dd conv=notrunc if=./$parts_dir/xbl_nand.elf                            of=$file bs=1k seek=0          #SBL1
dd conv=notrunc if=./$parts_dir/xbl_nand.elf                            of=$file bs=1k seek=1536       #SBL1_1
dd conv=notrunc if=./$parts_dir/nand-system-partition-ipq5332.bin       of=$file bs=1k seek=3072       #MIBIB
dd conv=notrunc if=./$parts_dir/bootconfig.bin                          of=$file bs=1k seek=4096       #BOOTCONFIG
dd conv=notrunc if=./$parts_dir/bootconfig.bin                          of=$file bs=1k seek=4608       #BOOTCONFIG1
dd conv=notrunc if=./$parts_dir/tz.mbn                                  of=$file bs=1k seek=5120       #QSEE
dd conv=notrunc if=./$parts_dir/tz.mbn                                  of=$file bs=1k seek=8704       #QSEE_1
dd conv=notrunc if=./$parts_dir/devcfg.mbn                              of=$file bs=1k seek=12288      #DEVCFG
dd conv=notrunc if=./$parts_dir/devcfg.mbn                              of=$file bs=1k seek=12800      #DEVCFG_1
dd conv=notrunc if=./$parts_dir/tmel-ipq53xx-patch.elf                  of=$file bs=1k seek=13312      #TME
dd conv=notrunc if=./$parts_dir/tmel-ipq53xx-patch.elf                  of=$file bs=1k seek=13824      #TME_1
dd conv=notrunc if=./$parts_dir/cdt-AP-MI01.4_256M16_DDR4.bin           of=$file bs=1k seek=14336      #CDT
dd conv=notrunc if=./$parts_dir/cdt-AP-MI01.4_256M16_DDR4.bin           of=$file bs=1k seek=14848      #CDT_1
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=15360      #APPSBLENV
dd conv=notrunc if=./$parts_dir/openwrt-ipq5332-u-boot.mbn              of=$file bs=1k seek=15872      #APPSBL
dd conv=notrunc if=./$parts_dir/openwrt-ipq5332-u-boot.mbn              of=$file bs=1k seek=17408      #APPSBL_1
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=18944      #ETHPHYFW
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=19968      #TRAINING
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=20480      #ART
#dd conv=notrunc if=./$parts_dir/                                       of=$file bs=1k seek=22528      #LICENSE
dd conv=notrunc if=./$parts_dir/openwrt-ipq53xx-ipq53xx_32-ubi-root.img of=$file bs=1k seek=22784      #rootfs
dd conv=notrunc if=./$parts_dir/openwrt-ipq53xx-ipq53xx_32-ubi-root.img of=$file bs=1k seek=76160      #rootfs_1
																								  



./img_gen $file -h -$ECC -O $OOB -o $file_with_ecc
#./img_gen $file -h -$ECC -o $file_with_ecc

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值