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"
44 rootfs_type
="$( get_fs_type "$2" )"
45 if [ "$1" = "ubootenv" ]; then
46 ubivol
$vol_id ubootenv
47 vol_id
=$
(( vol_id
+ 1 ))
48 ubivol
$vol_id ubootenv2
49 vol_id
=$
(( vol_id
+ 1 ))
51 for part
in $parts; do
56 [ "$prev" = "$part" ] && part
=
59 if [ "${image#:}" != "$image" ]; then
65 [ "$prev" = "$part" ] && part
=
68 if [ -z "$size" ]; then
69 size
="$( round_up "$
( stat
-c%s
"$image" )" 1024 )"
74 ubivol
$vol_id "$name" "$image" "" "${size}" "$voltype"
75 vol_id
=$
(( vol_id
+ 1 ))
78 ubivol
$vol_id kernel
"$3"
79 vol_id
=$
(( vol_id
+ 1 ))
83 case "$rootfs_type" in
88 # squashfs uses 1k block size, ensure we do not
90 rootsize
="$( round_up "$
( stat
-c%s
"$2" )" 1024 )"
93 ubivol
$vol_id rootfs
"$2" "$autoresize" "$rootsize" dynamic
95 vol_id
=$
(( vol_id
+ 1 ))
96 [ "$rootfs_type" = "ubifs" ] || ubivol
$vol_id rootfs_data
"" 1 dymamic
101 if [ -n "$SOURCE_DATE_EPOCH" ] ; then
102 ubinize_seq
="-Q $SOURCE_DATE_EPOCH"
136 if [ ! "$outfile" ]; then
145 if [ ! -r "$rootfs" ] && [ ! -r "$kernel" ] && [ ! "$parts" ] && [ ! "$outfile" ]; then
146 echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] [--rootfs rootfsimage] out [ubinize opts]"
150 ubinize
="$( command -v ubinize )"
151 if [ ! -x "$ubinize" ]; then
152 echo "ubinize tool not found or not usable"
156 ubinizecfg
="$( mktemp 2> /dev/null )"
157 if [ -z "$ubinizecfg" ]; then
159 ubinizecfg
="$( mktemp -t 'ubitmp' )"
161 ubilayout
"$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg"
165 ubinize
$ubinize_seq -o "$outfile" $ubinize_param "$ubinizecfg"
167 [ ! -e "$outfile" ] && err
=2