3 .
$TOPDIR/scripts
/functions.sh
20 local voltype
="${6:-dynamic}"
24 echo "vol_type=$voltype"
28 [ -n "$size" ] && echo "vol_size=${size}"
32 if [ "$autoresize" ]; then
33 echo "vol_flags=autoresize"
41 local rootfs_type
="$( get_fs_type "$2" )"
44 if [ "$1" = "ubootenv" ]; then
45 ubivol
$vol_id ubootenv
46 vol_id
=$
(( $vol_id + 1 ))
47 ubivol
$vol_id ubootenv2
48 vol_id
=$
(( $vol_id + 1 ))
50 for part
in $parts; do
55 [ "$prev" = "$part" ] && part
=
58 if [ "${image:0:1}" = ":" ]; then
64 [ "$prev" = "$part" ] && part
=
67 if [ -z "$size" ]; then
68 size
="$( round_up "$
( stat
-c%s
"$image" )" 1024 )"
73 ubivol
$vol_id "$name" "$image" "" "${size}" "$voltype"
74 vol_id
=$
(( $vol_id + 1 ))
77 ubivol
$vol_id kernel
"$3"
78 vol_id
=$
(( $vol_id + 1 ))
82 case "$rootfs_type" in
87 # squashfs uses 1k block size, ensure we do not
89 rootsize
="$( round_up "$
( stat
-c%s
"$2" )" 1024 )"
92 ubivol
$vol_id rootfs
"$2" "$autoresize" "$rootsize" dynamic
94 vol_id
=$
(( $vol_id + 1 ))
95 [ "$rootfs_type" = "ubifs" ] || ubivol
$vol_id rootfs_data
"" 1 dymamic
100 if [ -n "$SOURCE_DATE_EPOCH" ] ; then
101 ubinize_seq
="-Q $SOURCE_DATE_EPOCH"
135 if [ ! "$outfile" ]; then
144 if [ ! -r "$rootfs" -a ! -r "$kernel" -a ! "$outfile" ]; then
145 echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] [--rootfs rootfsimage] out [ubinize opts]"
149 ubinize
="$( command -v ubinize )"
150 if [ ! -x "$ubinize" ]; then
151 echo "ubinize tool not found or not usable"
155 ubinizecfg
="$( mktemp 2> /dev/null )"
156 if [ -z "$ubinizecfg" ]; then
158 ubinizecfg
="$( mktemp -t 'ubitmp' )"
160 ubilayout
"$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg"
164 ubinize
$ubinize_seq -o "$outfile" $ubinize_param "$ubinizecfg"
166 [ ! -e "$outfile" ] && err
=2