Commit 9c11a77e authored by Arnaud Ferraris's avatar Arnaud Ferraris Committed by Denis Pynkin

u-boot-update: use /etc/kernel/cmdline instead of /etc/default/u-boot

With the previous implementation, we used both the contents of
`/etc/kernel/cmdline` and of `/etc/default/u-boot`, which could cause
some command-line parameters to appear twice on the final command-line.

As the preferred method is to use `/etc/kernel/cmdline`, this commit
improves on the previous one by using only the contents of this file,
and revert to using the variables in `/etc/default/u-boot` in case
`cmdline` is missing or empty.
Signed-off-by: Arnaud Ferraris's avatarArnaud Ferraris <arnaud.ferraris@collabora.com>
parent 8c81defb
Pipeline #107935 waiting for manual action with stages
in 50 seconds
......@@ -94,43 +94,47 @@ U_BOOT_MENU_LABEL="Apertis kernel"
U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}"
U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-${_BOOT_DIRECTORY}/dtbs/}"
# Import additional kernel command-line parameters
CMDLINE_OPTS=`cat /etc/kernel/cmdline`
if [ "${CMDLINE_OPTS}" ]
# Use system-wide command-line parameters if any
if [ -f /etc/kernel/cmdline ]
then
U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS} ${CMDLINE_OPTS}"
CMDLINE_OPTS=`cat /etc/kernel/cmdline`
fi
# Find parameter for root from fstab
if [ -z "${U_BOOT_ROOT}" ]
if [ -z "${CMDLINE_OPTS}" ]
then
# Find root partition
while read _LINE
do
# Find parameter for root from fstab
if [ -z "${U_BOOT_ROOT}" ]
then
# Find root partition
while read _LINE
do
read _FS_SPEC _FS_FILE _FS_VFSTYPE _FS_MNTOPS _FS_FREQ _FS_PASSNO << EOF
${_LINE}
EOF
if [ "${_FS_SPEC}" != "#" ] && [ "${_FS_FILE}" = "/" ]
then
U_BOOT_ROOT="root=${_FS_SPEC}"
break
fi
done < /etc/fstab
fi
if [ "${_FS_SPEC}" != "#" ] && [ "${_FS_FILE}" = "/" ]
then
U_BOOT_ROOT="root=${_FS_SPEC}"
break
fi
done < /etc/fstab
fi
# if not in fsrab, try from current kernel arguments
if [ -z "${U_BOOT_ROOT}" ]
then
for param in `cat /proc/cmdline`
do
if [[ $param == root=* ]]
then
U_BOOT_ROOT="$param"
break
fi
done
# if not in fstab, try from current kernel arguments
if [ -z "${U_BOOT_ROOT}" ]
then
for param in `cat /proc/cmdline`
do
if [[ $param == root=* ]]
then
U_BOOT_ROOT="$param"
break
fi
done
fi
CMDLINE_OPTS="${U_BOOT_ROOT} ${U_BOOT_PARAMETERS}"
fi
......@@ -190,7 +194,7 @@ label l${_NUMBER}
linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
${_INITRD}
${_FDT}
append ${U_BOOT_ROOT} ${U_BOOT_PARAMETERS}"
append ${CMDLINE_OPTS}"
fi
......@@ -205,7 +209,7 @@ label l${_NUMBER}r
linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
${_INITRD}
${_FDT}
append ${U_BOOT_ROOT} $(echo ${U_BOOT_PARAMETERS} | sed -e 's| quiet||') single
append $(echo ${CMDLINE_OPTS} | sed -e 's| quiet||') single
"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment