aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRobert Marko <robimarko@gmail.com>2021-09-20 12:10:07 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-11-28 17:17:22 +0100
commit5a305e429facce7fae71f5589b4adbb55b918c9c (patch)
tree8d8fe65d89782fb2fca350a0637661ceef22cc6c /scripts
parentda3261e57cf33d6804222c614c77e13fdb32cf95 (diff)
downloadupstream-5a305e429facce7fae71f5589b4adbb55b918c9c.tar.gz
upstream-5a305e429facce7fae71f5589b4adbb55b918c9c.tar.bz2
upstream-5a305e429facce7fae71f5589b4adbb55b918c9c.zip
scripts: ubinize-image: make rootfs optional
Currently ubinize-image script always expects the rootfs image to be passed and a volume for it created. So, to allow only ubinizing a kernel for example which the MikroTik hAP ac3 and other new NAND devices from MikroTik require make rootfs an optional parameter like kernel. Signed-off-by: Robert Marko <robimarko@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ubinize-image.sh43
1 files changed, 23 insertions, 20 deletions
diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
index c6f8bcefe5..0195695240 100755
--- a/scripts/ubinize-image.sh
+++ b/scripts/ubinize-image.sh
@@ -66,20 +66,22 @@ ubilayout() {
vol_id=$(( $vol_id + 1 ))
fi
- case "$rootfs_type" in
- "ubifs")
- autoresize=1
- ;;
- "squashfs")
- # squashfs uses 1k block size, ensure we do not
- # violate that
- rootsize="$( round_up "$( stat -c%s "$2" )" 1024 )"
- ;;
- esac
- ubivol $vol_id rootfs "$2" "$autoresize" "$rootsize"
+ if [ "$2" ]; then
+ case "$rootfs_type" in
+ "ubifs")
+ autoresize=1
+ ;;
+ "squashfs")
+ # squashfs uses 1k block size, ensure we do not
+ # violate that
+ rootsize="$( round_up "$( stat -c%s "$2" )" 1024 )"
+ ;;
+ esac
+ ubivol $vol_id rootfs "$2" "$autoresize" "$rootsize"
- vol_id=$(( $vol_id + 1 ))
- [ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1
+ vol_id=$(( $vol_id + 1 ))
+ [ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1
+ fi
}
set_ubinize_seq() {
@@ -101,6 +103,12 @@ while [ "$1" ]; do
shift
continue
;;
+ "--rootfs")
+ rootfs="$2"
+ shift
+ shift
+ continue
+ ;;
"--part")
parts="$parts $2"
shift
@@ -112,11 +120,6 @@ while [ "$1" ]; do
break
;;
*)
- if [ ! "$rootfs" ]; then
- rootfs=$1
- shift
- continue
- fi
if [ ! "$outfile" ]; then
outfile=$1
shift
@@ -126,8 +129,8 @@ while [ "$1" ]; do
esac
done
-if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$outfile" ]; then
- echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] rootfs out [ubinize opts]"
+if [ ! -r "$rootfs" -a ! -r "$kernel" -a ! "$outfile" ]; then
+ echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] [--rootfs rootfsimage] out [ubinize opts]"
exit 1
fi