1 |
commit: b53f0734cdaab1411b94210bbfbb88b5bb4a19a0 |
2 |
Author: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 15 20:08:48 2019 +0000 |
4 |
Commit: Rick Farina <zerochaos <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 15 20:08:48 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b53f0734 |
7 |
|
8 |
simplify bootloader handling for amd64/x86 |
9 |
|
10 |
remove grub legacy and elilo |
11 |
keep files in /boot rather than moving them around |
12 |
simplify create-iso based on the above |
13 |
|
14 |
Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo.org> |
15 |
|
16 |
targets/support/bootloader-setup.sh | 137 ++++-------------------------------- |
17 |
targets/support/create-iso.sh | 65 ++++++----------- |
18 |
2 files changed, 33 insertions(+), 169 deletions(-) |
19 |
|
20 |
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh |
21 |
index b7e2d313..e4735782 100755 |
22 |
--- a/targets/support/bootloader-setup.sh |
23 |
+++ b/targets/support/bootloader-setup.sh |
24 |
@@ -183,7 +183,6 @@ case ${clst_hostarch} in |
25 |
x86|amd64) |
26 |
if [ -e $1/isolinux/isolinux.bin ] |
27 |
then |
28 |
- cp -f $1/boot/* $1/isolinux |
29 |
# the rest of this function sets up the config file for isolinux |
30 |
icfg=$1/isolinux/isolinux.cfg |
31 |
kmsg=$1/isolinux/kernels.msg |
32 |
@@ -220,26 +219,26 @@ case ${clst_hostarch} in |
33 |
for y in ${clst_kernel_softlevel} |
34 |
do |
35 |
echo "label ${x}-${y}" >> ${icfg} |
36 |
- echo " kernel ${x}" >> ${icfg} |
37 |
- echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg} |
38 |
+ echo " kernel /boot/${x}" >> ${icfg} |
39 |
+ echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
40 |
|
41 |
echo >> ${icfg} |
42 |
echo " ${x}" >> ${kmsg} |
43 |
echo "label ${x}-${y}-nofb" >> ${icfg} |
44 |
- echo " kernel ${x}" >> ${icfg} |
45 |
- echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg} |
46 |
+ echo " kernel /boot/${x}" >> ${icfg} |
47 |
+ echo " append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg} |
48 |
echo >> ${icfg} |
49 |
echo " ${x}-nofb" >> ${kmsg} |
50 |
done |
51 |
else |
52 |
echo "label ${x}" >> ${icfg} |
53 |
- echo " kernel ${x}" >> ${icfg} |
54 |
- echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg} |
55 |
+ echo " kernel /boot/${x}" >> ${icfg} |
56 |
+ echo " append ${default_append_line} initrd=/boot/${x}.igz vga=791" >> ${icfg} |
57 |
echo >> ${icfg} |
58 |
echo " ${x}" >> ${kmsg} |
59 |
echo "label ${x}-nofb" >> ${icfg} |
60 |
- echo " kernel ${x}" >> ${icfg} |
61 |
- echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg} |
62 |
+ echo " kernel /boot/${x}" >> ${icfg} |
63 |
+ echo " append ${default_append_line} initrd=/boot/${x}.igz" >> ${icfg} |
64 |
echo >> ${icfg} |
65 |
echo " ${x}-nofb" >> ${kmsg} |
66 |
fi |
67 |
@@ -263,13 +262,6 @@ case ${clst_hostarch} in |
68 |
then |
69 |
#the grub dir may not exist, better safe than sorry |
70 |
[ -d "$1/grub" ] || mkdir -p "$1/grub" |
71 |
- if [ -e $1/isolinux/isolinux.bin ] |
72 |
- then |
73 |
- kern_subdir=/isolinux |
74 |
- else |
75 |
- cp -f $1/boot/* $1/grub |
76 |
- kern_subdir=/grub |
77 |
- fi |
78 |
|
79 |
iacfg=$1/grub/grub.cfg |
80 |
echo 'set default=0' > ${iacfg} |
81 |
@@ -280,122 +272,17 @@ case ${clst_hostarch} in |
82 |
for x in ${clst_boot_kernel} |
83 |
do |
84 |
echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg} |
85 |
- echo " linux ${kern_subdir}/${x} ${default_append_line}" >> ${iacfg} |
86 |
- echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg} |
87 |
+ echo " linux /boot/${x} ${default_append_line}" >> ${iacfg} |
88 |
+ echo " initrd /boot/${x}.igz" >> ${iacfg} |
89 |
echo "}" >> ${iacfg} |
90 |
echo "" >> ${iacfg} |
91 |
echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {" >> ${iacfg} |
92 |
- echo " linux ${kern_subdir}/${x} ${default_append_line} docache" >> ${iacfg} |
93 |
- echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg} |
94 |
+ echo " linux /boot/${x} ${default_append_line} docache" >> ${iacfg} |
95 |
+ echo " initrd /boot/${x}.igz" >> ${iacfg} |
96 |
echo "}" >> ${iacfg} |
97 |
echo "" >> ${iacfg} |
98 |
done |
99 |
fi |
100 |
- |
101 |
- if [ -e $1/boot/efi/elilo.efi ] |
102 |
- then |
103 |
- [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi |
104 |
- iacfg=$1/boot/elilo.conf |
105 |
- echo 'prompt' > ${iacfg} |
106 |
- echo 'message=/efi/boot/elilo.msg' >> ${iacfg} |
107 |
- echo 'chooser=simple' >> ${iacfg} |
108 |
- echo 'timeout=50' >> ${iacfg} |
109 |
- echo >> ${iacfg} |
110 |
- for x in ${clst_boot_kernel} |
111 |
- do |
112 |
- echo "image=/efi/boot/${x}" >> ${iacfg} |
113 |
- echo " label=${x}" >> ${iacfg} |
114 |
- echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg} |
115 |
- echo " initrd=/efi/boot/${x}.igz" >> ${iacfg} |
116 |
- echo >> ${iacfg} |
117 |
- echo "image=/efi/boot/${x}" >> ${iacfg} |
118 |
- echo >> ${iacfg} |
119 |
- cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null |
120 |
- cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null |
121 |
- done |
122 |
- cp ${iacfg} $1/boot/efi/boot |
123 |
- fi |
124 |
- |
125 |
- # GRUB legacy (0.97) |
126 |
- if [ -e $1/boot/grub/stage2_eltorito ] |
127 |
- then |
128 |
- icfg=$1/boot/grub/menu.lst |
129 |
- echo "default 0" > ${icfg} |
130 |
- echo "timeout 15" >> ${icfg} |
131 |
- echo "pager on" >> ${icfg} |
132 |
- |
133 |
- # Copy our splash if we're a Gentoo release |
134 |
- case ${clst_livecd_type} in |
135 |
- gentoo-*) |
136 |
- [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \ |
137 |
- cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \ |
138 |
- ${1}/boot/grub |
139 |
- ;; |
140 |
- esac |
141 |
- |
142 |
- if [ -e ${1}/boot/grub/splash.xpm.gz ]; then |
143 |
- echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg} |
144 |
- fi |
145 |
- |
146 |
- for x in ${clst_boot_kernel} |
147 |
- do |
148 |
- eval custom_kopts=\$${x}_kernelopts |
149 |
- echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}" |
150 |
- echo >> ${icfg} |
151 |
- |
152 |
- eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel" |
153 |
- |
154 |
- if [ -n "${clst_kernel_softlevel}" ] |
155 |
- then |
156 |
- for y in ${clst_kernel_softlevel} |
157 |
- do |
158 |
- echo "title ${x}-${y}" >> ${icfg} |
159 |
- echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg} |
160 |
- if [ -e $1/boot/${x}.igz ] |
161 |
- then |
162 |
- echo "initrd /boot/${x}.igz" >> ${icfg} |
163 |
- fi |
164 |
- echo >> ${icfg} |
165 |
- echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg} |
166 |
- echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg} |
167 |
- if [ -e $1/boot/${x}.igz ] |
168 |
- then |
169 |
- echo "initrd /boot/${x}.igz" >> ${icfg} |
170 |
- fi |
171 |
- echo >> ${icfg} |
172 |
- done |
173 |
- else |
174 |
- echo "title ${x}" >> ${icfg} |
175 |
- echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg} |
176 |
- if [ -e $1/boot/${x}.igz ] |
177 |
- then |
178 |
- echo "initrd /boot/${x}.igz" >> ${icfg} |
179 |
- fi |
180 |
- echo >> ${icfg} |
181 |
- echo "title ${x} [ No FrameBuffer ]" >> ${icfg} |
182 |
- echo "kernel /boot/${x} ${default_append_line}" >> ${icfg} |
183 |
- if [ -e $1/boot/${x}.igz ] |
184 |
- then |
185 |
- echo "initrd /boot/${x}.igz" >> ${icfg} |
186 |
- fi |
187 |
- fi |
188 |
- |
189 |
- done |
190 |
- |
191 |
- # Setup help message |
192 |
- echo >> ${icfg} |
193 |
- echo "title help" >> ${icfg} |
194 |
- cp ${clst_sharedir}/livecd/files/README.txt \ |
195 |
- $1/boot/help.msg |
196 |
- echo "cat /boot/help.msg" >> ${icfg} |
197 |
- |
198 |
- if [ -f $1/boot/memtest86 ] |
199 |
- then |
200 |
- echo >> ${icfg} |
201 |
- echo "title memtest86" >> ${icfg} |
202 |
- echo "kernel /boot/memtest86" >> ${icfg} |
203 |
- fi |
204 |
- fi |
205 |
;; |
206 |
mips) |
207 |
# NO SOFTLEVEL SUPPORT YET |
208 |
|
209 |
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh |
210 |
index 253a8887..1b0f05e1 100755 |
211 |
--- a/targets/support/create-iso.sh |
212 |
+++ b/targets/support/create-iso.sh |
213 |
@@ -242,16 +242,12 @@ case ${clst_hostarch} in |
214 |
then |
215 |
echo "Found prepared EFI boot image at \ |
216 |
${clst_target_path}/gentoo.efimg" |
217 |
- # /boot must exist and be empty for later logic |
218 |
- echo "Removing /boot contents" |
219 |
- rm -rf "${clst_target_path}"/boot |
220 |
- mkdir -p "${clst_target_path}"/boot |
221 |
else |
222 |
echo "Preparing EFI boot image" |
223 |
- if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d "${clst_target_path}/boot/EFI" ]; then |
224 |
- echo "Moving /boot/efi to /boot/EFI" |
225 |
- mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI" |
226 |
- fi |
227 |
+ if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d "${clst_target_path}/boot/EFI" ]; then |
228 |
+ echo "Moving /boot/efi to /boot/EFI" |
229 |
+ mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI" |
230 |
+ fi |
231 |
# prepare gentoo.efimg from clst_target_path /boot/EFI dir |
232 |
iaSizeTemp=$(du -sk "${clst_target_path}/boot/EFI" 2>/dev/null) |
233 |
iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) |
234 |
@@ -276,48 +272,29 @@ case ${clst_hostarch} in |
235 |
|
236 |
echo "Copying /boot/EFI to /EFI for rufus compatability" |
237 |
cp -rv "${clst_target_path}"/boot/EFI/ "${clst_target_path}" |
238 |
- |
239 |
- echo "Emptying /boot" |
240 |
- rm -rf "${clst_target_path}"/boot |
241 |
- mkdir -p "${clst_target_path}"/boot |
242 |
fi |
243 |
fi |
244 |
|
245 |
- if [ -e "${clst_target_path}/isolinux/isolinux.bin" ] |
246 |
- then |
247 |
- echo "** Found ISOLINUX bootloader" |
248 |
- if [ -d "${clst_target_path}/boot" ] |
249 |
- then |
250 |
- if [ -n "$(ls ${clst_target_path}/boot)" ] |
251 |
- # have stray files in /boot, assume ISOLINUX only |
252 |
- then |
253 |
- echo "** boot dir not empty, moving files to isolinux/ then removing it" |
254 |
- mv "${clst_target_path}"/boot/* "${clst_target_path}/isolinux" |
255 |
- rm -r "${clst_target_path}/boot" |
256 |
- echo "Creating ISO using ISOLINUX bootloader" |
257 |
- run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
258 |
- isohybrid "${1}" |
259 |
- elif [ -e "${clst_target_path}/gentoo.efimg" ] |
260 |
- # have BIOS isolinux, plus an EFI loader image |
261 |
- then |
262 |
- echo "Creating ISO using both ISOLINUX and EFI bootloader" |
263 |
- run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ |
264 |
- isohybrid --uefi "${1}" |
265 |
- fi |
266 |
- else |
267 |
- echo "Creating ISO using ISOLINUX bootloader" |
268 |
- run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
269 |
- isohybrid "${1}" |
270 |
- fi |
271 |
- elif [ -e "${clst_target_path}/boot/grub/stage2_eltorito" ] |
272 |
- then |
273 |
- echo "Creating ISO using GRUB bootloader" |
274 |
- run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
275 |
- elif [ -e "${clst_target_path}/gentoo.efimg" ] |
276 |
- then |
277 |
+ if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]; then |
278 |
+ echo '** Found ISOLINUX bootloader' |
279 |
+ if [ -e "${clst_target_path}/gentoo.efimg" ]; then |
280 |
+ # have BIOS isolinux, plus an EFI loader image |
281 |
+ echo '** Found GRUB2 EFI bootloader' |
282 |
+ echo 'Creating ISO using both ISOLINUX and EFI bootloader' |
283 |
+ run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ |
284 |
+ isohybrid --uefi "${1}" |
285 |
+ else |
286 |
+ echo 'Creating ISO using ISOLINUX bootloader' |
287 |
+ run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
288 |
+ isohybrid "${1}" |
289 |
+ fi |
290 |
+ elif [ -e "${clst_target_path}/gentoo.efimg" ]; then |
291 |
+ echo '** Found GRUB2 EFI bootloader' |
292 |
echo 'Creating ISO using EFI bootloader' |
293 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot "${clst_target_path}"/ |
294 |
else |
295 |
+ echo '** Found no known bootloader' |
296 |
+ echo 'Creating ISO with fingers crossed that you know what you are doing...' |
297 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/ |
298 |
fi |
299 |
;; |