From 5c18f09d977475684c12513d8149f1f3da159055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 28 Dec 2021 12:17:58 +0100 Subject: [PATCH] machine-raspberrypi: Make card-write compatible to meta-raspberrypi's wic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- scripts/include/machine-raspberrypi.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/include/machine-raspberrypi.inc b/scripts/include/machine-raspberrypi.inc index 088429a..7b88594 100644 --- a/scripts/include/machine-raspberrypi.inc +++ b/scripts/include/machine-raspberrypi.inc @@ -1,14 +1,14 @@ #! /bin/bash # machine-raspberrypi.inc -# (c) Copyright 2018 Andreas Müller +# (c) Copyright 2021 Andreas Müller # Licensed under terms of GPLv2 # # This script contains settings and callbacks fir raspberrypi boards # default settings DEFAULT_MACHINE_FAMILY='raspberrypi*' -DEFAULT_FIND_ROOTFS='-name *.rpi-sdimg -type l' +DEFAULT_FIND_ROOTFS='-name *.rpi-sdimg -o -name *.wic -o -name *.wic.bz2 -type l' DEFAULT_KERNEL_IMAGE_TYPE='Image' # callback for card-write @@ -18,7 +18,12 @@ RootCardWriteCallback() { # evt. write partition table CheckPartitionTable "$DevicePath" # write - EvalExAuto "dd of=$DevicePath oflag=nocache if=$DeployedFile bs=1024K" "\nWrite $DeployedFile to $DevicePath..." + StartMessage="\nWrite $DeployedFile to $DevicePath..." + if echo $DeployedFile | grep -q '.wic.bz2'; then + EvalExAuto "bunzip2 -c $DeployedFile | dd of=$DevicePath oflag=nocache bs=1024K" "$StartMessage" + else + EvalExAuto "dd of=$DevicePath oflag=nocache if=$DeployedFile bs=1024K" "$StartMessage" + fi # resize I EvalExAuto "parted -s $DevicePath -- resizepart 2 -0" "\nResize I ${DevicePath}2..." # resize II