blob: 84f6aaf774030156bde8d8f7b929d80b438efca2 [file] [log] [blame]
xf.liaa4d92f2023-09-13 00:18:58 -07001#!/bin/bash
2
3if [ $# -ne 4 ]; then
4 echo "$0 error"
5 echo "Usage:"
6 echo " $0 mtd_name outfile image_file ubinize_para"
7 exit -1
8fi
9
10mtdname=$1
11outfile=$2
12imgfile=$3
13ubinize_para=$4
14
15filesize="$(stat -c%s $imgfile)"
16
17cfg_file_name=$mtdname.cfg
18
19echo "[$mtdname]" > $cfg_file_name
20echo "mode=ubi" >> $cfg_file_name
21echo "image=$imgfile" >> $cfg_file_name
22echo "vol_id=0" >> $cfg_file_name
23echo "vol_size=${filesize}" >> $cfg_file_name
24echo "vol_type=dynamic" >> $cfg_file_name
25echo "vol_name=$mtdname" >> $cfg_file_name
26
27cat $cfg_file_name
28
29ubinize -o $outfile $ubinize_para $cfg_file_name
30if [ $? -ne 0 ]; then
31 echo "ubinize error"
32 exit -2
33else
34 echo "ubinize ok"
35fi
36
37rm -v $cfg_file_name