Re: [PATCH 04/20] kbuild: scripts/install.sh: call sync before calling the bootloader installer

From: Masahiro Yamada
Date: Wed Apr 07 2021 - 07:04:19 EST


On Wed, Apr 7, 2021 at 2:34 PM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> It's good to ensure that the files are written out before calling the
> bootloader installer, as other architectures do, so call sync after
> doing the copying of the kernel and system map files.


I see 3 architectures that call 'sync' from install.sh

masahiro@grover:~/ref/linux$ find . -name install.sh | xargs grep sync
./arch/nios2/boot/install.sh:sync
./arch/x86/boot/install.sh: sync
./arch/m68k/install.sh:sync


As for nios2 and m68k, they do not call
any bootloader-specific setups.



> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
> scripts/install.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/install.sh b/scripts/install.sh
> index af36c0a82f01..92d0d2ade414 100644
> --- a/scripts/install.sh
> +++ b/scripts/install.sh
> @@ -52,12 +52,12 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
> # Default install - same as make zlilo
> install "$2" "$4"/vmlinuz
> install "$3" "$4"/System.map
> +sync
>
> if [ -x /sbin/lilo ]; then
> /sbin/lilo
> elif [ -x /etc/lilo/install ]; then
> /etc/lilo/install
> else
> - sync
> echo "Cannot find LILO."
> fi
> --
> 2.31.1
>

Why do we need 'sync' before lilo invocation?



If you want to ensure everything is flushed
to a disk before this scripts exits,
adding 'sync' at the end of the script
makes more sense, in my opinion.



if [ -x /sbin/lilo ]; then
/sbin/lilo
elif [ -x /etc/lilo/install ]; then
/etc/lilo/install
else
echo "Cannot find LILO."
fi

sync




This goes aligned with nios2 and m68k.



--
Best Regards

Masahiro Yamada