--- trunk/grubby/new-kernel-pkg 2016/06/30 10:06:57 2971 +++ trunk/grubby/new-kernel-pkg 2017/06/27 14:22:13 3004 @@ -155,7 +155,7 @@ mbargs="${HYPERVISOR_ARGS}" adddracutargs="" addplymouthinitrd="" -DEBUGARG="systemd.debug" +DEBUGARG="systemd.log_level=debug systemd.log_target=kmsg" usage() { @@ -165,7 +165,7 @@ echo " [--banner=] [--multiboot=multiboot]" >&2 echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 echo " [--add-plymouth-initrd]" >&2 - echo " [--host-only] [--devtree=]" >&2 + echo " [--host-only] [--devtree=] [--devtreedir=]" >&2 echo " <--install | --remove | --update> " >&2 echo " (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2 exit 1 @@ -177,7 +177,12 @@ then [[ ${MAKEDEBUG} != yes ]] && return 0 [[ -n ${verbose} ]] && echo "- First, making a debug entry." - declare -x debugtitle=" with debugging" + if [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]] + then + declare -x debugtitle="_with_debugging" + else + declare -x debugtitle=" with debugging" + fi declare -x debugargs="${DEBUGARG}" shift else @@ -236,12 +241,19 @@ fi DEVTREE="" - if [[ x${devtreefile} != x ]] && [ -f "${devtreefile}" ] + if [[ -n ${devtreefile} ]] && [ -f ${devtreefile} ] then [[ -n ${verbose} ]] && echo "found ${devtreefile} and using it with grubby" DEVTREE="--devtree ${devtreefile}" fi + DEVTREEDIR="" + if [[ -n ${devtreedir} ]] && [ -d ${devtreedir} ] + then + [ -n ${verbose} ] && echo "found ${devtreedir} and using it with grubby" + DEVTREEDIR="--devtreedir ${devtreedir}" + fi + # FIXME: is this a good heuristic to find out if we're on iSeries? if [ -d /proc/iSeries ] then @@ -352,7 +364,8 @@ [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}" ARGS="--extlinux -c ${extlinuxConfig} --add-kernel=${kernelImage} \ - ${DEVTREE} ${INITRD} --copy-default --title \"${title}\${debugtitle}\" \ + ${DEVTREEDIR} ${DEVTREE} \ + ${INITRD} --copy-default --title \"${title}\${debugtitle}\" \ ${mbkernel:+--add-multiboot=\"${mbkernel}\"} \ ${mbargs:+--mbargs=\"${mbargs}\"} \ --args=\"root=${rootdevice} ${kernargs} \${debugargs}\" \ @@ -506,12 +519,19 @@ fi DEVTREE="" - if [[ x${devtreefile} != x ]] && [ -f ${devtreefile} ] + if [[ -n ${devtreefile} ]] && [ -f ${devtreefile} ] then [[ -n ${verbose} ]] && echo "found ${devtreefile} and using it with grubby" DEVTREE="--devtree ${devtreefile}" fi + DEVTREEDIR="" + if [[ -n ${devtreedir} ]] && [ -d ${devtreedir} ] + then + [[ -n ${verbose} ]] && echo "found ${devtreedir} and using it with grubby" + DEVTREEDIR="--devtreedir ${devtreedir}" + fi + if [[ -n ${cfgGrub} ]] then [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}" @@ -614,7 +634,7 @@ then [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}" ARGS="--extlinux -c ${extlinuxConfig} --update-kernel=${kernelImage} \ - ${DEVTREE} ${INITRD} ${kernargs:+--args=\"${kernargs}\"} \ + ${DEVTREE} ${DEVTREEDIR} ${INITRD} ${kernargs:+--args=\"${kernargs}\"} \ ${removeargs:+--remove-args=\"${removeargs}\"} \ --title=\"${title}\${debugtitle}\"" rungrubby --debug ${ARGS} @@ -694,6 +714,16 @@ fi ;; + --devtreedir*) + if [[ $1 == --devtreedir\=* ]] + then + devtreedir=${1#--devtreedir=} + else + devtreedir=$2 + shift + fi + ;; + --dracut) dracut=--dracut ;; @@ -879,60 +909,37 @@ if [[ ${ARCH} =~ armv[5|7].*l ]] then - if [ -d ${bootPrefix}/dtb-${version}/ ] + if [[ -z ${SHIPSDTB} ]] || [[ ${SHIPSDTB} != yes ]] then - devtreedir="${bootPrefix}/dtb-${version}/" - if [[ -n ${dtbfile} ]] && [ -f ${devtreedir}/${dtbfile} ] + if [[ -n ${dtbfile} ]] && [ -f ${bootPrefix}/dtb-${version}/${dtbfile} ] then - devtreefile="${devtreedir}/${dtbfile}" + devtreefile="${bootPrefix}/dtb-${version}/${dtbfile}" + [[ -n ${verbose} ]] && echo "devtreefile is ${devtreefile}" + elif [ -d ${bootPrefix}/dtb-${version}/ ] + then + devtreedir="${bootPrefix}/dtb-${version}/" + [[ -n ${verbose} ]] && echo "devtreedir is ${devtreedir}" fi fi fi [[ -n ${verbose} ]] && echo "devtreedir is ${devtreedir}" -# add dracut i18n, keyboard and plymouth kernel args if requested -if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]] -then - if [ -r /etc/vconsole.conf ] - then - . /etc/vconsole.conf - - for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE - do - val=$(eval echo \$$i) - [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}" - done - else - if [ -r /etc/conf.d/consolefont ] - then - . /etc/conf.d/consolefont - - if [[ -n ${CONSOLEFONT} ]] - then - kernargs="${kernargs} SYSFONT=${CONSOLEFONT}" - fi - fi - - if [ -r /etc/conf.d/keymap ] - then - . /etc/conf.d/keymap - - if [[ -n ${KEYMAP} ]] - then - kernargs="${kernargs} KEYTABLE=${KEYMAP}" - fi - fi - fi - - if [ -r /etc/locale.conf ] - then - . /etc/locale.conf - - if [[ -n ${LANG} ]] - then - kernargs="${kernargs} LANG=${LANG}" - fi - fi +# add dracut kernel args if requested +if [[ -n ${dracut} ]] && [[ -n ${adddracutargs} ]] + [ -r /etc/vconsole.conf ] && . /etc/vconsole.conf + [ -r /etc/locale.conf ] && . /etc/locale.conf + + while read opt rd_opt + do + [ -n "${!opt}" ] && kernargs="$kernargs $rd_opt=\"${!opt}\"" + done <<< 'KEYMAP rd.vconsole.keymap + FONT rd.vconsole.font + FONT_MAP rd.vconsole.font.map + FONT_UNIMAP rd.vconsole.font.unimap + UNICODE rd.vconsole.font.unicode + EXT_KEYMAP rd.vconsole.keymap.ext + LANG rd.locale.LANG + LC_ALL rd.locale.LC_ALL' fi # set this as the default if we have the package and it matches @@ -1027,4 +1034,13 @@ # if we mounted the U-Boot directory, unmount it. [[ -n ${mounted} ]] && umount ${ubootDir} +# make sure changes make it to the disk. +# if /boot is a mountpoint, force the meta data on disk +# to by-pass writeback delay. +# PPC64LE-only to deal with Petitboot issues +if [[ ${ARCH} = ppc64le ]] +then + sync && mountpoint -q /boot && fsfreeze -f /boot && fsfreeze -u /boot +fi + exit 0