define Build/append-ubi
sh $(TOPDIR)/scripts/ubinize-image.sh \
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
- $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
- $(if $(findstring fit,$(1)), \
- $(if $(KERNEL_IN_UBI),--part fit=$(IMAGE_KERNEL)), \
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
- --rootfs $(IMAGE_ROOTFS)) \
+ $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
+ --rootfs $(IMAGE_ROOTFS) \
$@.tmp \
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
$(call Build/check-size,$(UBI_NAND_SIZE_LIMIT)))
endef
+define Build/ubinize-image
+ sh $(TOPDIR)/scripts/ubinize-image.sh \
+ $(if $(UBOOTENV_IN_UBI),--uboot-env) \
+ $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
+ --part $(word 1,$(1))="$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(word 2,$(1))" \
+ $@ \
+ -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
+ $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
+ $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
+ $(UBINIZE_OPTS)
+endef
+
define Build/ubinize-kernel
cp $@ $@.tmp
sh $(TOPDIR)/scripts/ubinize-image.sh \
ubinize_seq=""
ubivol() {
- local volid=$1
- local name=$2
- local image=$3
- local autoresize=$4
+ local volid="$1"
+ local name="$2"
+ local image="$3"
+ local autoresize="$4"
local size="$5"
local voltype="${6:-dynamic}"
echo "[$name]"
ubilayout() {
local vol_id=0
- local rootsize=
- local autoresize=
- local rootfs_type="$( get_fs_type "$2" )"
+ local rootsize
+ local autoresize
+ local rootfs_type
local voltype
+ rootfs_type="$( get_fs_type "$2" )"
if [ "$1" = "ubootenv" ]; then
ubivol $vol_id ubootenv
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
ubivol $vol_id ubootenv2
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
fi
for part in $parts; do
name="${part%%=*}"
[ "$prev" = "$part" ] && part=
image="${part%%=*}"
- if [ "${image:0:1}" = ":" ]; then
+ if [ "${image#:}" != "$image" ]; then
voltype=static
- image="${image:1}"
+ image="${image#:}"
fi
prev="$part"
part="${part#*=}"
fi
ubivol $vol_id "$name" "$image" "" "${size}" "$voltype"
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
done
if [ "$3" ]; then
ubivol $vol_id kernel "$3"
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
fi
if [ "$2" ]; then
esac
ubivol $vol_id rootfs "$2" "$autoresize" "$rootsize" dynamic
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
[ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1 dymamic
fi
}
continue
;;
"-"*)
- ubinize_param="$@"
+ ubinize_param="$*"
break
;;
*)
esac
done
-if [ ! -r "$rootfs" -a ! -r "$kernel" -a ! "$outfile" ]; then
+if [ ! -r "$rootfs" ] && [ ! -r "$kernel" ] && [ ! "$parts" ] && [ ! "$outfile" ]; then
echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] [--rootfs rootfsimage] out [ubinize opts]"
exit 1
fi