diff --git a/SOURCES/grubby-bls b/SOURCES/grubby-bls
index 274107f..f9ba1db 100755
--- a/SOURCES/grubby-bls
+++ b/SOURCES/grubby-bls
@@ -92,7 +92,7 @@ get_bls_values() {
         bls="${bls%.conf}"
         bls="${bls##*/}"
         echo "${bls}"
-    done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp | tac)) || :
+    done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp 2>/dev/null | tac)) || :
 
     for bls in "${files[@]}" ; do
         blspath="${blsdir}/${bls}.conf"
@@ -224,10 +224,10 @@ has_kernelopts()
     local opts=(${args})
 
     for opt in ${opts[*]}; do
-        [[ $opt = "\$kernelopts" ]] && return 0
+        [[ $opt = "\$kernelopts" ]] && echo "true"
     done
 
-    return 1
+    echo "false"
 }
 
 get_bls_args() {
@@ -504,11 +504,11 @@ update_bls_fragment() {
             local old_args="$(get_bls_args "$i")"
             local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
 
-            if [[ $param != "ALL" || ! "$(has_kernelopts "$i")" ]]; then
+            if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then
                 set_bls_value "${bls_file[$i]}" "options" "${new_args}"
             fi
 
-            if [[ $bootloader = grub2 && ! "$(has_kernelopts "$i")" && $opts = $new_args ]]; then
+            if [[ $bootloader = grub2 && "$(has_kernelopts "$i")" = "false" && $opts = $new_args ]]; then
                 set_bls_value "${bls_file[$i]}" "options" "\$kernelopts"
             fi
 	fi
@@ -568,7 +568,7 @@ remove_var_prefix() {
 update_grubcfg()
 {
     if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then
-	grub2-mkconfig -o /boot/grub2/grub.cfg >& /dev/null
+	grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
     fi
 }
 
@@ -591,7 +591,6 @@ Usage: grubby [OPTION...]
       --initrd=initrd-path                initrd image for the new kernel
   -i, --extra-initrd=initrd-path          auxiliary initrd image for things other than the new kernel
       --make-default                      make the newly added entry the default boot entry
-  -o, --output-file=path                  path to output updated config file ("-" for stdout)
       --remove-args=STRING                remove kernel arguments
       --remove-kernel=kernel-path         remove all entries for the specified kernel
       --set-default=kernel-path           make the first entry referencing the specified kernel the default
@@ -607,9 +606,9 @@ Help options:
 EOF
 }
 
-OPTS="$(getopt -o c:i:o:b:? --long help,add-kernel:,args:,bad-image-okay,\
+OPTS="$(getopt -o c:i:b:? --long help,add-kernel:,args:,bad-image-okay,\
 config-file:,copy-default,default-kernel,default-index,default-title,env:,\
-grub2,info:,initrd:,extra-initrd:,make-default,output-file:,remove-args:,\
+grub2,info:,initrd:,extra-initrd:,make-default,remove-args:,\
 remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\
 bls-directory:,add-kernel:,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\
 bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\
@@ -637,6 +636,7 @@ while [ ${#} -gt 0 ]; do
             bad_image=true
             ;;
         --config-file|-c)
+            grub_config="${2}"
             zipl_config="${2}"
             shift
             ;;
@@ -674,10 +674,6 @@ while [ ${#} -gt 0 ]; do
         --make-default)
             make_default=true
             ;;
-        --output-file|-o)
-            output_file="${2}"
-            shift
-            ;;
         --remove-args)
             remove_args="${2}"
             shift
@@ -750,6 +746,10 @@ if [[ -z $zipl_config ]]; then
     zipl_config="/etc/zipl.conf"
 fi
 
+if [[ -z $grub_config ]]; then
+    grub_config="/boot/grub2/grub.cfg"
+fi
+
 get_bls_values
 
 default_index="$(get_default_index)"
diff --git a/SPECS/grubby.spec b/SPECS/grubby.spec
index ff66898..80e4b97 100644
--- a/SPECS/grubby.spec
+++ b/SPECS/grubby.spec
@@ -1,6 +1,6 @@
 Name: grubby
 Version: 8.40
-Release: 37%{?dist}
+Release: 38%{?dist}
 Summary: Command line tool for updating BootLoaderSpec files
 License: GPLv2+
 URL: https://github.com/rhinstaller/grubby
@@ -166,6 +166,16 @@ current boot environment.
 %{_mandir}/man8/*.8*
 
 %changelog
+* Thu Nov 28 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-38
+- grubby-bls: don't print rpm-sort error messages
+  Resolves: rhbz#1731924
+- grubby-bls: remove -o option and support -c for ppc64le grub config
+  Resolves: rhbz#1758598
+- grubby-bls: fix logic to check if the kernelopts var is defined in a BLS
+  Resolves: rhbz#1726514
+- grubby-bls: don't update grubenv when generating grub.cfg for ppc64le
+  Related: rhbz#1726514
+
 * Mon May 20 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-37
 - grubby-bls: unset default entry if is the one being removed
   Resolves: rhbz#1668329