aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Stabellini2021-04-16 10:38:49 -0700
committerStefano Stabellini2021-05-17 14:49:55 -0700
commit34284e68a9f4e23adbad435f497a980ad9f5493e (patch)
tree363dba716ca013eef493fea8b3333d8ad8c44b2c
parent5629a7a4a027bc78a5426bedefb3f9e803b49004 (diff)
Add support for tar.gz rootfses
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Signed-off-by: VĂ­ctor Mayoral Vilches <v.mayoralv@gmail.com> Reviewed-by: Brian Woods <brian.woods@xilinx.com>
-rw-r--r--README.md11
-rwxr-xr-xscripts/disk_image19
2 files changed, 21 insertions, 9 deletions
diff --git a/README.md b/README.md
index eaa7431..c9a9850 100644
--- a/README.md
+++ b/README.md
@@ -114,12 +114,15 @@ partition for each Dom0/DomU cpio archive to write to disk.
disk\_image will write to disk as separate partition each file specified
as follows:
-- DOM0_ROOTFS specifies the Dom0 rootfs to use. Note that the file to
- write should be a regular cpio.gz file, not a u-boot binary.
+- DOM0_ROOTFS specifies the Dom0 rootfs to use.
-- DOMU_ROOTFS[number] specifies the DomU rootfs to use. Note that it
- should be a regular cpio.gz file, not a u-boot binary.
+- DOMU_ROOTFS[number] specifies the DomU rootfs to use.
+The provided rootfs should not be a u-boot binary. The supported
+formats are:
+
+- cpio.gz
+- tar.gz
After you've generated the u-boot scripts using the uboot-script-gen
script, disk_image is run as follows:
diff --git a/scripts/disk_image b/scripts/disk_image
index 6f5f3e2..800de99 100755
--- a/scripts/disk_image
+++ b/scripts/disk_image
@@ -38,7 +38,7 @@ function add_partition()
_npart=$(( $_npart + 1 ))
}
-function write_cpio()
+function write_rootfs()
{
local j=$1
local rootfs=$2
@@ -49,9 +49,18 @@ function write_cpio()
# Extract rootfs cpio archive into `.../part/vos_$j`
cd ${DESTDIR}/part/disk$j
- cat "${UBOOT_OUT_ABS}/$rootfs" | gunzip | cpio -id
+
+ if [[ $rootfs = *.cpio.gz ]]
+ then
+ cat "${UBOOT_OUT_ABS}/$rootfs" | gunzip | cpio -id
+ elif [[ $rootfs = *.tar.gz ]]
+ then
+ tar xvzf "${UBOOT_OUT_ABS}/$rootfs"
+ else
+ echo "Ignoring $rootfs: unsupported file format. Use cpio.gz or tar.gz."
+ fi
+
cd -
-
# umount
sync
umount $DESTDIR/part/disk$j
@@ -263,7 +272,7 @@ umount $DESTDIR/part/disk1
j=2
if test "$DOM0_ROOTFS"
then
- write_cpio 2 "$DOM0_ROOTFS"
+ write_rootfs 2 "$DOM0_ROOTFS"
j=$(( $j + 1 ))
fi
@@ -272,7 +281,7 @@ while test $i -lt $NUM_DOMUS
do
if test "${DOMU_ROOTFS[$i]}"
then
- write_cpio $j "${DOMU_ROOTFS[$i]}"
+ write_rootfs $j "${DOMU_ROOTFS[$i]}"
j=$(( $j + 1 ))
fi
i=$(( $i + 1 ))