update-initramfs: Update comments, fix some typos
PATCH 1/3 update-initramfs: Update comments, fix some typos
update-initramfs is crucial for DRM drivers, let's clarify this.
--- scripts/update-initramfs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
scripts/update-initramfs +5 -7
@@ -1,12 +1,10 @@ #!/bin/bash # Copyright 2009 Luis R. Rodriguez <[email protected]> # -# Since we provide ssb, the Ethernet module b44 some people may -# rely on it to netboot, so update the initrafms for each -# distribution. -# -# Note that in the future people may want to wireless-boot -# so this will help with that as well. +# Since we provide ssb, ethernet modules and most importantly +# DRM drivers, people may want top update the initramfs image +# of their distribution. This can also help people who may +# want to wireless-boot their systems. LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
@@ -29,7 +27,7 @@ case $LSB_RED_ID in ;; *) echo "Warning:" - echo "You may or may not need to update your initframfs, you should if" + echo "You may or may not need to update your initramfs, you should if" echo "any of the modules installed are part of your initramfs. To add" echo "support for your distribution to do this automatically send a" echo "patch against $0. If your distribution does not require this"
Signature · 1 line
1.8.0.2
PATCH 2/3 update-initramfs: Silence lsb_release output
Silence lsb_release output to avoid command not found errors on distributions not having lsb_release like Fedora.
--- scripts/update-initramfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/update-initramfs +1 -1
@@ -6,7 +6,7 @@ # of their distribution. This can also help people who may # want to wireless-boot their systems. -LSB_RED_ID=$(/usr/bin/lsb_release -i -s) +LSB_RED_ID=$(/usr/bin/lsb_release -i -s &> /dev/null) KLIB=/lib/modules/$(uname -r)/build ver=$(echo $KLIB | awk -F "/lib/modules/" '{print $2}' | awk -F"/" '{print $1}')
Signature · 1 line
1.8.0.2
PATCH 3/3 update-initramfs: Add support for Fedora
In reply to Ozan ÇağlayanFedora doesn't ship lsb_release anymore. So try to read /etc/os-release to find whether distribution is Fedora.
If Fedora is found, generate a new initramfs suffixed with -compat-drivers to not override the distribution kernel's default one. Also add a new kernel entry to grub2 configuration without overriding the default boot entry.
--- scripts/update-initramfs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
scripts/update-initramfs +27 -2
@@ -6,12 +6,18 @@ # of their distribution. This can also help people who may # want to wireless-boot their systems. -LSB_RED_ID=$(/usr/bin/lsb_release -i -s &> /dev/null) - KLIB=/lib/modules/$(uname -r)/build ver=$(echo $KLIB | awk -F "/lib/modules/" '{print $2}' | awk -F"/" '{print $1}') dir=/boot/ +LSB_RED_ID=$(/usr/bin/lsb_release -i -s &> /dev/null) + +if [[ -z $LSB_RED_ID && -f "/etc/os-release" ]]; then + # Let's try with os-release. Fedora doesn't have + # lsb_release anymore. + LSB_RED_ID=$(sed -n '/^NAME/ s/^NAME=\(.*\)$/\1/p' /etc/os-release) +fi + case $LSB_RED_ID in "Ubuntu") echo "Updating ${LSB_RED_ID}'s initramfs for $ver under $dir ..."
@@ -25,6 +31,25 @@ case $LSB_RED_ID in echo "Will now run update-grub to ensure grub will find the new initramfs ..." update-grub ;; +"Fedora") + # This adds a -compat-drivers suffixed initramfs with a new grub2 + # entry to not override distribution's default stuff. + INITRAMFS=${dir}initramfs-$ver-compat-drivers.img + KERNEL=${dir}vmlinuz-$ver + GRUB_TITLE="Fedora ($ver) with compat-drivers" + + echo "Updating ${LSB_RED_ID}'s initramfs for $ver under $dir ..." + mkinitrd --force $INITRAMFS $ver + + # If a previous compat-drivers entry for the same kernel exists + # do not add it again. + grep -q "${GRUB_TITLE}" /etc/grub2.cfg &> /dev/null + if [[ "$?" == "1" ]]; then + echo "Will now run grubby to add a new kernel entry ..." + # Add a new kernel entry + grubby --grub2 --copy-default --add-kernel="$KERNEL" --initrd="$INITRAMFS" --title="$GRUB_TITLE" + fi + ;; *) echo "Warning:" echo "You may or may not need to update your initramfs, you should if"
Signature · 1 line
1.8.0.2
Luis R. Rodriguez
AppliedRe: [PATCH 3/3] update-initramfs: Add support for Fedora
On Sat, Dec 22, 2012 at 3:04 AM, Ozan =C3=87a=C4=9Flayan <[email protected]=
Quoted 3 lines
wrote:
Fedora doesn't shiplsb_releaseanymore. So try to read/etc/os-releaseto find whether distribution is Fedora.
Interesting..
Quoted 1 line
If Fedora is found, generate a new initramfs suffixed with -compat-driver=
s
Quoted 5 lines
to not override the distribution kernel's default one. Also add a new kernel entry to grub2 configuration without overriding the default boot entry.
Signed-off-by Ozan =C3=87a=C4=9Flayan <[email protected]>
Thanks! Applied and pushed all!
Luis
On Sat, Dec 22, 2012 at 1:04 PM, Ozan =C3=87a=C4=9Flayan <[email protected]=
Quoted 14 lines
wrote:
update-initramfs is crucial for DRM drivers, let's clarify this.Signed-off-by Ozan =C3=87a=C4=9Flayan <[email protected]>--- scripts/update-initramfs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)scripts/update-initramfs +0
-0@@ -1,12 +1,10 @@ #!/bin/bash
scripts/update-initramfs line 5
Quoted 10 lines
scripts/update-initramfs +2
-6# Copyright 2009 Luis R. Rodriguez <[email protected]> # -# Since we provide ssb, the Ethernet module b44 some people may -# rely on it to netboot, so update the initrafms for each -# distribution. -# -# Note that in the future people may want to wireless-boot -# so this will help with that as well. +# Since we provide ssb, ethernet modules and most importantly +# DRM drivers, people may want top update the initramfs image
grr can you change "top" to "to" while merging this :)