3 . $TOPDIR/scripts/functions.sh
22 echo "vol_type=dynamic"
26 [ -n "$size" ] && echo "vol_size=${size}"
30 if [ "$autoresize" ]; then
31 echo "vol_flags=autoresize"
39 local rootfs_type="$( get_fs_type "$2" )"
41 if [ "$1" = "ubootenv" ]; then
42 ubivol $vol_id ubootenv
43 vol_id=$(( $vol_id + 1 ))
44 ubivol $vol_id ubootenv2
45 vol_id=$(( $vol_id + 1 ))
47 for part in $parts; do
51 [ "$prev" = "$part" ] && part=
56 [ "$prev" = "$part" ] && part=
60 ubivol $vol_id "$name" "$image" "" "${size}MiB"
61 vol_id=$(( $vol_id + 1 ))
64 ubivol $vol_id kernel "$3"
65 vol_id=$(( $vol_id + 1 ))
68 case "$rootfs_type" in
73 # squashfs uses 1k block size, ensure we do not
75 rootsize="$( round_up "$( stat -c%s "$2" )" 1024 )"
78 ubivol $vol_id rootfs "$2" "$autoresize" "$rootsize"
80 vol_id=$(( $vol_id + 1 ))
81 [ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1
108 if [ ! "$rootfs" ]; then
113 if [ ! "$outfile" ]; then
122 if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$outfile" ]; then
123 echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] rootfs out [ubinize opts]"
127 ubinize="$( which ubinize )"
128 if [ ! -x "$ubinize" ]; then
129 echo "ubinize tool not found or not usable"
133 ubinizecfg="$( mktemp 2> /dev/null )"
134 if [ -z "$ubinizecfg" ]; then
136 ubinizecfg="$( mktemp -t 'ubitmp' )"
138 ubilayout "$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg"
141 ubinize -o "$outfile" $ubinize_param "$ubinizecfg"
143 [ ! -e "$outfile" ] && err=2