3 . $TOPDIR/scripts/functions.sh
23 echo "vol_type=dynamic"
27 [ -n "$size" ] && echo "vol_size=${size}"
31 if [ "$autoresize" ]; then
32 echo "vol_flags=autoresize"
40 local rootfs_type="$( get_fs_type "$2" )"
42 if [ "$1" = "ubootenv" ]; then
43 ubivol $vol_id ubootenv
44 vol_id=$(( $vol_id + 1 ))
45 ubivol $vol_id ubootenv2
46 vol_id=$(( $vol_id + 1 ))
48 for part in $parts; do
52 [ "$prev" = "$part" ] && part=
57 [ "$prev" = "$part" ] && part=
61 ubivol $vol_id "$name" "$image" "" "${size}MiB"
62 vol_id=$(( $vol_id + 1 ))
65 ubivol $vol_id kernel "$3"
66 vol_id=$(( $vol_id + 1 ))
69 case "$rootfs_type" in
74 # squashfs uses 1k block size, ensure we do not
76 rootsize="$( round_up "$( stat -c%s "$2" )" 1024 )"
79 ubivol $vol_id rootfs "$2" "$autoresize" "$rootsize"
81 vol_id=$(( $vol_id + 1 ))
82 [ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1
86 if [ -n "$SOURCE_DATE_EPOCH" ] ; then
87 ubinize_seq="-Q $SOURCE_DATE_EPOCH"
115 if [ ! "$rootfs" ]; then
120 if [ ! "$outfile" ]; then
129 if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$outfile" ]; then
130 echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] rootfs out [ubinize opts]"
134 ubinize="$( which ubinize )"
135 if [ ! -x "$ubinize" ]; then
136 echo "ubinize tool not found or not usable"
140 ubinizecfg="$( mktemp 2> /dev/null )"
141 if [ -z "$ubinizecfg" ]; then
143 ubinizecfg="$( mktemp -t 'ubitmp' )"
145 ubilayout "$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg"
149 ubinize $ubinize_seq -o "$outfile" $ubinize_param "$ubinizecfg"
151 [ ! -e "$outfile" ] && err=2