diff mbox series

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

Message ID 20210407053419.449796-5-gregkh@linuxfoundation.org (mailing list archive)
State New
Headers show
Series kbuild: unify the install.sh script usage | expand

Commit Message

Greg KH April 7, 2021, 5:34 a.m. UTC
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.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Masahiro Yamada April 7, 2021, 11:03 a.m. UTC | #1
On Wed, Apr 7, 2021 at 2:34 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> 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@linuxfoundation.org>
> ---
>  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
diff mbox series

Patch

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