Xeno
Ehemalige
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Auf der Suche nach aufregenden Betriebssystemen als den habe ich mir Android x86 in der neusten stabilven Version (6.0-r1, 64bit) heruntergeladen. Als Livesystem läuft es. Jedoch kann ich die Installation bisher nicht in GRUB einbinden. Dazu folgende Infos: 1) Ich habe Android ohne GRUB installiert (kann man so wählen), weil der Literatur nach der GRUB von Android überhaupt nichts ausser Android erkennt (Ich habe das aber nicht ausprobiert), deshalb wird die Installation ohne GRUB empfohlen, wenn man Android in ein Mulitbootssystem einbinden will, mit nachfolgender händischer Konfiguration von GRUB. 2) Ich habe als Leit-GRUB ehrlich gesagt seit Langem den von Manjaro und nicht von Ubuntu. Es sollte keine Rolle spielen, ich erwähne das aber. Warum ich das so habe, ist ein anderes Thema., 3) Die Forenunterstützung zu Android x86 ist lausig (wusste ich), deshalb musste ich mir die Infos von weiss woher zusammenklauben. Empfohlen wird, in der Konfigurationsdatei /etc/grub.d/40_custom einen Eintrag zu machen (dazu gleich), und dann GRUB zu updaten wie üblich. 4) Der zum Beispiel hier empfohlene Eintrag in besagter Datei lautet bei mir: | menuentry "Android-x86" {
set root='(hd1,8)'
linux /android-6.0-r1/kernel quiet
root=/dev/ram0
androidboot.hardware=android_x86
acpi_sleep=s3_bios,s3_mode SRC=/android-6.0-r1
initrd /android-6.0-r1/initrd.img}
|
5) Es gibt dann folgende Beobachtungen: Nach dem obligaten sudo update-grub fällt auf, dass Android-x86 nicht in der Konsole aufgelistet erscheint, was auf jeden Fall kein gutes Zeichen ist (die Konsole hat fast immer Recht 😈 ). Jedoch wird in GRUB tatsächlich ein Eintrag Android-x86 erstellt (menuentry als solches funktioniert also). Wird er angewählt, erscheint die Fehlermeldung (gar auf deutsch), das Laufwerk /dev/ram0 wird nicht gefunden. Nach ein paar Sekunden rauscht die Herrlichkeit in einen hübschen kernel panic ab. Danach rebootet das ganze System sogar automatisch. Hatte ich in der Abfolge noch nicht. Was würdet Ihr als Nächstes probieren? Was stimmt da wohl nicht? Da schon die Terminalausgebe nicht korrekt erfolgt, stimmt etwas Grundlegendes nicht, oder? Komisch ist auch, dass beim erstellten GRUB-Eintrag keine Partitionsbezeichnung von der Art "(auf dev/sdb8)" steht. Die Android-Partition als solche besteht, und die Verzeichnisse sind ohne Weiteres, z. B. von Ubuntu aus, lesbar. Es ist eine logische Partition, müsste es etwa am Ende eine primäre sein wie zu Grossvaters Windows-XP-Zeiten? Was nichts nützt: statt root=/dev/ram0 die (selbstverständlich vorhandene) UUID der Android-Partition anzugeben. Dann findet das System oder GRUB nämlich die nicht (die Fehlermeldung unterscheidet sich natürlich in dem Punkt). Vielleicht hat jemand eine Idee, oder jemand hat sogar mit dem ganzen Segen herumexperimentiert? Da Ubuntu wenn überhaupt nur am Rande vorkommt, poste ich die Schose mal in der Lounge. Wie immer herzlichen Dank für Beobachtungen, Feedback und Inputs. Lg X. Moderiert von Cruiz: Verschoben, da es ja im weitesten Sinne "Rund um Linux" geht.
|
Benno-007
Anmeldungsdatum: 28. August 2007
Beiträge: 29240
Wohnort: Germany
|
Ich kann mich an Systeme mit langen Bootoptionen erinnern - ob nun Haiku oder Android oder ..., müsste ich jetzt nachgucken, aber ich war wohl über Android erstaunt. Also wenn überhaupt, dann statt... Xeno schrieb:
| menuentry "Android-x86" {
set root='(hd1,8)'
linux /android-6.0-r1/kernel quiet
root=/dev/ram0
androidboot.hardware=android_x86
acpi_sleep=s3_bios,s3_mode SRC=/android-6.0-r1
initrd /android-6.0-r1/initrd.img}
|
...dann etwa so:
| menuentry "Android-x86" {
set root='(hd1,8)'
linux /android-6.0-r1/kernel quiet root=/dev/ram0 androidboot.hardware=android_x86 acpi_sleep=s3_bios,s3_mode SRC=/android-6.0-r1
initrd /android-6.0-r1/initrd.img}
|
SRC muss evtl. auch noch in eine eigene Zeile gezogen werden, wenn ich mich jetzt mal Null informiere und das nur geradebügle. 😉
|
Benno-007
Anmeldungsdatum: 28. August 2007
Beiträge: 29240
Wohnort: Germany
|
Gibt es denn jetzt andere Fehlermeldungen? hd1,8 stimmt, von 0 an gezählt?
sudo parted -l
GRUB_2/Konfiguration/#Zaehlweise-Festplatten: Muss ja aber, sonst wäre ja wohl noch weniger passiert - oder auch nicht, initramfs bekommt es ja sicherlich noch hin, liegt ja in /boot (und alles zuvor im MBR/ whatever)...
Die Zählung der Festplatten beginnt immer mit 0, die der Partitionen immer mit 1: Zu beachten ist, dass die Nummerierung von logischen Laufwerken in einer erweiterten Partition 🇩🇪 immer bei 5 beginnt - unabhängig von der Anzahl der vorhandenen primären Partitionen und als welche die erweiterte Partition angeordnet wurde. Die in der grub.cfg ausgewiesene Schreibweise (Zählung) der Partitionen kann je nach Grub-Version abweichen.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Benno-007 schrieb: Gibt es denn jetzt andere Fehlermeldungen?
Nein, exakt dieselbe: Wird Android-x86 in GRUB angewählt, erscheint die Fehlermeldung (gar auf deutsch), /dev/ram0 wird nicht gefunden. Nach ein paar Sekunden rauscht die Herrlichkeit in einen kernel panic ab. Danach rebootet das ganze System automatisch.
hd1,8 stimmt, von 0 an gezählt?
Ja, Android ist auf sdb8. Weil Irren aber menschlich ist, sehr gerne trotzdem: sudo parted -l
ergibt 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 | Modell: ATA Samsung SSD 850 (scsi)
Festplatte /dev/sda: 250GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 8390MB 8389MB primary linux-swap(v1)
3 8390MB 84.2GB 75.8GB primary ext4
4 84.2GB 250GB 166GB extended boot
5 84.2GB 110GB 26.2GB logical ext4
6 110GB 137GB 26.2GB logical ext4
7 137GB 163GB 26.2GB logical ext4
8 163GB 189GB 26.2GB logical ext4
9 189GB 250GB 61.0GB logical ext4
Modell: ATA Samsung SSD 850 (scsi)
Festplatte /dev/sdb: 512GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 52.4GB 52.4GB primary ext4 boot
2 52.4GB 105GB 52.4GB primary ext4
3 105GB 157GB 52.4GB primary ext4
4 157GB 335GB 177GB extended
5 157GB 210GB 52.4GB logical ext4
6 210GB 262GB 52.4GB logical ext4
7 262GB 315GB 52.4GB logical ext4
8 315GB 335GB 20.0GB logical ext4
Modell: ATA Samsung SSD 850 (scsi)
Festplatte /dev/sdc: 512GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 525MB 524MB primary ntfs boot
2 525MB 512GB 512GB primary ntfs
Modell: ATA Samsung SSD 850 (scsi)
Festplatte /dev/sdd: 256GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 106MB 105MB primary ntfs boot
2 106MB 256GB 256GB primary ntfs
Modell: ATA WDC WD10EARS-22Y (scsi)
Festplatte /dev/sde: 1000GB
Sektorgröße (logisch/physisch): 512B/4096B
Partitionstabelle: msdos
Disk-Flags:
Nummer Anfang Ende Größe Typ Dateisystem Flags
1 1049kB 629GB 629GB primary ntfs
|
[OT] Da ist was drauf, gell? Da lohn sich doch der Befehl mal 😈 [/OT]
GRUB_2/Konfiguration/#Zaehlweise-Festplatten: Muss ja aber, sonst wäre ja wohl noch weniger passiert - oder auch nicht, initramfs bekommt es ja sicherlich noch hin, liegt ja in /boot (und alles zuvor im MBR/ whatever)...
Die Zählung der Festplatten beginnt immer mit 0, die der Partitionen immer mit 1:
Alles richtig. Zu beachten ist, dass die Nummerierung von logischen Laufwerken in einer erweiterten Partition 🇩🇪 immer bei 5 beginnt - unabhängig von der Anzahl der vorhandenen primären Partitionen und als welche die erweiterte Partition angeordnet wurde.
Alles richtig. Die in der grub.cfg ausgewiesene Schreibweise (Zählung) der Partitionen kann je nach Grub-Version abweichen.
Woraus folgt? Herzlichen Dank so oder so! Lg X.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Noch was anderes. Der leicht andere Eintrag in der /etc/grub.d/40_custom
| menuentry "Android-x86" --class android --class gnu-linux --class gnu --class os {
set root='(hd1,msdos8)'
search --no-floppy --fs-uuid --set=root 033e8fc7-4cfe-9454-bc59-df7329ca862d
linux /android-6.0-r1/kernel
root=UUID=033e8fc7-4cfe-9454-bc59-df7329ca862d quiet
androidboot.hardware=generic_x86
SRC=/android-6.0-r1
acpi_sleep=s3_bios,s3_mode
initrd /android-6.0-r1/initrd.img}
|
liefert nach sudo update-grub die leicht abweichende Fehlermeldung /dev/UUID=033e8fc7-4cfe-9454-bc59-df7329ca862d wird nicht gefunden. Sonst wie gehabt (kernel panic, reboot). Bringt wohl nichts fundamental Neues an Erkenntnissen, aber trotzdem. Aus welchem Forum ich den Segen habe, weiss ich gerade nicht mehr. Lg X.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Benno-007 schrieb: Wenn das alles ist, fehlt da noch die cat-Struktur mit EOF: GRUB_2/Skripte/#Allgemeines-Beispiel. Ansonsten wird da nix/ Murks in der grub.cfg erzeugt.
Langsam, ganz langsam nehmen wir ihn in die Zange! Völlig richtiger Hinweis. Ich hatte es eben ohne diese Wikiseite versucht. Funktioniert hat es bzw. Folgendes noch nicht (Fehlermeldung Laufwerk /dev/sdb8 nicht gefunden, usw.): 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | #! /bin/sh -e
echo "Füge Eintrag für Android x86 ein" >&2
cat << EOF
menuentry "Android-x86" {
set root='(hd1,msdos8)'
linux /android-6.0-r1/kernel quiet
root=/dev/ram0
androidboot.hardware=android_x86
acpi_sleep=s3_bios,s3_mode
SRC=/android-6.0-r1
initrd /android-6.0-r1/initrd.img}
EOF
|
ich mache es jetzt noch einmal mit der älteren Vorlage, die auch eher jener im Wiki entspricht. Daneben gibt es einen neuen Hinweis, der vorher nicht da war: Nach sudo update-grub erscheint eine Fehlermeldung im Terminal, die praktisch sicher etwas mit diesem Problemeintrag zu tun hat. Die analysiere ich später, wenn auch der nächste Versuch fehlschlägt. Verdächtig noch: Das echo hingegen kam nicht im Terminal. Lg X.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Das Folgende brachte keine Veränderung: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | #!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
echo "Füge Eintrag für Android x86 ein" >&2
cat << EOF
menuentry "Android-x86" --class android --class gnu-linux --class gnu --class os {
set root='(hd1,msdos8)'
search --no-floppy --fs-uuid --set=root 033e8fc7-4cfe-9454-bc59-df7329ca862d
linux /android-6.0-r1/kernel
root=UUID=033e8fc7-4cfe-9454-bc59-df7329ca862d quiet
androidboot.hardware=generic_x86
SRC=/android-6.0-r1
acpi_sleep=s3_bios,s3_mode
initrd /android-6.0-r1/initrd.img}
EOF
|
Nach sudo update-grub erschien im Terminal: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 | sudo update-grub
[sudo] Passwort für ANONYM:
GRUB-Konfigurationsdatei wird erstellt …
Hintergrund gefunden: /usr/share/grub/background.png
Found Intel Microcode image
Linux-Abbild gefunden: /boot/vmlinuz-4.4-x86_64
initrd-Abbild gefunden: /boot/initramfs-4.4-x86_64.img
Found initrd fallback image: /boot/initramfs-4.4-x86_64-fallback.img
Manjaro Linux (16.08) auf /dev/sda3 gefunden
openSUSE 42.1 (x86_64) auf /dev/sda5 gefunden
Debian GNU/Linux (stretch/sid) auf /dev/sda6 gefunden
Manjaro Linux (16.06.1) auf /dev/sda7 gefunden
Kali GNU/Linux Rolling (kali-rolling) auf /dev/sda9 gefunden
Ubuntu 16.04.1 LTS (16.04) auf /dev/sdb1 gefunden
Ubuntu 16.04 LTS (16.04) auf /dev/sdb2 gefunden
Ubuntu 16.04 LTS (16.04) auf /dev/sdb3 gefunden
Windows 10 (loader) auf /dev/sdc1 gefunden
Windows 7 (loader) auf /dev/sdd1 gefunden
Found memtest86+ image: /boot/memtest86+/memtest.bin
Fehler: syntax error.
Fehler: Incorrect command.
Fehler: syntax error.
Syntaxfehler in Zeile 3959
In der erzeugten GRUB-Konfigurationsdatei wurden
Syntaxfehler entdeckt. Stellen Sie sicher, das die Dateien
/etc/default/grub und /etc/grub.d/* fehlerfrei sind oder
erstellen Sie einen Fehlerbericht mit /boot/grub/grub.cfg.new als Anhang.
|
Wie sollte ich am effizientesten mit der Fehleranalyse (siehe Terminalausgabe ab Zeile 20) fortfahren? Lg X.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Benno-007 schrieb: Ob sich die Zeilennummer auf alle zusammengehängten /etc/grub.d/* bezieht?
cat -n /etc/grub.d/*
Hm, offenbar nicht, weil es da deutlich weniger Zeilen gibt als 3959: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350 | [ANONYM ~]$ cat -n /etc/grub.d/*
1 #! /bin/sh
2 set -e
3
4 # grub-mkconfig helper script.
5 # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
6 #
7 # GRUB is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # GRUB is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
20 prefix="/usr"
21 exec_prefix="/usr"
22 datarootdir="/usr/share"
23 grub_lang=`echo $LANG | cut -d . -f 1`
24
25 export TEXTDOMAIN=grub
26 export TEXTDOMAINDIR="${datarootdir}/locale"
27
28 . "$pkgdatadir/grub-mkconfig_lib"
29
30 # Do this as early as possible, since other commands might depend on it.
31 # (e.g. the `loadfont' command might need lvm or raid modules)
32 for i in ${GRUB_PRELOAD_MODULES} ; do
33 echo "insmod $i"
34 done
35
36 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
37 if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
38 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
39 if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi
40
41 if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
42 if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
43 if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
44
45 cat << EOF
46 if [ -s \$prefix/grubenv ]; then
47 load_env
48 fi
49 EOF
50 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
51 cat <<EOF
52 if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
53 set default="${GRUB_DEFAULT_BUTTON}"
54 elif [ "\${next_entry}" ] ; then
55 set default="\${next_entry}"
56 set next_entry=
57 save_env next_entry
58 set boot_once=true
59 else
60 set default="${GRUB_DEFAULT}"
61 fi
62 EOF
63 else
64 cat <<EOF
65 if [ "\${next_entry}" ] ; then
66 set default="\${next_entry}"
67 set next_entry=
68 save_env next_entry
69 set boot_once=true
70 else
71 set default="${GRUB_DEFAULT}"
72 fi
73 EOF
74 fi
75 cat <<EOF
76
77 if [ x"\${feature_menuentry_id}" = xy ]; then
78 menuentry_id_option="--id"
79 else
80 menuentry_id_option=""
81 fi
82
83 export menuentry_id_option
84
85 if [ "\${prev_saved_entry}" ]; then
86 set saved_entry="\${prev_saved_entry}"
87 save_env saved_entry
88 set prev_saved_entry=
89 save_env prev_saved_entry
90 set boot_once=true
91 fi
92
93 function savedefault {
94 if [ -z "\${boot_once}" ]; then
95 saved_entry="\${chosen}"
96 save_env saved_entry
97 fi
98 }
99
100 function load_video {
101 EOF
102 if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
103 cat <<EOF
104 insmod ${GRUB_VIDEO_BACKEND}
105 EOF
106 else
107 # If all_video.mod isn't available load all modules available
108 # with versions prior to introduction of all_video.mod
109 cat <<EOF
110 if [ x\$feature_all_video_module = xy ]; then
111 insmod all_video
112 else
113 insmod efi_gop
114 insmod efi_uga
115 insmod ieee1275_fb
116 insmod vbe
117 insmod vga
118 insmod video_bochs
119 insmod video_cirrus
120 fi
121 EOF
122 fi
123 cat <<EOF
124 }
125
126 EOF
127
128 if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
129 cat << EOF
130 set menu_color_normal=$GRUB_COLOR_NORMAL
131 set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
132
133 EOF
134 fi
135
136 serial=0;
137 gfxterm=0;
138 for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
139 if [ xserial = "x$x" ]; then
140 serial=1;
141 fi
142 if [ xgfxterm = "x$x" ]; then
143 gfxterm=1;
144 fi
145 done
146
147 if [ "x$serial" = x1 ]; then
148 if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
149 grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"
150 GRUB_SERIAL_COMMAND=serial
151 fi
152 echo "${GRUB_SERIAL_COMMAND}"
153 fi
154
155 if [ "x$gfxterm" = x1 ]; then
156 if [ -n "$GRUB_FONT" ] ; then
157 # Make the font accessible
158 prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
159 cat << EOF
160 if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
161 EOF
162 else
163 for dir in "${pkgdatadir}" "`echo '//boot/grub' | sed "s,//*,/,g"`" /usr/share/grub ; do
164 for basename in unicode unifont ascii; do
165 path="${dir}/${basename}.pf2"
166 if is_path_readable_by_grub "${path}" > /dev/null ; then
167 font_path="${path}"
168 else
169 continue
170 fi
171 break 2
172 done
173 done
174 if [ -n "${font_path}" ] ; then
175 cat << EOF
176 if [ x\$feature_default_font_path = xy ] ; then
177 font=unicode
178 else
179 EOF
180 # Make the font accessible
181 prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
182 cat << EOF
183 font="`make_system_path_relative_to_its_root "${font_path}"`"
184 fi
185
186 if loadfont \$font ; then
187 EOF
188 else
189 cat << EOF
190 if loadfont unicode ; then
191 EOF
192 fi
193 fi
194
195 cat << EOF
196 set gfxmode=${GRUB_GFXMODE}
197 load_video
198 insmod gfxterm
199 EOF
200
201 # Gettext variables and module
202 if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "x" ]; then
203 cat << EOF
204 set locale_dir=\$prefix/locale
205 set lang=${grub_lang}
206 insmod gettext
207 EOF
208 fi
209
210 cat <<EOF
211 fi
212 EOF
213 fi
214
215 case x${GRUB_TERMINAL_INPUT} in
216 x)
217 # Just use the native terminal
218 ;;
219 x*)
220 cat << EOF
221 terminal_input ${GRUB_TERMINAL_INPUT}
222 EOF
223 ;;
224 esac
225
226 case x${GRUB_TERMINAL_OUTPUT} in
227 x)
228 # Just use the native terminal
229 ;;
230 x*)
231 cat << EOF
232 terminal_output ${GRUB_TERMINAL_OUTPUT}
233 EOF
234 ;;
235 esac
236
237 if [ "x$gfxterm" = x1 ]; then
238 if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
239 && is_path_readable_by_grub "$GRUB_THEME"; then
240 gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2
241
242 prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
243 cat << EOF
244 insmod gfxmenu
245 EOF
246 themedir="`dirname "$GRUB_THEME"`"
247 for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
248 if [ -f "$x" ]; then
249 cat << EOF
250 loadfont (\$root)`make_system_path_relative_to_its_root $x`
251 EOF
252 fi
253 done
254 if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
255 cat << EOF
256 insmod jpeg
257 EOF
258 fi
259 if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
260 cat << EOF
261 insmod png
262 EOF
263 fi
264 if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
265 cat << EOF
266 insmod tga
267 EOF
268 fi
269
270 cat << EOF
271 set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
272 export theme
273 EOF
274 elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
275 && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
276 gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
277 case "$GRUB_BACKGROUND" in
278 *.png) reader=png ;;
279 *.tga) reader=tga ;;
280 *.jpg|*.jpeg) reader=jpeg ;;
281 *) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
282 esac
283 prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
284 cat << EOF
285 insmod $reader
286 background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
287 EOF
288 fi
289 fi
290
291 make_timeout ()
292 {
293 if [ "x${3}" != "x" ] ; then
294 timeout="${2}"
295 style="${3}"
296 elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then
297 # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
298 timeout="${1}"
299 if [ "x${2}" != "x0" ] ; then
300 grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
301 fi
302 if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
303 style="hidden"
304 verbose=
305 else
306 style="countdown"
307 verbose=" --verbose"
308 fi
309 else
310 # No hidden timeout, so treat as GRUB_TIMEOUT_STYLE=menu
311 timeout="${2}"
312 style="menu"
313 fi
314 cat << EOF
315 if [ x\$feature_timeout_style = xy ] ; then
316 set timeout_style=${style}
317 set timeout=${timeout}
318 EOF
319 if [ "x${style}" = "xmenu" ] ; then
320 cat << EOF
321 # Fallback normal timeout code in case the timeout_style feature is
322 # unavailable.
323 else
324 set timeout=${timeout}
325 EOF
326 else
327 cat << EOF
328 # Fallback hidden-timeout code in case the timeout_style feature is
329 # unavailable.
330 elif sleep${verbose} --interruptible ${timeout} ; then
331 set timeout=0
332 EOF
333 fi
334 cat << EOF
335 fi
336 EOF
337 }
338
339 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
340 cat <<EOF
341 if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
342 EOF
343 make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_STYLE_BUTTON}"
344 echo else
345 make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
346 echo fi
347 else
348 make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
349 fi
350
351 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
352 cat <<EOF
353 cmosclean $GRUB_BUTTON_CMOS_ADDRESS
354 EOF
355 fi
356
357 # Play an initial tune
358 if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
359 echo "play ${GRUB_INIT_TUNE}"
360 fi
361
362 if [ "x${GRUB_BADRAM}" != "x" ] ; then
363 echo "badram ${GRUB_BADRAM}"
364 fi
365 #! /bin/sh
366 set -e
367
368 # grub-mkconfig helper script.
369 # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
370 #
371 # GRUB is free software: you can redistribute it and/or modify
372 # it under the terms of the GNU General Public License as published by
373 # the Free Software Foundation, either version 3 of the License, or
374 # (at your option) any later version.
375 #
376 # GRUB is distributed in the hope that it will be useful,
377 # but WITHOUT ANY WARRANTY; without even the implied warranty of
378 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379 # GNU General Public License for more details.
380 #
381 # You should have received a copy of the GNU General Public License
382 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
383
384 prefix="/usr"
385 exec_prefix="/usr"
386 datarootdir="/usr/share"
387
388 . "$pkgdatadir/grub-mkconfig_lib"
389
390 export TEXTDOMAIN=grub
391 export TEXTDOMAINDIR="${datarootdir}/locale"
392
393 CLASS="--class gnu-linux --class gnu --class os"
394
395 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
396 OS=Linux
397 else
398 OS="${GRUB_DISTRIBUTOR} Linux"
399 CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
400 fi
401
402 # loop-AES arranges things so that /dev/loop/X can be our root device, but
403 # the initrds that Linux uses don't like that.
404 case ${GRUB_DEVICE} in
405 /dev/loop/*|/dev/loop[0-9])
406 GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
407 ;;
408 esac
409
410 # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
411 # and mounting btrfs requires user space scanning, so force UUID in this case.
412 if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
413 || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
414 || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
415 LINUX_ROOT_DEVICE=${GRUB_DEVICE}
416 else
417 LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
418 fi
419
420 case x"$GRUB_FS" in
421 xbtrfs)
422 rootsubvol="`make_system_path_relative_to_its_root /`"
423 rootsubvol="${rootsubvol#/}"
424 if [ "x${rootsubvol}" != x ]; then
425 GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
426 fi;;
427 xzfs)
428 rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
429 bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
430 LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
431 ;;
432 esac
433
434 intel_ucode=
435 if test -e "/boot/intel-ucode.img" ; then
436 gettext_printf "Found Intel Microcode image\n" >&2
437 intel_ucode="$(make_system_path_relative_to_its_root /boot/intel-ucode.img)"
438 fi
439
440 title_correction_code=
441
442 linux_entry ()
443 {
444 os="$1"
445 version="$2"
446 type="$3"
447 args="$4"
448
449 if [ -z "$boot_device_id" ]; then
450 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
451 fi
452 if [ x$type != xsimple ] ; then
453 case $type in
454 recovery)
455 title="$(gettext_printf "%s (Kernel: %s - recovery mode)" "${os}" "${version}")" ;;
456 fallback)
457 title="$(gettext_printf "%s (Kernel: %s - fallback initramfs)" "${os}" "${version}")" ;;
458 *)
459 title="$(gettext_printf "%s (Kernel: %s)" "${os}" "${version}")" ;;
460 esac
461 if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
462 replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
463 quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
464 title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
465 grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
466 fi
467 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
468 else
469 echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
470 fi
471 if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
472 save_default_entry | grub_add_tab
473 fi
474
475 # Use ELILO's generic "efifb" when it's known to be available.
476 # FIXME: We need an interface to select vesafb in case efifb can't be used.
477 if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
478 echo " load_video" | sed "s/^/$submenu_indentation/"
479 if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
480 && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
481 echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
482 fi
483 else
484 if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
485 echo " load_video" | sed "s/^/$submenu_indentation/"
486 fi
487 echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
488 fi
489
490 echo " insmod gzio" | sed "s/^/$submenu_indentation/"
491
492 if [ x$dirname = x/ ]; then
493 if [ -z "${prepare_root_cache}" ]; then
494 prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
495 fi
496 printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/"
497 else
498 if [ -z "${prepare_boot_cache}" ]; then
499 prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
500 fi
501 printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
502 fi
503
504 message="$(gettext_printf "Loading Linux %s ..." "${version}")"
505 sed "s/^/$submenu_indentation/" << EOF
506 echo '$(echo "$message" | grub_quote)'
507 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} rw ${args}
508 EOF
509 if test -n "${initrd}" ; then
510 # TRANSLATORS: ramdisk isn't identifier. Should be translated.
511 message="$(gettext_printf "Loading initial ramdisk ...")"
512 sed "s/^/$submenu_indentation/" << EOF
513 echo '$(echo "$message" | grub_quote)'
514 initrd ${intel_ucode} ${rel_dirname}/${initrd}
515 EOF
516 fi
517 sed "s/^/$submenu_indentation/" << EOF
518 }
519 EOF
520 }
521
522 machine=`uname -m`
523 case "x$machine" in
524 xi?86 | xx86_64)
525 list=
526 for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
527 if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
528 done ;;
529 *)
530 list=
531 for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
532 if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
533 done ;;
534 esac
535
536 case "$machine" in
537 i?86) GENKERNEL_ARCH="x86" ;;
538 mips|mips64) GENKERNEL_ARCH="mips" ;;
539 mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
540 arm*) GENKERNEL_ARCH="arm" ;;
541 *) GENKERNEL_ARCH="$machine" ;;
542 esac
543
544 prepare_boot_cache=
545 prepare_root_cache=
546 boot_device_id=
547 title_correction_code=
548
549 # Extra indentation to add to menu entries in a submenu. We're not in a submenu
550 # yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
551 submenu_indentation=""
552
553 is_top_level=true
554 while [ "x$list" != "x" ] ; do
555 linux=`version_find_latest $list`
556 gettext_printf "Found linux image: %s\n" "$linux" >&2
557 basename=`basename $linux`
558 dirname=`dirname $linux`
559 rel_dirname=`make_system_path_relative_to_its_root $dirname`
560 version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
561 alt_version=`echo $version | sed -e "s,\.old$,,g"`
562 linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
563
564 if test -e "/etc/manjaro-release" ; then
565 kbasename="`echo "${basename}" | sed -e 's,vmlinuz-,linux,g'`"
566 if test -e "${dirname}/${kbasename}.kver" ; then
567 version="$(cat ${dirname}/${kbasename}.kver)"
568 fi
569 kbasename2="`echo "${basename}" | sed -e 's,vmlinuz-,linux-,g'`"
570 if test -e "${dirname}/${kbasename2}.kver" ; then
571 version="$(cat ${dirname}/${kbasename2}.kver)"
572 fi
573 kbasename3="`echo "${basename}" | sed -e 's,vmlinuz-,linux,g' | sed -e 's,\.,,g'`"
574 if test -e "${dirname}/${kbasename3}.kver" ; then
575 version="$(cat ${dirname}/${kbasename3}.kver)"
576 fi
577 kbasename4="`echo "${basename}" | sed -e 's,vmlinuz-,linux-,g' | sed -e 's,\.,,g'`"
578 if test -e "${dirname}/${kbasename4}.kver" ; then
579 version="$(cat ${dirname}/${kbasename4}.kver)"
580 fi
581 fi
582
583 initrd=
584 initramfs_manjaro="`echo "${basename}" | sed -e 's,vmlinuz,initramfs,g'`"
585 for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
586 "initrd-${version}" "initramfs-${version}.img" \
587 "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
588 "initrd-${alt_version}" "initramfs-${alt_version}.img" \
589 "initramfs-genkernel-${version}" \
590 "initramfs-genkernel-${alt_version}" \
591 "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
592 "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
593 "${initramfs_manjaro}.img" ; do
594 if test -e "${dirname}/${i}" ; then
595 initrd="$i"
596 break
597 fi
598 done
599
600 config=
601 for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
602 if test -e "${i}" ; then
603 config="${i}"
604 break
605 fi
606 done
607
608 initramfs=
609 if test -n "${config}" ; then
610 initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`
611 fi
612
613 if test -n "${initrd}" ; then
614 gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
615 elif test -z "${initramfs}" ; then
616 # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
617 # no initrd or builtin initramfs, it can't work here.
618 linux_root_device_thisversion=${GRUB_DEVICE}
619 fi
620
621 if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
622 linux_entry "${OS}" "${version}" simple \
623 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
624
625 submenu_indentation="$grub_tab"
626
627 if [ -z "$boot_device_id" ]; then
628 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
629 fi
630 # TRANSLATORS: %s is replaced with an OS name
631 echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
632 is_top_level=false
633 fi
634
635 linux_entry "${OS}" "${version}" advanced \
636 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
637
638 for i in "${initramfs_manjaro}-fallback.img" "initramfs-${version}-fallback.img" ; do
639 if test -e "${dirname}/${i}" ; then
640 initrd="${i}"
641 gettext_printf "Found initrd fallback image: %s\n" "${dirname}/${initrd}" >&2
642 linux_entry "${OS}" "${version}" fallback \
643 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
644 break
645 fi
646 done
647
648 if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
649 linux_entry "${OS}" "${version}" recovery \
650 "single ${GRUB_CMDLINE_LINUX}"
651 fi
652
653 list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
654 done
655
656 # If at least one kernel was found, then we need to
657 # add a closing '}' for the submenu command.
658 if [ x"$is_top_level" != xtrue ]; then
659 echo '}'
660 fi
661
662 echo "$title_correction_code"
663 #! /bin/sh
664 set -e
665
666 # grub-mkconfig helper script.
667 # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
668 #
669 # GRUB is free software: you can redistribute it and/or modify
670 # it under the terms of the GNU General Public License as published by
671 # the Free Software Foundation, either version 3 of the License, or
672 # (at your option) any later version.
673 #
674 # GRUB is distributed in the hope that it will be useful,
675 # but WITHOUT ANY WARRANTY; without even the implied warranty of
676 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
677 # GNU General Public License for more details.
678 #
679 # You should have received a copy of the GNU General Public License
680 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
681
682 prefix="/usr"
683 exec_prefix="/usr"
684 datarootdir="/usr/share"
685
686 . "$pkgdatadir/grub-mkconfig_lib"
687
688 export TEXTDOMAIN=grub
689 export TEXTDOMAINDIR="${datarootdir}/locale"
690
691 CLASS="--class gnu-linux --class gnu --class os --class xen"
692
693 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
694 OS=GNU/Linux
695 else
696 OS="${GRUB_DISTRIBUTOR} GNU/Linux"
697 CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
698 fi
699
700 # loop-AES arranges things so that /dev/loop/X can be our root device, but
701 # the initrds that Linux uses don't like that.
702 case ${GRUB_DEVICE} in
703 /dev/loop/*|/dev/loop[0-9])
704 GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
705 ;;
706 esac
707
708 # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
709 # and mounting btrfs requires user space scanning, so force UUID in this case.
710 if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
711 || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
712 || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
713 LINUX_ROOT_DEVICE=${GRUB_DEVICE}
714 else
715 LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
716 fi
717
718 # Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
719 if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
720 GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
721 fi
722 if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
723 GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
724 fi
725
726 case x"$GRUB_FS" in
727 xbtrfs)
728 rootsubvol="`make_system_path_relative_to_its_root /`"
729 rootsubvol="${rootsubvol#/}"
730 if [ "x${rootsubvol}" != x ]; then
731 GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
732 fi;;
733 xzfs)
734 rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
735 bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
736 LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
737 ;;
738 esac
739
740 title_correction_code=
741
742 linux_entry ()
743 {
744 os="$1"
745 version="$2"
746 xen_version="$3"
747 type="$4"
748 args="$5"
749 xen_args="$6"
750 if [ -z "$boot_device_id" ]; then
751 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
752 fi
753 if [ x$type != xsimple ] ; then
754 if [ x$type = xrecovery ] ; then
755 title="$(gettext_printf "%s, with Xen %s and Linux %s (recovery mode)" "${os}" "${xen_version}" "${version}")"
756 else
757 title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
758 fi
759 replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
760 if [ x"Xen ${xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
761 quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
762 title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
763 grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
764 fi
765 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
766 else
767 title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"
768 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
769 fi
770 if [ x$type != xrecovery ] ; then
771 save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
772 fi
773
774 if [ -z "${prepare_boot_cache}" ]; then
775 prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
776 fi
777 printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
778 xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
779 lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
780 sed "s/^/$submenu_indentation/" << EOF
781 echo '$(echo "$xmessage" | grub_quote)'
782 if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then
783 xen_rm_opts=
784 else
785 xen_rm_opts="no-real-mode edd=off"
786 fi
787 multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
788 echo '$(echo "$lmessage" | grub_quote)'
789 module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
790 EOF
791 if test -n "${initrd}" ; then
792 # TRANSLATORS: ramdisk isn't identifier. Should be translated.
793 message="$(gettext_printf "Loading initial ramdisk ...")"
794 sed "s/^/$submenu_indentation/" << EOF
795 echo '$(echo "$message" | grub_quote)'
796 module --nounzip ${rel_dirname}/${initrd}
797 EOF
798 fi
799 sed "s/^/$submenu_indentation/" << EOF
800 }
801 EOF
802 }
803
804 linux_list=
805 for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
806 if grub_file_is_not_garbage "$i"; then
807 basename=$(basename $i)
808 version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
809 dirname=$(dirname $i)
810 config=
811 for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
812 if test -e "${j}" ; then
813 config="${j}"
814 break
815 fi
816 done
817 if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi
818 fi
819 done
820 if [ "x${linux_list}" = "x" ] ; then
821 exit 0
822 fi
823
824 file_is_not_sym () {
825 case "$1" in
826 */xen-syms-*)
827 return 1;;
828 *)
829 return 0;;
830 esac
831 }
832
833 xen_list=
834 for i in /boot/xen*; do
835 if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi
836 done
837 prepare_boot_cache=
838 boot_device_id=
839
840 title_correction_code=
841
842 machine=`uname -m`
843
844 case "$machine" in
845 i?86) GENKERNEL_ARCH="x86" ;;
846 mips|mips64) GENKERNEL_ARCH="mips" ;;
847 mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
848 arm*) GENKERNEL_ARCH="arm" ;;
849 *) GENKERNEL_ARCH="$machine" ;;
850 esac
851
852 # Extra indentation to add to menu entries in a submenu. We're not in a submenu
853 # yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
854 submenu_indentation=""
855
856 is_top_level=true
857
858 while [ "x${xen_list}" != "x" ] ; do
859 list="${linux_list}"
860 current_xen=`version_find_latest $xen_list`
861 xen_basename=`basename ${current_xen}`
862 xen_dirname=`dirname ${current_xen}`
863 rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
864 xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
865 if [ -z "$boot_device_id" ]; then
866 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
867 fi
868 if [ "x$is_top_level" != xtrue ]; then
869 echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
870 fi
871 while [ "x$list" != "x" ] ; do
872 linux=`version_find_latest $list`
873 gettext_printf "Found linux image: %s\n" "$linux" >&2
874 basename=`basename $linux`
875 dirname=`dirname $linux`
876 rel_dirname=`make_system_path_relative_to_its_root $dirname`
877 version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
878 alt_version=`echo $version | sed -e "s,\.old$,,g"`
879 linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
880
881 initrd=
882 for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
883 "initrd-${version}" "initramfs-${version}.img" \
884 "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
885 "initrd-${alt_version}" "initramfs-${alt_version}.img" \
886 "initramfs-genkernel-${version}" \
887 "initramfs-genkernel-${alt_version}" \
888 "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
889 "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" ; do
890 if test -e "${dirname}/${i}" ; then
891 initrd="$i"
892 break
893 fi
894 done
895 if test -n "${initrd}" ; then
896 gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
897 else
898 # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
899 linux_root_device_thisversion=${GRUB_DEVICE}
900 fi
901
902 if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
903 linux_entry "${OS}" "${version}" "${xen_version}" simple \
904 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
905
906 submenu_indentation="$grub_tab$grub_tab"
907
908 if [ -z "$boot_device_id" ]; then
909 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
910 fi
911 # TRANSLATORS: %s is replaced with an OS name
912 echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
913 echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
914 is_top_level=false
915 fi
916
917 linux_entry "${OS}" "${version}" "${xen_version}" advanced \
918 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
919 if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
920 linux_entry "${OS}" "${version}" "${xen_version}" recovery \
921 "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
922 fi
923
924 list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
925 done
926 if [ x"$is_top_level" != xtrue ]; then
927 echo ' }'
928 fi
929 xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '`
930 done
931
932 # If at least one kernel was found, then we need to
933 # add a closing '}' for the submenu command.
934 if [ x"$is_top_level" != xtrue ]; then
935 echo '}'
936 fi
937
938 echo "$title_correction_code"
939 #! /bin/sh
940 set -e
941
942 # grub-mkconfig helper script.
943 # Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
944 #
945 # GRUB is free software: you can redistribute it and/or modify
946 # it under the terms of the GNU General Public License as published by
947 # the Free Software Foundation, either version 3 of the License, or
948 # (at your option) any later version.
949 #
950 # GRUB is distributed in the hope that it will be useful,
951 # but WITHOUT ANY WARRANTY; without even the implied warranty of
952 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
953 # GNU General Public License for more details.
954 #
955 # You should have received a copy of the GNU General Public License
956 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
957
958 prefix="/usr"
959 exec_prefix="/usr"
960 datarootdir="/usr/share"
961
962 export TEXTDOMAIN=grub
963 export TEXTDOMAINDIR="${datarootdir}/locale"
964
965 . "$pkgdatadir/grub-mkconfig_lib"
966
967 if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
968 exit 0
969 fi
970
971 if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
972 # missing os-prober and/or linux-boot-prober
973 exit 0
974 fi
975
976 OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
977 if [ -z "${OSPROBED}" ] ; then
978 # empty os-prober output, nothing doing
979 exit 0
980 fi
981
982 osx_entry() {
983 if [ x$2 = x32 ]; then
984 # TRANSLATORS: it refers to kernel architecture (32-bit)
985 bitstr="$(gettext "(32-bit)")"
986 else
987 # TRANSLATORS: it refers to kernel architecture (64-bit)
988 bitstr="$(gettext "(64-bit)")"
989 fi
990 # TRANSLATORS: it refers on the OS residing on device %s
991 onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
992 cat << EOF
993 menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
994 EOF
995 save_default_entry | grub_add_tab
996 prepare_grub_to_access_device ${DEVICE} | grub_add_tab
997 cat << EOF
998 load_video
999 set do_resume=0
1000 if [ /var/vm/sleepimage -nt10 / ]; then
1001 if xnu_resume /var/vm/sleepimage; then
1002 set do_resume=1
1003 fi
1004 fi
1005 if [ \$do_resume = 0 ]; then
1006 xnu_uuid ${OSXUUID} uuid
1007 if [ -f /Extra/DSDT.aml ]; then
1008 acpi -e /Extra/DSDT.aml
1009 fi
1010 if [ /kernelcache -nt /System/Library/Extensions ]; then
1011 $1 /kernelcache boot-uuid=\${uuid} rd=*uuid
1012 elif [ -f /System/Library/Kernels/kernel ]; then
1013 $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid
1014 xnu_kextdir /System/Library/Extensions
1015 else
1016 $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
1017 if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
1018 xnu_mkext /System/Library/Extensions.mkext
1019 else
1020 xnu_kextdir /System/Library/Extensions
1021 fi
1022 fi
1023 if [ -f /Extra/Extensions.mkext ]; then
1024 xnu_mkext /Extra/Extensions.mkext
1025 fi
1026 if [ -d /Extra/Extensions ]; then
1027 xnu_kextdir /Extra/Extensions
1028 fi
1029 if [ -f /Extra/devprop.bin ]; then
1030 xnu_devprop_load /Extra/devprop.bin
1031 fi
1032 if [ -f /Extra/splash.jpg ]; then
1033 insmod jpeg
1034 xnu_splash /Extra/splash.jpg
1035 fi
1036 if [ -f /Extra/splash.png ]; then
1037 insmod png
1038 xnu_splash /Extra/splash.png
1039 fi
1040 if [ -f /Extra/splash.tga ]; then
1041 insmod tga
1042 xnu_splash /Extra/splash.tga
1043 fi
1044 fi
1045 }
1046 EOF
1047 }
1048
1049 used_osprober_linux_ids=
1050
1051 for OS in ${OSPROBED} ; do
1052 DEVICE="`echo ${OS} | cut -d ':' -f 1`"
1053 LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
1054 LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
1055 BOOT="`echo ${OS} | cut -d ':' -f 4`"
1056 if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
1057 EXPUUID="$UUID"
1058
1059 if [ x"${DEVICE#*@}" != x ] ; then
1060 EXPUUID="${EXPUUID}@${DEVICE#*@}"
1061 fi
1062
1063 if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
1064 echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
1065 continue
1066 fi
1067 fi
1068
1069 BTRFS="`echo ${OS} | cut -d ':' -f 5`"
1070 if [ "x$BTRFS" = "xbtrfs" ]; then
1071 BTRFSuuid="`echo ${OS} | cut -d ':' -f 6`"
1072 BTRFSsubvol="`echo ${OS} | cut -d ':' -f 7`"
1073 fi
1074
1075 if [ -z "${LONGNAME}" ] ; then
1076 LONGNAME="${LABEL}"
1077 fi
1078
1079 # os-prober returns text string followed by optional counter
1080 CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')"
1081
1082 gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
1083
1084 case ${BOOT} in
1085 chain)
1086
1087 onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
1088 cat << EOF
1089 menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
1090 EOF
1091 save_default_entry | grub_add_tab
1092 prepare_grub_to_access_device ${DEVICE} | grub_add_tab
1093
1094 if [ x"`${grub_probe} --device ${DEVICE} --target=partmap`" = xmsdos ]; then
1095 cat << EOF
1096 parttool \${root} hidden-
1097 EOF
1098 fi
1099
1100 case ${LONGNAME} in
1101 Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
1102 ;;
1103 *)
1104 cat << EOF
1105 drivemap -s (hd0) \${root}
1106 EOF
1107 ;;
1108 esac
1109
1110 cat <<EOF
1111 chainloader +1
1112 }
1113 EOF
1114 ;;
1115 efi)
1116
1117 EFIPATH=${DEVICE#*@}
1118 DEVICE=${DEVICE%@*}
1119 onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
1120 cat << EOF
1121 menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
1122 EOF
1123 save_default_entry | sed -e "s/^/\t/"
1124 prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
1125
1126 cat <<EOF
1127 chainloader ${EFIPATH}
1128 }
1129 EOF
1130 ;;
1131 linux)
1132 if [ "x$BTRFS" = "xbtrfs" ]; then
1133 LINUXPROBED="`linux-boot-prober btrfs ${BTRFSuuid} ${BTRFSsubvol} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
1134 else
1135 LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
1136 fi
1137 prepare_boot_cache=
1138 boot_device_id=
1139 is_top_level=true
1140 title_correction_code=
1141 OS="${LONGNAME}"
1142
1143 for LINUX in ${LINUXPROBED} ; do
1144 LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
1145 LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
1146 LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
1147 LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
1148 LINITRD="`echo ${LINUX} | cut -d ':' -f 5 | tr '^' ' '`"
1149 LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
1150
1151 if [ -z "${LLABEL}" ] ; then
1152 LLABEL="${LONGNAME}"
1153 fi
1154
1155 if [ "${LROOT}" != "${LBOOT}" ]; then
1156 LKERNEL="${LKERNEL#/boot}"
1157 LINITRD="${LINITRD#/boot}"
1158 fi
1159
1160 onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
1161 recovery_params="$(echo "${LPARAMS}" | grep single)" || true
1162 counter=1
1163 while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
1164 counter=$((counter+1));
1165 done
1166 if [ -z "$boot_device_id" ]; then
1167 boot_device_id="$(grub_get_device_id "${DEVICE}")"
1168 fi
1169 used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
1170
1171 if [ -z "${prepare_boot_cache}" ]; then
1172 prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
1173 fi
1174
1175 if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
1176 cat << EOF
1177 menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
1178 EOF
1179 save_default_entry | grub_add_tab
1180 printf '%s\n' "${prepare_boot_cache}"
1181 cat << EOF
1182 linux ${LKERNEL} ${LPARAMS}
1183 EOF
1184 if [ -n "${LINITRD}" ] ; then
1185 cat << EOF
1186 initrd ${LINITRD}
1187 EOF
1188 fi
1189 cat << EOF
1190 }
1191 EOF
1192 echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
1193 is_top_level=false
1194 fi
1195 title="${LLABEL} $onstr"
1196 cat << EOF
1197 menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
1198 EOF
1199 save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
1200 printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
1201 cat << EOF
1202 linux ${LKERNEL} ${LPARAMS}
1203 EOF
1204 if [ -n "${LINITRD}" ] ; then
1205 cat << EOF
1206 initrd ${LINITRD}
1207 EOF
1208 fi
1209 cat << EOF
1210 }
1211 EOF
1212 if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
1213 replacement_title="$(echo "Advanced options for ${OS} $onstr" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
1214 quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
1215 title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
1216 grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
1217 fi
1218 done
1219 if [ x"$is_top_level" != xtrue ]; then
1220 echo '}'
1221 fi
1222 echo "$title_correction_code"
1223 ;;
1224 macosx)
1225 if [ "${UUID}" ]; then
1226 OSXUUID="${UUID}"
1227 osx_entry xnu_kernel 32
1228 osx_entry xnu_kernel64 64
1229 fi
1230 ;;
1231 hurd)
1232 onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
1233 cat << EOF
1234 menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
1235 EOF
1236 save_default_entry | grub_add_tab
1237 prepare_grub_to_access_device ${DEVICE} | grub_add_tab
1238 grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
1239 mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
1240 grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
1241 case "${grub_fs}" in
1242 *fs) hurd_fs="${grub_fs}" ;;
1243 *) hurd_fs="${grub_fs}fs" ;;
1244 esac
1245 cat << EOF
1246 multiboot /boot/gnumach.gz root=device:${mach_device}
1247 module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
1248 --multiboot-command-line='\${kernel-command-line}' \\
1249 --host-priv-port='\${host-port}' \\
1250 --device-master-port='\${device-port}' \\
1251 --exec-server-task='\${exec-task}' -T typed '\${root}' \\
1252 '\$(task-create)' '\$(task-resume)'
1253 module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
1254 }
1255 EOF
1256 ;;
1257 minix)
1258 cat << EOF
1259 menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" {
1260 EOF
1261 save_default_entry | sed -e "s/^/\t/"
1262 prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
1263 cat << EOF
1264 multiboot /boot/image_latest
1265 }
1266 EOF
1267 ;;
1268 *)
1269 # TRANSLATORS: %s is replaced by OS name.
1270 gettext_printf "%s is not yet supported by grub-mkconfig.\n" " ${LONGNAME}" >&2
1271 ;;
1272 esac
1273 done
1274 #!/bin/sh
1275 exec tail -n +3 $0
1276 # This file provides an easy way to add custom menu entries. Simply type the
1277 # menu entries you want to add after this comment. Be careful not to change
1278 # the 'exec tail' line above.
1279
1280 echo "Füge Eintrag für Android x86 ein" >&2
1281
1282 cat << EOF
1283
1284 menuentry "Android-x86" --class android --class gnu-linux --class gnu --class os {
1285 set root='(hd1,msdos8)'
1286 search --no-floppy --fs-uuid --set=root 033e8fc7-4cfe-9454-bc59-df7329ca862d
1287 linux /android-6.0-r1/kernel
1288 root=UUID=033e8fc7-4cfe-9454-bc59-df7329ca862d quiet
1289 androidboot.hardware=generic_x86
1290 SRC=/android-6.0-r1
1291 acpi_sleep=s3_bios,s3_mode
1292 initrd /android-6.0-r1/initrd.img}
1293
1294 EOF
1295
1296
1297 #!/bin/sh
1298 cat <<EOF
1299 if [ -f \${config_directory}/custom.cfg ]; then
1300 source \${config_directory}/custom.cfg
1301 elif [ -z "\${config_directory}" -a -f \$prefix/custom.cfg ]; then
1302 source \$prefix/custom.cfg;
1303 fi
1304 EOF
1305
1306 #!/usr/bin/env bash
1307 ########################################################
1308 # This script generates a memtest86+ entry on grub.cfg #
1309 # if memtest is installed on the system. #
1310 ########################################################
1311
1312 prefix="/usr"
1313 exec_prefix="${prefix}"
1314
1315 datarootdir="/usr/share"
1316 datadir="${datarootdir}"
1317
1318 . "${datadir}/grub/grub-mkconfig_lib"
1319
1320 MEMTEST86_IMAGE="/boot/memtest86+/memtest.bin"
1321 CLASS="--class memtest86 --class gnu --class tool"
1322
1323 if [ -e "${MEMTEST86_IMAGE}" ] && is_path_readable_by_grub "${MEMTEST86_IMAGE}" ; then
1324 ## image exists, create menu entry
1325 echo "Found memtest86+ image: ${MEMTEST86_IMAGE}" >&2
1326 _GRUB_MEMTEST_HINTS_STRING="$(${grub_probe} --target=hints_string ${MEMTEST86_IMAGE})"
1327 _GRUB_MEMTEST_FS_UUID="$(${grub_probe} --target=fs_uuid ${MEMTEST86_IMAGE})"
1328 _GRUB_MEMTEST_REL_PATH="$(make_system_path_relative_to_its_root ${MEMTEST86_IMAGE})"
1329 cat << EOF
1330 if [ "\${grub_platform}" == "pc" ]; then
1331 menuentry "Memory Tester (memtest86+)" ${CLASS} {
1332 search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
1333 linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
1334 }
1335 fi
1336 EOF
1337 fi
1338
1339 All executable files in this directory are processed in shell expansion order.
1340
1341 00_*: Reserved for 00_header.
1342 10_*: Native boot entries.
1343 20_*: Third party apps (e.g. memtest86+).
1344
1345 The number namespace in-between is configurable by system installer and/or
1346 administrator. For example, you can add an entry to boot another OS as
1347 01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
1348 the menu; and then adjust the default setting via /etc/default/grub.
[ANONYM ~]$
|
Mit viel GRUB-Erfahrung gäbe es aber vermutlich jetzt irgendwo einen Hebel zum Eingreifen. Mich freut Dein Interesse an der Sache. ☺ Lg X.
|
Xeno
Ehemalige
(Themenstarter)
Anmeldungsdatum: 6. April 2005
Beiträge: 2572
Wohnort: Schweiz
|
Benno-007 schrieb: Naja, so viel helfen konnte ich ja jetzt auch nicht - nur Denkanstöße geben. Vielleicht versucht es mal noch jemand - das ist so ein never ending Thema ohne Anfang und Ende. 😉
Schon gut! Das war ja selbstredend keine bestimmte eine Erwartung, wie ja schon der Ort des Threads nahelegt. Dürfte ja wohl klar sein. Es interessiert mich nur, warum das jetzt nicht will. GRUB ist halt u. U. sehr komplex, und mit einem "kuriosen" Linux dürfte eben schon eine Komplexitätsgrenze erreicht sein. An sich ist es ja schon bemerkenswert, dass der Android-GRUB angeblich nichts erkennen kann ausser Android. Dabei wäre das OS z. B. punkto Kernel aktuell (4.4er). Wie dem auch sei. Weitere Ideen jederzeit willkommen! Lg X.
|