Browse code

Support for kernel update/upgrade. grub.cfg: Removes hardcoded root=(hd0,2)

YustasSwamp authored on 2015/08/14 07:15:48
Showing 3 changed files
... ...
@@ -4,7 +4,7 @@
4 4
 Summary:        Kernel
5 5
 Name:        linux-esx
6 6
 Version:    4.1.3
7
-Release:    2%{?dist}
7
+Release:    3%{?dist}
8 8
 License:    GPLv2
9 9
 URL:        http://www.kernel.org/
10 10
 Group:        System Environment/Kernel
... ...
@@ -103,13 +103,11 @@ cp -r Documentation/*        %{buildroot}%{_defaultdocdir}/linux-esx-%{version}
103 103
 
104 104
 %post
105 105
 /sbin/depmod -aq %{version}-esx
106
-test -f /boot/grub/grub.cfg && sed -i '/set theme=/a \
107
-\
108
-menuentry "linux-esx-4.1.3" { \
109
-    insmod ext2 \
110
-    insmod part_gpt \
111
-    linux /boot/vmlinuz-esx-4.1.3 init=/lib/systemd/systemd tsc=reliable no_timer_check rcupdate.rcu_expedited=1 rootfstype=ext4 root='`df | grep -e "\/$" | cut -f 1 -d " "`' rw systemd.show_status=0 elevator=noop quiet \
112
-}' /boot/grub/grub.cfg
106
+cat > /boot/photon.cfg << "EOF"
107
+# GRUB Environment Block
108
+photon_cmdline=init=/lib/systemd/systemd tsc=reliable no_timer_check rcupdate.rcu_expedited=1 rootfstype=ext4 rw systemd.show_status=0 elevator=noop quiet
109
+photon_linux=/boot/vmlinuz-esx-%{version}
110
+EOF
113 111
 
114 112
 %files
115 113
 %defattr(-,root,root)
... ...
@@ -131,6 +129,8 @@ menuentry "linux-esx-4.1.3" { \
131 131
 /lib/modules/%{version}-esx/build
132 132
 
133 133
 %changelog
134
+*   Thu Aug 13 2015 Alexey Makhalov <amakhalov@vmware.com> 4.1.3-3
135
+-   Added environment file for grub.
134 136
 *   Tue Aug 11 2015 Alexey Makhalov <amakhalov@vmware.com> 4.1.3-2
135 137
     Added pci-probe-vmware.patch. Removed unused modules. Decreased boot time. 
136 138
 *   Tue Jul 28 2015 Alexey Makhalov <amakhalov@vmware.com> 4.1.3-1
... ...
@@ -4,7 +4,7 @@
4 4
 Summary:        Kernel
5 5
 Name:        linux
6 6
 Version:    4.0.9
7
-Release:    1%{?dist}
7
+Release:    2%{?dist}
8 8
 License:    GPLv2
9 9
 URL:        http://www.kernel.org/
10 10
 Group:        System Environment/Kernel
... ...
@@ -125,6 +125,12 @@ EOF
125 125
 
126 126
 %post
127 127
 /sbin/depmod -aq %{version}
128
+cat > /boot/photon.cfg << "EOF"
129
+# GRUB Environment Block
130
+photon_cmdline=init=/lib/systemd/systemd rootfstype=ext4 ro loglevel=3 quiet
131
+photon_linux=/boot/vmlinuz-%{version}
132
+photon_initrd=/boot/initrd.img-no-kmods
133
+EOF
128 134
 
129 135
 %post drivers-gpu
130 136
 /sbin/depmod -aq %{version}
... ...
@@ -164,6 +170,8 @@ EOF
164 164
 /lib/modules/%{version}/kernel/sound
165 165
 
166 166
 %changelog
167
+*   Thu Aug 13 2015 Alexey Makhalov <amakhalov@vmware.com> 4.0.9-2
168
+-   Added environment file for grub.
167 169
 *   Wed Aug 12 2015 Sharath George <sharathg@vmware.com> 4.0.9-1
168 170
 -   Upgrading kernel version.
169 171
 *   Wed Aug 12 2015 Alexey Makhalov <amakhalov@vmware.com> 3.19.2-5
... ...
@@ -75,16 +75,18 @@ mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
75 75
 cp boot/splash.tga ${BUILDROOT}/boot/grub2/themes/photon/photon.tga
76 76
 cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
77 77
 cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
78
-cat > "$BUILDROOT"/boot/grub2/grub.cfg << "EOF"
78
+cat > $BUILDROOT/boot/grub2/grub.cfg << EOF
79 79
 # Begin /boot/grub2/grub.cfg
80 80
 set default=0
81 81
 set timeout=5
82
-set root=(hd0,2)
82
+search -n -u $UUID -s
83 83
 loadfont /boot/grub2/unifont.pf2
84 84
 
85 85
 insmod gfxterm
86 86
 insmod vbe
87 87
 insmod tga
88
+insmod ext2
89
+insmod part_gpt
88 90
 
89 91
 set gfxmode="640x480"
90 92
 gfxpayload=keep
... ...
@@ -92,18 +94,17 @@ gfxpayload=keep
92 92
 terminal_output gfxterm
93 93
 
94 94
 set theme=/boot/grub2/themes/photon/theme.txt
95
+load_env -f /boot/photon.cfg
95 96
 
96 97
 menuentry "Photon" {
97
-	insmod ext2
98
-    insmod part_gpt
99
-	linux /boot/vmlinuz-4.0.9 init=/lib/systemd/systemd root=UUID=UUID_PLACEHOLDER loglevel=3 ro
100
-	initrd /boot/initrd.img-no-kmods
98
+    linux \$photon_linux root=$PARTITION \$photon_cmdline
99
+    if [ "\$photon_initrd" ]; then
100
+        initrd \$photon_initrd
101
+    fi
101 102
 }
102 103
 # End /boot/grub2/grub.cfg
103 104
 EOF
104 105
 
105
-sed -i "s/UUID_PLACEHOLDER/$UUID/" "$BUILDROOT"/boot/grub2/grub.cfg > ${LOGFILE}	
106
-
107 106
 #Cleanup the workspace directory
108 107
 rm -rf "$BUILDROOT"/tools
109 108
 rm -rf "$BUILDROOT"/RPMS