[PATCH] scripts: gen_image_generic: allow FAT fs on kernel partition for non-GPT targets

Paul D newtwen at gmail.com
Fri Mar 29 08:32:18 PDT 2024


Recommend avoiding -a and -o params.

Use instead e.g.

[ -n "$GUID" ] || [ "$KERNELPARTTYPE" = "6" ] || [ "$KERNELPARTTYPE" = "c" ]

https://www.shellcheck.net/wiki/SC2166



On 2024-03-28 18:00, Tomasz Maciej Nowak wrote:
> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
> 
> Some old or proprietary bootloader recognize only FAT file system
> variants on storage devices with MBR, unfortunately script ties
> format of kernel partition to GPT partition table. So, allow kernel
> partition file system to be FAT16 or FAT32 if appropriate type is set
> in partition table.
> 
> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
> ---
>   scripts/gen_image_generic.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh
> index 11e40f38868f..44837fde1e12 100755
> --- a/scripts/gen_image_generic.sh
> +++ b/scripts/gen_image_generic.sh
> @@ -49,7 +49,7 @@ dos_dircopy() {
>   [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
>   dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
>   
> -if [ -n "$GUID" ]; then
> +if [ -n "$GUID" -o "$KERNELPARTTYPE" = "6" -o "$KERNELPARTTYPE" = "c" ]; then
>       [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$((ROOTFSOFFSET + ROOTFSSIZE))" conv=notrunc count="$sect"
>       mkfs.fat --invariant -n kernel -C "$OUTPUT.kernel" -S 512 "$((KERNELSIZE / 1024))"
>       LC_ALL=C dos_dircopy "$KERNELDIR" /




More information about the openwrt-devel mailing list