summaryrefslogtreecommitdiff
path: root/sys-boot/grub/files/grub-0.97-uuid.patch
blob: f99670a801cf44d005a1f6642a4bb1cfc1606075 (plain)
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
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
=== modified file 'Makefile.am'
--- grub-0.97.orig/Makefile.am	2004-04-23 13:39:01 +0000
+++ grub-0.97/Makefile.am	2008-07-09 17:23:44 +0000
@@ -1,4 +1,9 @@
 # Do not change this order if you don't know what you are doing.
 AUTOMAKE_OPTIONS = 1.7 gnu
-SUBDIRS = netboot stage2 stage1 lib grub util docs
+if UUID_SUPPORT
+SUBDIRS = libvolume_id netboot stage2 stage1 lib grub util docs 
+else
+SUBDIRS = netboot stage2 stage1 lib grub util docs 
+endif
+
 EXTRA_DIST = BUGS MAINTENANCE

=== modified file 'configure.ac'
--- grub-0.97.orig/configure.ac	2008-01-28 18:41:45 +0000
+++ grub-0.97/configure.ac	2008-07-09 17:23:44 +0000
@@ -605,6 +606,11 @@
   [  --disable-serial        disable serial terminal support])
 AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno)
 
+dnl UUID scanning
+AC_ARG_ENABLE(uuid,
+  [  --disable-uuid          disable uuid scanning support])
+AM_CONDITIONAL(UUID_SUPPORT, test "x$enable_uuid" != xno)
+
 dnl Simulation of the slowness of a serial device.
 AC_ARG_ENABLE(serial-speed-simulation,
   [  --enable-serial-speed-simulation
@@ -666,5 +672,6 @@
 		 docs/Makefile lib/Makefile util/Makefile \
 		 grub/Makefile netboot/Makefile util/grub-image \
 		 util/grub-install util/grub-md5-crypt \
-		 util/grub-terminfo util/grub-set-default])
+		 util/grub-terminfo util/grub-set-default \
+		 libvolume_id/Makefile])
 AC_OUTPUT

=== modified file 'grub/Makefile.am'
--- grub-0.97.orig/grub/Makefile.am	2005-02-02 20:40:05 +0000
+++ grub-0.97/grub/Makefile.am	2008-07-09 17:23:44 +0000
@@ -16,4 +16,9 @@
 AM_CFLAGS = $(GRUB_CFLAGS)
 
 grub_SOURCES = main.c asmstub.c
-grub_LDADD = ../stage2/libgrub.a  ../lib/libcommon.a $(GRUB_LIBS)
+
+if UUID_SUPPORT
+grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a ../libvolume_id/libvolume_id.a $(GRUB_LIBS)
+else
+grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)
+endif

=== added directory 'libvolume_id'
=== added file 'libvolume_id/Makefile.am'
--- grub-0.97.orig/libvolume_id/Makefile.am	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/Makefile.am	2008-07-15 12:31:43 +0000
@@ -0,0 +1,27 @@
+noinst_LIBRARIES = libvolume_id.a
+
+AM_CFLAGS = $(STAGE2_CFLAGS) -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
+
+LIBVOLUME_ID_FS_SUPPORTED = 	ext.c fat.c hfs.c jfs.c  \
+			 	luks.c ntfs.c ocfs.c reiserfs.c \
+			 	xfs.c 
+
+LIBVOLUME_ID_FS_UNSUPPORTED = 	cramfs.c gfs.c hpfs.c iso9660.c \
+			 	lvm.c minix.c romfs.c squashfs.c \
+				sysv.c udf.c ufs.c vxfs.c
+
+LIBVOLUME_ID_RAID_SUPPORTED = 	ddf_raid.c 
+
+LIBVOLUME_ID_RAID_UNSUPPORTED = adaptec_raid.c highpoint.c isw_raid.c \
+				jmicron_raid.c linux_raid.c lsi_raid.c \
+				nvidia_raid.c promise_raid.c silicon_raid.c \
+				via_raid.c 
+
+LIBVOLUME_ID_MISC_UNSUPPORTED = linux_swap.c netware.c
+
+libvolume_id_a_SOURCES = 	$(LIBVOLUME_ID_FS_SUPPORTED) \
+   			 	$(LIBVOLUME_ID_RAID_SUPPORTED) \
+				$(LIBVOLUME_ID_FS_UNSUPPORTED) \
+				$(LIBVOLUME_ID_RAID_UNSUPPORTED) \
+			 	volume_id.h volume_id.c util.c util.h misc.c 
+

=== added file 'libvolume_id/adaptec_raid.c'
--- grub-0.97.orig/libvolume_id/adaptec_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/adaptec_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,107 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct adaptec_meta {
+	uint32_t	b0idcode;
+	uint8_t		lunsave[8];
+	uint16_t	sdtype;
+	uint16_t	ssavecyl;
+	uint8_t		ssavehed;
+	uint8_t		ssavesec;
+	uint8_t		sb0flags;
+	uint8_t		jbodEnable;
+	uint8_t		lundsave;
+	uint8_t		svpdirty;
+	uint16_t	biosInfo;
+	uint16_t	svwbskip;
+	uint16_t	svwbcln;
+	uint16_t	svwbmax;
+	uint16_t	res3;
+	uint16_t	svwbmin;
+	uint16_t	res4;
+	uint16_t	svrcacth;
+	uint16_t	svwcacth;
+	uint16_t	svwbdly;
+	uint8_t		svsdtime;
+	uint8_t		res5;
+	uint16_t	firmval;
+	uint16_t	firmbln;
+	uint32_t	firmblk;
+	uint32_t	fstrsvrb;
+	uint16_t	svBlockStorageTid;
+	uint16_t	svtid;
+	uint8_t		svseccfl;
+	uint8_t		res6;
+	uint8_t		svhbanum;
+	uint8_t		resver;
+	uint32_t	drivemagic;
+	uint8_t		reserved[20];
+	uint8_t		testnum;
+	uint8_t		testflags;
+	uint16_t	maxErrorCount;
+	uint32_t	count;
+	uint32_t	startTime;
+	uint32_t	interval;
+	uint8_t		tstxt0;
+	uint8_t		tstxt1;
+	uint8_t		serNum[32];
+	uint8_t		res8[102];
+	uint32_t	fwTestMagic;
+	uint32_t	fwTestSeqNum;
+	uint8_t		fwTestRes[8];
+	uint8_t		smagic[4];
+	uint32_t	raidtbl;
+	uint16_t	raidline;
+	uint8_t		res9[0xF6];
+} PACKED;
+
+int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct adaptec_meta *ad;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-1) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	ad = (struct adaptec_meta *) buf;
+	if (memcmp((char*)ad->smagic, "DPTM", 4) != 0)
+		return -1;
+
+	if (ad->b0idcode != be32_to_cpu(0x37FC4D1E))
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	sprintf(id->type_version, "%u", ad->resver);
+	id->type = "adaptec_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/cramfs.c'
--- grub-0.97.orig/libvolume_id/cramfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/cramfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,60 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct cramfs_super {
+	uint8_t		magic[4];
+	uint32_t	size;
+	uint32_t	flags;
+	uint32_t	future;
+	uint8_t		signature[16];
+	struct cramfs_info {
+		uint32_t	crc;
+		uint32_t	edition;
+		uint32_t	blocks;
+		uint32_t	files;
+	} PACKED info;
+	uint8_t		name[16];
+} PACKED;
+
+int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct cramfs_super *cs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200);
+	if (cs == NULL)
+		return -1;
+
+	if (memcmp((char*)cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp((char*)cs->magic, "\x28\xcd\x3d\x45", 4) == 0) {
+		volume_id_set_label_raw(id, cs->name, 16);
+		volume_id_set_label_string(id, cs->name, 16);
+
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		id->type = "cramfs";
+		return 0;
+	}
+
+	return -1;
+}

=== added file 'libvolume_id/ddf_raid.c'
--- grub-0.97.orig/libvolume_id/ddf_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/ddf_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,60 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2007 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+/* http://www.snia.org/standards/home */
+
+#define DDF_HEADER			0xDE11DE11
+#define DDF_GUID_LENGTH			24
+#define DDF_REV_LENGTH			8
+
+static struct ddf_header {
+	uint32_t	signature;
+	uint32_t	crc;
+	uint8_t		guid[DDF_GUID_LENGTH];
+	uint8_t		ddf_rev[DDF_REV_LENGTH];
+} PACKED *ddf;
+
+int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint64_t ddf_off = ((size / 0x200)-1) * 0x200;
+	const uint8_t *buf;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+	if (size < 0x10000)
+		return -1;
+
+	buf = volume_id_get_buffer(id, off + ddf_off, 0x200);
+	if (buf == NULL)
+		return -1;
+	ddf = (struct ddf_header *) buf;
+
+	if (ddf->signature != cpu_to_be32(DDF_HEADER))
+		return -1;
+
+	volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING);
+	strcpy(id->type_version, (char*) ddf->ddf_rev);
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "ddf_raid_member";
+	return 0;
+}

=== added file 'libvolume_id/ext.c'
--- grub-0.97.orig/libvolume_id/ext.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/ext.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,129 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct ext2_super_block {
+	uint32_t	s_inodes_count;
+	uint32_t	s_blocks_count;
+	uint32_t	s_r_blocks_count;
+	uint32_t	s_free_blocks_count;
+	uint32_t	s_free_inodes_count;
+	uint32_t	s_first_data_block;
+	uint32_t	s_log_block_size;
+	uint32_t	s_log_frag_size;
+	uint32_t	s_blocks_per_group;
+	uint32_t	s_frags_per_group;
+	uint32_t	s_inodes_per_group;
+	uint32_t	s_mtime;
+	uint32_t	s_wtime;
+	uint16_t	s_mnt_count;
+	uint16_t	s_max_mnt_count;
+	uint16_t	s_magic;
+	uint16_t	s_state;
+	uint16_t	s_errors;
+	uint16_t	s_minor_rev_level;
+	uint32_t	s_lastcheck;
+	uint32_t	s_checkinterval;
+	uint32_t	s_creator_os;
+	uint32_t	s_rev_level;
+	uint16_t	s_def_resuid;
+	uint16_t	s_def_resgid;
+	uint32_t	s_first_ino;
+	uint16_t	s_inode_size;
+	uint16_t	s_block_group_nr;
+	uint32_t	s_feature_compat;
+	uint32_t	s_feature_incompat;
+	uint32_t	s_feature_ro_compat;
+	uint8_t		s_uuid[16];
+	uint8_t		s_volume_name[16];
+} PACKED;
+
+#define EXT_SUPER_MAGIC				0xEF53
+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008
+#define EXT3_FEATURE_INCOMPAT_EXTENTS		0x0040
+#define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
+#define EXT4_FEATURE_INCOMPAT_MMP		0x0100
+
+#define EXT_SUPERBLOCK_OFFSET			0x400
+
+#define EXT3_MIN_BLOCK_SIZE			0x400
+#define EXT3_MAX_BLOCK_SIZE			0x1000
+
+int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct ext2_super_block *es;
+	size_t bsize;
+	uint32_t feature_compat;
+	uint32_t feature_incompat;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200);
+	if (es == NULL)
+		return -1;
+
+	if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC))
+		return -1;
+
+	bsize = 0x400 << le32_to_cpu(es->s_log_block_size);
+	dbg("ext blocksize 0x%zx", bsize);
+	if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) {
+		dbg("invalid ext blocksize");
+		return -1;
+	}
+
+	volume_id_set_label_raw(id, es->s_volume_name, 16);
+	volume_id_set_label_string(id, es->s_volume_name, 16);
+	volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE);
+	sprintf(id->type_version, "%u.%u",
+		 le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level));
+
+	feature_compat = le32_to_cpu(es->s_feature_compat);
+	feature_incompat = le32_to_cpu(es->s_feature_incompat);
+
+	/* check for external journal device */
+	if ((feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) {
+		volume_id_set_usage(id, VOLUME_ID_OTHER);
+		id->type = "jbd";
+		goto out;
+	}
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+
+	if ((feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) != 0 ||
+	    (feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0 ||
+	    (feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) != 0) {
+		id->type = "ext4";
+		goto out;
+	}
+
+	if ((feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) {
+		id->type = "ext3";
+		goto out;
+	}
+
+	id->type = "ext2";
+
+out:
+	return 0;
+}

=== added file 'libvolume_id/fat.c'
--- grub-0.97.orig/libvolume_id/fat.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/fat.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,482 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004-2007 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2007 Ryan Lortie <desrt@desrt.ca>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define FAT12_MAX			0xff5
+#define FAT16_MAX			0xfff5
+#define FAT_ATTR_VOLUME_ID		0x08
+#define FAT_ATTR_DIR			0x10
+#define FAT_ATTR_LONG_NAME		0x0f
+#define FAT_ATTR_MASK			0x3f
+#define FAT_ENTRY_FREE			0xe5
+
+#define VFAT_LFN_SEQ_MASK		0x3f
+#define VFAT_LFN_SEQ_LAST		0x40
+#define VFAT_LFN_SEQ_MAX		20
+#define VFAT_LFN_CHARS_PER_ENTRY	(5 + 6 + 2)
+#define VFAT_LOWERCASE_NAME		0x10
+#define VFAT_LOWERCASE_EXT		0x08
+
+struct vfat_super_block {
+	uint8_t		boot_jump[3];
+	uint8_t		sysid[8];
+	uint16_t	sector_size;
+	uint8_t		sectors_per_cluster;
+	uint16_t	reserved;
+	uint8_t		fats;
+	uint16_t	dir_entries;
+	uint16_t	sectors;
+	uint8_t		media;
+	uint16_t	fat_length;
+	uint16_t	secs_track;
+	uint16_t	heads;
+	uint32_t	hidden;
+	uint32_t	total_sect;
+	union {
+		struct fat_super_block {
+			uint8_t		unknown[3];
+			uint8_t		serno[4];
+			uint8_t		label[11];
+			uint8_t		magic[8];
+			uint8_t		dummy2[192];
+			uint8_t		pmagic[2];
+		} PACKED fat;
+		struct fat32_super_block {
+			uint32_t	fat32_length;
+			uint16_t	flags;
+			uint8_t		version[2];
+			uint32_t	root_cluster;
+			uint16_t	fsinfo_sector;
+			uint16_t	backup_boot;
+			uint16_t	reserved2[6];
+			uint8_t		unknown[3];
+			uint8_t		serno[4];
+			uint8_t		label[11];
+			uint8_t		magic[8];
+			uint8_t		dummy2[164];
+			uint8_t		pmagic[2];
+		} PACKED fat32;
+	} PACKED type;
+} PACKED;
+
+struct fat32_fsinfo {
+	uint8_t signature1[4];
+	uint32_t reserved1[120];
+	uint8_t signature2[4];
+	uint32_t free_clusters;
+	uint32_t next_cluster;
+	uint32_t reserved2[4];
+} PACKED;
+
+struct vfat_dir_entry {
+	uint8_t		name[11];
+	uint8_t		attr;
+	uint8_t		lowercase;
+	uint8_t		fine_time_creat;
+	uint16_t	time_creat;
+	uint16_t	date_creat;
+	uint16_t	date_acc;
+	uint16_t	cluster_high;
+	uint16_t	time_write;
+	uint16_t	date_write;
+	uint16_t	cluster_low;
+	uint32_t	size;
+} PACKED;
+
+
+struct vfat_lfn_entry {
+	uint8_t		seq;
+	uint16_t	name0[5];
+	uint8_t		attr;
+	uint8_t		reserved;
+	uint8_t		cksum;
+	uint16_t	name1[6];
+	uint16_t	cluster;
+	uint16_t	name2[2];
+} PACKED;
+
+static uint8_t fat_lfn_checksum(const uint8_t name[11])
+{
+	uint8_t cksum = 0;
+	int i;
+
+	/* http://en.wikipedia.org/wiki/File_Allocation_Table */
+	for (i = 0; i < 11; i++)
+		cksum = ((cksum & 1) ? 0x80 : 0) + (cksum >> 1) + name[i];
+
+	return cksum;
+}
+
+static size_t fat_read_lfn(uint8_t *filename, size_t fnsize,
+			   struct vfat_dir_entry *direntry,
+			   struct vfat_dir_entry *entry)
+{
+	uint8_t buffer[VFAT_LFN_SEQ_MAX * VFAT_LFN_CHARS_PER_ENTRY * 2];
+	uint8_t expected_seq = 1;
+	uint8_t cksum;
+	size_t len = 0;
+	size_t fnlen = 0;
+
+	cksum = fat_lfn_checksum(entry->name);
+
+	while (--entry >= direntry) {
+		struct vfat_lfn_entry *lfn = (struct vfat_lfn_entry *) entry;
+
+		if (expected_seq > VFAT_LFN_SEQ_MAX)
+			break;
+
+		if ((lfn->attr & FAT_ATTR_MASK) != FAT_ATTR_LONG_NAME)
+			break;
+
+		if (lfn->cksum != cksum)
+			break;
+
+		if ((lfn->seq & VFAT_LFN_SEQ_MASK) != expected_seq++)
+			break;
+
+		if (lfn->cluster != 0)
+			break;
+
+		/* extra paranoia -- should never happen */
+		if (len + sizeof(lfn->name0) + sizeof(lfn->name1) +
+		    sizeof(lfn->name2) > sizeof(buffer))
+			break;
+
+		memcpy (&buffer[len], lfn->name0, sizeof(lfn->name0));
+		len += sizeof(lfn->name0);
+		memcpy (&buffer[len], lfn->name1, sizeof(lfn->name1));
+		len += sizeof(lfn->name1);
+		memcpy (&buffer[len], lfn->name2, sizeof(lfn->name2));
+		len += sizeof(lfn->name2);
+
+		if (lfn->seq & VFAT_LFN_SEQ_LAST) {
+			fnlen = volume_id_set_unicode16(filename, fnsize, buffer, LE, len);
+			break;
+		}
+	}
+
+	return fnlen;
+}
+
+static size_t fat_read_filename(uint8_t *filename, size_t fnsize,
+				struct vfat_dir_entry *direntry, struct vfat_dir_entry *entry)
+{
+	size_t len;
+	int i;
+
+	/* check if maybe we have LFN entries */
+	len = fat_read_lfn(filename, fnsize, direntry, entry);
+	if (len > 0)
+		goto out;
+
+	/* else, read the normal 8.3 name */
+	for (i = 0; i < 11; i++) {
+		if (entry->lowercase & ((i < 8) ? VFAT_LOWERCASE_NAME : VFAT_LOWERCASE_EXT))
+			filename[i] = tolower(entry->name[i]);
+		else
+			filename[i] = entry->name[i];
+	}
+	len = 11;
+
+out:
+	filename[len] = '\0';
+	return len;
+}
+
+/* fills filename, returns string length */
+static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize,
+				     struct vfat_dir_entry *direntry, unsigned int count)
+{
+	unsigned int i;
+
+	for (i = 0; i < count; i++) {
+		/* end marker */
+		if (direntry[i].name[0] == 0x00) {
+			dbg("end of dir");
+			break;
+		}
+
+		/* empty entry */
+		if (direntry[i].name[0] == FAT_ENTRY_FREE)
+			continue;
+
+		/* long name */
+		if ((direntry[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME)
+			continue;
+
+		if ((direntry[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) {
+			/* labels do not have file data */
+			if (direntry[i].cluster_high != 0 || direntry[i].cluster_low != 0)
+				continue;
+
+			dbg("found ATTR_VOLUME_ID id in root dir");
+			return fat_read_filename(filename, fnsize, direntry, &direntry[i]);
+		}
+
+		dbg("skip dir entry");
+	}
+
+	return 0;
+}
+
+int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint8_t filename[255 * 3];
+	struct vfat_super_block *vs;
+	struct vfat_dir_entry *direntry;
+	struct fat32_fsinfo *fsinfo;
+	uint16_t sector_size;
+	uint16_t dir_entries;
+	uint32_t sect_count;
+	uint16_t reserved;
+	uint32_t fat_size;
+	uint32_t root_cluster;
+	uint32_t dir_size;
+	uint32_t cluster_count;
+	uint16_t fat_length;
+	uint32_t fat32_length;
+	uint64_t root_start;
+	uint32_t start_data_sect;
+	uint16_t root_dir_entries;
+	uint16_t fsinfo_sect;
+	uint8_t *buf;
+	uint32_t buf_size;
+	uint32_t next;
+	int maxloop;
+	size_t fnlen;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off, 0x400);
+	if (buf == NULL)
+		return -1;
+
+	/* check signature */
+	if (buf[510] != 0x55 || buf[511] != 0xaa)
+		return -1;
+
+	vs = (struct vfat_super_block *) buf;
+	if (memcmp((char*)vs->sysid, "NTFS", 4) == 0)
+		return -1;
+
+	/* believe only that's fat, don't trust the version */
+	if (memcmp((char*)vs->type.fat32.magic, "MSWIN", 5) == 0)
+		goto magic;
+
+	if (memcmp((char*)vs->type.fat32.magic, "FAT32   ", 8) == 0)
+		goto magic;
+
+	if (memcmp((char*)vs->type.fat.magic, "FAT16   ", 8) == 0)
+		goto magic;
+
+	if (memcmp((char*)vs->type.fat.magic, "MSDOS", 5) == 0)
+		goto magic;
+
+	if (memcmp((char*)vs->type.fat.magic, "FAT12   ", 8) == 0)
+		goto magic;
+
+	/* some old floppies don't have a magic, expect the boot jump address to match */
+	if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) &&
+	     vs->boot_jump[0] != 0xe9)
+		return -1;
+
+magic:
+	/* reserverd sector count */
+	if (!vs->reserved)
+		return -1;
+
+	/* fat count */
+	if (!vs->fats)
+		return -1;
+
+	/* media check */
+	if (vs->media < 0xf8 && vs->media != 0xf0)
+		return -1;
+
+	/* cluster size check */
+	if (vs->sectors_per_cluster == 0 ||
+	    (vs->sectors_per_cluster & (vs->sectors_per_cluster-1)))
+		return -1;
+
+	/* sector size check */
+	sector_size = le16_to_cpu(vs->sector_size);
+	if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0))
+		return -1;
+
+	dbg("sector_size 0x%x", sector_size);
+	dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster);
+
+	dir_entries = le16_to_cpu(vs->dir_entries);
+	reserved = le16_to_cpu(vs->reserved);
+	dbg("reserved 0x%x", reserved);
+
+	sect_count = le16_to_cpu(vs->sectors);
+	if (sect_count == 0)
+		sect_count = le32_to_cpu(vs->total_sect);
+	dbg("sect_count 0x%x", sect_count);
+
+	fat_length = le16_to_cpu(vs->fat_length);
+	dbg("fat_length 0x%x", fat_length);
+	fat32_length = le32_to_cpu(vs->type.fat32.fat32_length);
+	dbg("fat32_length 0x%x", fat32_length);
+
+	if (fat_length)
+		fat_size = fat_length * vs->fats;
+	else if (fat32_length)
+		fat_size = fat32_length * vs->fats;
+	else
+		return -1;
+	dbg("fat_size 0x%x", fat_size);
+
+	dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) +
+			(sector_size-1)) / sector_size;
+	dbg("dir_size 0x%x", dir_size);
+
+	cluster_count = sect_count - (reserved + fat_size + dir_size);
+	cluster_count /= vs->sectors_per_cluster;
+	dbg("cluster_count 0x%x", cluster_count);
+
+	/* must be FAT32 */
+	if (!fat_length && fat32_length)
+		goto fat32;
+
+	/* cluster_count tells us the format */
+	if (cluster_count < FAT12_MAX)
+		strcpy(id->type_version, "FAT12");
+	else if (cluster_count < FAT16_MAX)
+		strcpy(id->type_version, "FAT16");
+	else
+		goto fat32;
+
+	/* the label may be an attribute in the root directory */
+	root_start = (reserved + fat_size) * sector_size;
+	dbg("root dir start 0x%llx", (unsigned long long) root_start);
+	root_dir_entries = le16_to_cpu(vs->dir_entries);
+	dbg("expected entries 0x%x", root_dir_entries);
+
+	buf_size = root_dir_entries * sizeof(struct vfat_dir_entry);
+	buf = volume_id_get_buffer(id, off + root_start, buf_size);
+	if (buf == NULL)
+		goto found;
+
+	direntry = (struct vfat_dir_entry*) buf;
+
+	fnlen = get_fat_attr_volume_id(filename, sizeof(filename), direntry, root_dir_entries);
+
+	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
+	if (vs == NULL)
+		return -1;
+
+	if (fnlen > 0 && memcmp((char*)filename, "NO NAME    ", 11) != 0) {
+		volume_id_set_label_raw(id, filename, fnlen);
+		volume_id_set_label_string(id, filename, fnlen);
+	} else if (memcmp((char*)vs->type.fat.label, "NO NAME    ", 11) != 0) {
+		volume_id_set_label_raw(id, vs->type.fat.label, 11);
+		volume_id_set_label_string(id, vs->type.fat.label, 11);
+	}
+	volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS);
+	goto found;
+
+fat32:
+	/* FAT32 should have a valid signature in the fsinfo block */
+	fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector);
+	buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200);
+	if (buf == NULL)
+		return -1;
+	fsinfo = (struct fat32_fsinfo *) buf;
+	if (memcmp((char*)fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0)
+		return -1;
+	if (memcmp((char*)fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0)
+		return -1 ;
+
+	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
+	if (vs == NULL)
+		return -1;
+
+	strcpy(id->type_version, "FAT32");
+
+	/* FAT32 root dir is a cluster chain like any other directory */
+	buf_size = vs->sectors_per_cluster * sector_size;
+	root_cluster = le32_to_cpu(vs->type.fat32.root_cluster);
+	dbg("root dir cluster %u", root_cluster);
+	start_data_sect = reserved + fat_size;
+
+	next = root_cluster;
+	maxloop = 100;
+	while (--maxloop) {
+		uint32_t next_sect_off;
+		uint64_t next_off;
+		uint64_t fat_entry_off;
+		int count;
+
+		dbg("next cluster %u", next);
+		next_sect_off = (next - 2) * vs->sectors_per_cluster;
+		next_off = (start_data_sect + next_sect_off) * sector_size;
+		dbg("cluster offset 0x%llx", (unsigned long long) next_off);
+
+		/* get cluster */
+		buf = volume_id_get_buffer(id, off + next_off, buf_size);
+		if (buf == NULL)
+			goto found;
+
+		direntry = (struct vfat_dir_entry*) buf;
+		count = buf_size / sizeof(struct vfat_dir_entry);
+		dbg("expected entries 0x%x", count);
+
+		fnlen = get_fat_attr_volume_id(filename, sizeof(filename), direntry, count);
+		if (fnlen > 0)
+			break;
+
+		/* get FAT entry */
+		fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t));
+		buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size);
+		if (buf == NULL)
+			goto found;
+
+		/* set next cluster */
+		next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff;
+		if (next < 2 || next >= 0x0ffffff0)
+			break;
+	}
+	if (maxloop == 0)
+		dbg("reached maximum follow count of root cluster chain, give up");
+
+	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
+	if (vs == NULL)
+		return -1;
+
+	if (fnlen > 0 && memcmp((char*)filename, "NO NAME    ", 11) != 0) {
+		volume_id_set_label_raw(id, filename, fnlen);
+		volume_id_set_label_string(id, filename, fnlen);
+	} else if (memcmp((char*)vs->type.fat32.label, "NO NAME    ", 11) != 0) {
+		volume_id_set_label_raw(id, vs->type.fat32.label, 11);
+		volume_id_set_label_string(id, vs->type.fat32.label, 11);
+	}
+	volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS);
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "vfat";
+
+	return 0;
+}

=== added file 'libvolume_id/gfs.c'
--- grub-0.97.orig/libvolume_id/gfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/gfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,115 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2006 Red Hat, Inc. <redhat.com>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+/* Common gfs/gfs2 constants: */
+#define GFS_MAGIC		0x01161970
+#define GFS_DEFAULT_BSIZE	4096
+#define GFS_SUPERBLOCK_OFFSET	(0x10 * GFS_DEFAULT_BSIZE)
+#define GFS_METATYPE_SB		1
+#define GFS_FORMAT_SB		100
+#define GFS_LOCKNAME_LEN	64
+
+/* gfs1 constants: */
+#define GFS_FORMAT_FS		1309
+#define GFS_FORMAT_MULTI	1401
+/* gfs2 constants: */
+#define GFS2_FORMAT_FS		1801
+#define GFS2_FORMAT_MULTI	1900
+
+struct gfs2_meta_header {
+	uint32_t mh_magic;
+	uint32_t mh_type;
+	uint64_t __pad0;          /* Was generation number in gfs1 */
+	uint32_t mh_format;
+	uint32_t __pad1;          /* Was incarnation number in gfs1 */
+};
+
+struct gfs2_inum {
+	uint64_t no_formal_ino;
+	uint64_t no_addr;
+};
+
+struct gfs2_sb {
+	struct gfs2_meta_header sb_header;
+
+	uint32_t sb_fs_format;
+	uint32_t sb_multihost_format;
+	uint32_t  __pad0;  /* Was superblock flags in gfs1 */
+
+	uint32_t sb_bsize;
+	uint32_t sb_bsize_shift;
+	uint32_t __pad1;   /* Was journal segment size in gfs1 */
+
+	struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
+	struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
+	struct gfs2_inum sb_root_dir;
+
+	char sb_lockproto[GFS_LOCKNAME_LEN];
+	char sb_locktable[GFS_LOCKNAME_LEN];
+	/* In gfs1, quota and license dinodes followed */
+} PACKED;
+
+static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers)
+{
+	struct gfs2_sb *sbd;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	sbd = (struct gfs2_sb *)
+		volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb));
+	if (sbd == NULL)
+		return -1;
+
+	if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC &&
+		be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB &&
+		be32_to_cpu(sbd->sb_header.mh_format) == GFS_FORMAT_SB) {
+		if (vers == 1) {
+			if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS ||
+				be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI)
+				return -1; /* not gfs1 */
+			id->type = "gfs";
+		}
+		else if (vers == 2) {
+			if (be32_to_cpu(sbd->sb_fs_format) != GFS2_FORMAT_FS ||
+				be32_to_cpu(sbd->sb_multihost_format) != GFS2_FORMAT_MULTI)
+				return -1; /* not gfs2 */
+			id->type = "gfs2";
+		}
+		else
+			return -1;
+		strcpy(id->type_version, "1");
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		return 0;
+	}
+	return -1;
+}
+
+int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	return volume_id_probe_gfs_generic(id, off, 1);
+}
+
+int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	return volume_id_probe_gfs_generic(id, off, 2);
+}

=== added file 'libvolume_id/hfs.c'
--- grub-0.97.orig/libvolume_id/hfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/hfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,318 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct hfs_finder_info{
+	uint32_t	boot_folder;
+	uint32_t	start_app;
+	uint32_t	open_folder;
+	uint32_t	os9_folder;
+	uint32_t	reserved;
+	uint32_t	osx_folder;
+	uint8_t		id[8];
+} PACKED;
+
+static struct hfs_mdb {
+	uint8_t		signature[2];
+	uint32_t	cr_date;
+	uint32_t	ls_Mod;
+	uint16_t	atrb;
+	uint16_t	nm_fls;
+	uint16_t	vbm_st;
+	uint16_t	alloc_ptr;
+	uint16_t	nm_al_blks;
+	uint32_t	al_blk_size;
+	uint32_t	clp_size;
+	uint16_t	al_bl_st;
+	uint32_t	nxt_cnid;
+	uint16_t	free_bks;
+	uint8_t		label_len;
+	uint8_t		label[27];
+	uint32_t	vol_bkup;
+	uint16_t	vol_seq_num;
+	uint32_t	wr_cnt;
+	uint32_t	xt_clump_size;
+	uint32_t	ct_clump_size;
+	uint16_t	num_root_dirs;
+	uint32_t	file_count;
+	uint32_t	dir_count;
+	struct hfs_finder_info finder_info;
+	uint8_t		embed_sig[2];
+	uint16_t	embed_startblock;
+	uint16_t	embed_blockcount;
+} PACKED *hfs;
+
+struct hfsplus_bnode_descriptor {
+	uint32_t	next;
+	uint32_t	prev;
+	uint8_t		type;
+	uint8_t		height;
+	uint16_t	num_recs;
+	uint16_t	reserved;
+} PACKED;
+
+struct hfsplus_bheader_record {
+	uint16_t	depth;
+	uint32_t	root;
+	uint32_t	leaf_count;
+	uint32_t	leaf_head;
+	uint32_t	leaf_tail;
+	uint16_t	node_size;
+} PACKED;
+
+struct hfsplus_catalog_key {
+	uint16_t	key_len;
+	uint32_t	parent_id;
+	uint16_t	unicode_len;
+	uint8_t		unicode[255 * 2];
+} PACKED;
+
+struct hfsplus_extent {
+	uint32_t	start_block;
+	uint32_t	block_count;
+} PACKED;
+
+#define HFSPLUS_EXTENT_COUNT		8
+struct hfsplus_fork {
+	uint64_t	total_size;
+	uint32_t	clump_size;
+	uint32_t	total_blocks;
+	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
+} PACKED;
+
+static struct hfsplus_vol_header {
+	uint8_t		signature[2];
+	uint16_t	version;
+	uint32_t	attributes;
+	uint32_t	last_mount_vers;
+	uint32_t	reserved;
+	uint32_t	create_date;
+	uint32_t	modify_date;
+	uint32_t	backup_date;
+	uint32_t	checked_date;
+	uint32_t	file_count;
+	uint32_t	folder_count;
+	uint32_t	blocksize;
+	uint32_t	total_blocks;
+	uint32_t	free_blocks;
+	uint32_t	next_alloc;
+	uint32_t	rsrc_clump_sz;
+	uint32_t	data_clump_sz;
+	uint32_t	next_cnid;
+	uint32_t	write_count;
+	uint64_t	encodings_bmp;
+	struct hfs_finder_info finder_info;
+	struct hfsplus_fork alloc_file;
+	struct hfsplus_fork ext_file;
+	struct hfsplus_fork cat_file;
+	struct hfsplus_fork attr_file;
+	struct hfsplus_fork start_file;
+} PACKED *hfsplus;
+
+#define HFS_SUPERBLOCK_OFFSET		0x400
+#define HFS_NODE_LEAF			0xff
+#define HFSPLUS_POR_CNID		1
+
+static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id)
+{
+#if 0
+	MD5_CTX md5c;
+	static const uint8_t hash_init[16] = {
+		0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6,
+		0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac
+	};
+	uint8_t uuid[16];
+
+	if (*((uint64_t *)hfs_id) == 0)
+		return;
+
+	MD5_Init(&md5c);
+	MD5_Update(&md5c, &hash_init, 16);
+	MD5_Update(&md5c, hfs_id, 8);
+	MD5_Final(uuid, &md5c);
+
+	uuid[6] = 0x30 | (uuid[6] & 0x0f);
+	uuid[8] = 0x80 | (uuid[8] & 0x3f);
+	volume_id_set_uuid(id, uuid, UUID_DCE);
+#endif
+
+	volume_id_set_uuid(id, hfs_id, 0, UUID_64BIT_BE);
+}
+
+int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	unsigned int blocksize;
+	unsigned int cat_block;
+	unsigned int ext_block_start;
+	unsigned int ext_block_count;
+	int ext;
+	unsigned int leaf_node_head;
+	unsigned int leaf_node_count;
+	unsigned int leaf_node_size;
+	unsigned int leaf_block;
+	uint64_t leaf_off;
+	unsigned int alloc_block_size;
+	unsigned int alloc_first_block;
+	unsigned int embed_first_block;
+	unsigned int record_count;
+	struct hfsplus_bnode_descriptor *descr;
+	struct hfsplus_bheader_record *bnode;
+	struct hfsplus_catalog_key *key;
+	unsigned int label_len;
+	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
+	const uint8_t *buf;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
+                return -1;
+
+	hfs = (struct hfs_mdb *) buf;
+	if (memcmp((char *)hfs->signature, "BD", 2) != 0)
+		goto checkplus;
+
+	/* it may be just a hfs wrapper for hfs+ */
+	if (memcmp((char *)hfs->embed_sig, "H+", 2) == 0) {
+		alloc_block_size = be32_to_cpu(hfs->al_blk_size);
+		dbg("alloc_block_size 0x%x", alloc_block_size);
+
+		alloc_first_block = be16_to_cpu(hfs->al_bl_st);
+		dbg("alloc_first_block 0x%x", alloc_first_block);
+
+		embed_first_block = be16_to_cpu(hfs->embed_startblock);
+		dbg("embed_first_block 0x%x", embed_first_block);
+
+		off += (alloc_first_block * 512) +
+		       (embed_first_block * alloc_block_size);
+		dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off);
+
+		buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
+		if (buf == NULL)
+			return -1;
+		goto checkplus;
+	}
+
+	if (hfs->label_len > 0 && hfs->label_len < 28) {
+		volume_id_set_label_raw(id, hfs->label, hfs->label_len);
+		volume_id_set_label_string(id, hfs->label, hfs->label_len) ;
+	}
+
+	hfsid_set_uuid(id, hfs->finder_info.id);
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "hfs";
+
+	return 0;
+
+checkplus:
+	hfsplus = (struct hfsplus_vol_header *) buf;
+	if (memcmp((char *)hfsplus->signature, "H+", 2) == 0)
+		goto hfsplus;
+	if (memcmp((char *)hfsplus->signature, "HX", 2) == 0)
+		goto hfsplus;
+	return -1;
+
+hfsplus:
+	hfsid_set_uuid(id, hfsplus->finder_info.id);
+
+	blocksize = be32_to_cpu(hfsplus->blocksize);
+	dbg("blocksize %u", blocksize);
+
+	memcpy(extents, hfsplus->cat_file.extents, sizeof(extents));
+	cat_block = be32_to_cpu(extents[0].start_block);
+	dbg("catalog start block 0x%x", cat_block);
+
+	buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000);
+	if (buf == NULL)
+		goto found;
+
+	bnode = (struct hfsplus_bheader_record *)
+		&buf[sizeof(struct hfsplus_bnode_descriptor)];
+
+	leaf_node_head = be32_to_cpu(bnode->leaf_head);
+	dbg("catalog leaf node 0x%x", leaf_node_head);
+
+	leaf_node_size = be16_to_cpu(bnode->node_size);
+	dbg("leaf node size 0x%x", leaf_node_size);
+
+	leaf_node_count = be32_to_cpu(bnode->leaf_count);
+	dbg("leaf node count 0x%x", leaf_node_count);
+	if (leaf_node_count == 0)
+		goto found;
+
+	leaf_block = (leaf_node_head * leaf_node_size) / blocksize;
+
+	/* get physical location */
+	for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) {
+		ext_block_start = be32_to_cpu(extents[ext].start_block);
+		ext_block_count = be32_to_cpu(extents[ext].block_count);
+		dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count);
+
+		if (ext_block_count == 0)
+			goto found;
+
+		/* this is our extent */
+		if (leaf_block < ext_block_count)
+			break;
+
+		leaf_block -= ext_block_count;
+	}
+	if (ext == HFSPLUS_EXTENT_COUNT)
+		goto found;
+	dbg("found block in extent %i", ext);
+
+	leaf_off = (ext_block_start + leaf_block) * blocksize;
+
+	buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size);
+	if (buf == NULL)
+		goto found;
+
+	descr = (struct hfsplus_bnode_descriptor *) buf;
+	dbg("descriptor type 0x%x", descr->type);
+
+	record_count = be16_to_cpu(descr->num_recs);
+	dbg("number of records %u", record_count);
+	if (record_count == 0)
+		goto found;
+
+	if (descr->type != HFS_NODE_LEAF)
+		goto found;
+
+	key = (struct hfsplus_catalog_key *)
+		&buf[sizeof(struct hfsplus_bnode_descriptor)];
+
+	dbg("parent id 0x%x", be32_to_cpu(key->parent_id));
+	if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID)
+		goto found;
+
+	label_len = be16_to_cpu(key->unicode_len) * 2;
+	dbg("label unicode16 len %i", label_len);
+	volume_id_set_label_raw(id, key->unicode, label_len);
+	volume_id_set_label_unicode16(id, key->unicode, BE, label_len);
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "hfsplus";
+
+	return 0;
+}

=== added file 'libvolume_id/highpoint.c'
--- grub-0.97.orig/libvolume_id/highpoint.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/highpoint.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,91 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct hpt37x_meta {
+	uint8_t		filler1[32];
+	uint32_t	magic;
+} PACKED;
+
+struct hpt45x_meta {
+	uint32_t	magic;
+} PACKED;
+
+#define HPT37X_CONFIG_OFF		0x1200
+#define HPT37X_MAGIC_OK			0x5a7816f0
+#define HPT37X_MAGIC_BAD		0x5a7816fd
+
+#define HPT45X_MAGIC_OK			0x5a7816f3
+#define HPT45X_MAGIC_BAD		0x5a7816fd
+
+
+int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct hpt37x_meta *hpt;
+	uint32_t magic;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	hpt = (struct hpt37x_meta *) buf;
+	magic = le32_to_cpu(hpt->magic);
+	if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "highpoint_raid_member";
+
+	return 0;
+}
+
+int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct hpt45x_meta *hpt;
+	uint64_t meta_off;
+	uint32_t magic;
+
+	dbg("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-11) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	hpt = (struct hpt45x_meta *) buf;
+	magic = le32_to_cpu(hpt->magic);
+	if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "highpoint_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/hpfs.c'
--- grub-0.97.orig/libvolume_id/hpfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/hpfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,51 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct hpfs_super
+{
+	uint8_t		magic[4];
+	uint8_t		version;
+} PACKED;
+
+#define HPFS_SUPERBLOCK_OFFSET			0x2000
+
+int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct hpfs_super *hs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200);
+	if (hs == NULL)
+		return -1;
+
+	if (memcmp((char *)hs->magic, "\x49\xe8\x95\xf9", 4) == 0) {
+		sprintf(id->type_version, "%u", hs->version);
+
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		id->type = "hpfs";
+		return 0;
+	}
+
+	return -1;
+}

=== added file 'libvolume_id/iso9660.c'
--- grub-0.97.orig/libvolume_id/iso9660.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/iso9660.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,119 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define ISO_SUPERBLOCK_OFFSET		0x8000
+#define ISO_SECTOR_SIZE			0x800
+#define ISO_VD_OFFSET			(ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE)
+#define ISO_VD_PRIMARY			0x1
+#define ISO_VD_SUPPLEMENTARY		0x2
+#define ISO_VD_END			0xff
+#define ISO_VD_MAX			16
+
+struct iso_volume_descriptor {
+	uint8_t		type;
+	uint8_t		id[5];
+	uint8_t		version;
+	uint8_t		flags;
+	uint8_t		system_id[32];
+	uint8_t		volume_id[32];
+	uint8_t		unused[8];
+	uint8_t		space_size[8];
+	uint8_t		escape_sequences[8];
+} PACKED;
+
+struct high_sierra_volume_descriptor {
+	uint8_t		foo[8];
+	uint8_t		type;
+	uint8_t		id[5];
+	uint8_t		version;
+} PACKED;
+
+int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint8_t *buf;
+	struct iso_volume_descriptor *is;
+	struct high_sierra_volume_descriptor *hs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	is = (struct iso_volume_descriptor *) buf;
+
+	if (memcmp((char*)is->id, "CD001", 5) == 0) {
+		int vd_offset;
+		int i;
+
+		dbg("read label from PVD");
+		volume_id_set_label_raw(id, is->volume_id, 32);
+		volume_id_set_label_string(id, is->volume_id, 32);
+
+		dbg("looking for SVDs");
+		vd_offset = ISO_VD_OFFSET;
+		for (i = 0; i < ISO_VD_MAX; i++) {
+			uint8_t svd_label[64];
+
+			is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200);
+			if (is == NULL || is->type == ISO_VD_END)
+				break;
+			if (is->type != ISO_VD_SUPPLEMENTARY)
+				continue;
+
+			dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset));
+			if (memcmp((char *)is->escape_sequences, "%/@", 3) == 0||
+			    memcmp((char *)is->escape_sequences, "%/C", 3) == 0||
+			    memcmp((char *)is->escape_sequences, "%/E", 3) == 0) {
+				dbg("Joliet extension found");
+				volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32);
+				if (memcmp((char *)id->label, (char *)svd_label, 16) == 0) {
+					dbg("SVD label is identical, use the possibly longer PVD one");
+					break;
+				}
+
+				volume_id_set_label_raw(id, is->volume_id, 32);
+				volume_id_set_label_string(id, svd_label, 32);
+				strcpy(id->type_version, "Joliet Extension");
+				goto found;
+			}
+			vd_offset += ISO_SECTOR_SIZE;
+		}
+		goto found;
+	}
+
+	hs = (struct high_sierra_volume_descriptor *) buf;
+
+	if (memcmp((char *)hs->id, "CDROM", 5) == 0) {
+		strcpy(id->type_version, "High Sierra");
+		goto found;
+	}
+
+	return -1;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "iso9660";
+
+	return 0;
+}

=== added file 'libvolume_id/isw_raid.c'
--- grub-0.97.orig/libvolume_id/isw_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/isw_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,61 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct isw_meta {
+	uint8_t		sig[32];
+	uint32_t	check_sum;
+	uint32_t	mpb_size;
+	uint32_t	family_num;
+	uint32_t	generation_num;
+} PACKED;
+
+#define ISW_SIGNATURE		"Intel Raid ISM Cfg Sig. "
+
+
+int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct isw_meta *isw;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-2) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	isw = (struct isw_meta *) buf;
+	if (memcmp((char *)isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6);
+	id->type = "isw_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/jfs.c'
--- grub-0.97.orig/libvolume_id/jfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/jfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,60 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct jfs_super_block {
+	uint8_t		magic[4];
+	uint32_t	version;
+	uint64_t	size;
+	uint32_t	bsize;
+	uint32_t	dummy1;
+	uint32_t	pbsize;
+	uint32_t	dummy2[27];
+	uint8_t		uuid[16];
+	uint8_t		label[16];
+	uint8_t		loguuid[16];
+} PACKED;
+
+#define JFS_SUPERBLOCK_OFFSET			0x8000
+
+int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct jfs_super_block *js;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200);
+	if (js == NULL)
+		return -1;
+
+	if (memcmp((char *)js->magic, "JFS1", 4) != 0)
+		return -1;
+
+	volume_id_set_label_raw(id, js->label, 16);
+	volume_id_set_label_string(id, js->label, 16);
+	volume_id_set_uuid(id, js->uuid, 0, UUID_DCE);
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "jfs";
+
+	return 0;
+}

=== added file 'libvolume_id/jmicron_raid.c'
--- grub-0.97.orig/libvolume_id/jmicron_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/jmicron_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,57 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct jmicron_meta {
+	int8_t		signature[2];
+	uint8_t		minor_version;
+	uint8_t		major_version;
+	uint16_t	checksum;
+} PACKED;
+
+int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct jmicron_meta *jm;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-1) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	jm = (struct jmicron_meta *) buf;
+	if (memcmp((char *)jm->signature, "JM", 2) != 0)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	sprintf(id->type_version, "%u.%u", jm->major_version, jm->minor_version);
+	id->type = "jmicron_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/linux_raid.c'
--- grub-0.97.orig/libvolume_id/linux_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/linux_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,160 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+static struct mdp0_super_block {
+	uint32_t	md_magic;
+	uint32_t	major_version;
+	uint32_t	minor_version;
+	uint32_t	patch_version;
+	uint32_t	gvalid_words;
+	uint32_t	set_uuid0;
+	uint32_t	ctime;
+	uint32_t	level;
+	uint32_t	size;
+	uint32_t	nr_disks;
+	uint32_t	raid_disks;
+	uint32_t	md_minor;
+	uint32_t	not_persistent;
+	uint32_t	set_uuid1;
+	uint32_t	set_uuid2;
+	uint32_t	set_uuid3;
+} PACKED *mdp0;
+
+struct mdp1_super_block {
+	uint32_t	magic;
+	uint32_t	major_version;
+	uint32_t	feature_map;
+	uint32_t	pad0;
+	uint8_t		set_uuid[16];
+	uint8_t		set_name[32];
+} PACKED *mdp1;
+
+#define MD_RESERVED_BYTES		0x10000
+#define MD_SB_MAGIC			0xa92b4efc
+
+static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	union {
+		uint32_t ints[4];
+		uint8_t bytes[16];
+	} uuid;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+	if (size < 0x10000)
+		return -1;
+
+	buf = volume_id_get_buffer(id, off, 0x800);
+	if (buf == NULL)
+		return -1;
+	mdp0 = (struct mdp0_super_block *) buf;
+
+	if (le32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) {
+		uuid.ints[0] = bswap_32(mdp0->set_uuid0);
+		if (le32_to_cpu(mdp0->minor_version >= 90)) {
+			uuid.ints[1] = bswap_32(mdp0->set_uuid1);
+			uuid.ints[2] = bswap_32(mdp0->set_uuid2);
+			uuid.ints[3] = bswap_32(mdp0->set_uuid3);
+		} else {
+			uuid.ints[1] = 0;
+			uuid.ints[2] = 0;
+			uuid.ints[3] = 0;
+		}
+		volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
+		sprintf(id->type_version, "%u.%u.%u",
+			 le32_to_cpu(mdp0->major_version),
+			 le32_to_cpu(mdp0->minor_version),
+			 le32_to_cpu(mdp0->patch_version));
+	} else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) {
+		uuid.ints[0] = mdp0->set_uuid0;
+		if (be32_to_cpu(mdp0->minor_version >= 90)) {
+			uuid.ints[1] = mdp0->set_uuid1;
+			uuid.ints[2] = mdp0->set_uuid2;
+			uuid.ints[3] = mdp0->set_uuid3;
+		} else {
+			uuid.ints[1] = 0;
+			uuid.ints[2] = 0;
+			uuid.ints[3] = 0;
+		}
+		volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
+		sprintf(id->type_version, "%u.%u.%u",
+			 be32_to_cpu(mdp0->major_version),
+			 be32_to_cpu(mdp0->minor_version),
+			 be32_to_cpu(mdp0->patch_version));
+	} else
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "linux_raid_member";
+	return 0;
+}
+
+static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	buf = volume_id_get_buffer(id, off, 0x800);
+	if (buf == NULL)
+		return -1;
+	mdp1 = (struct mdp1_super_block *) buf;
+
+	if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
+		return -1;
+
+	volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT);
+	volume_id_set_label_raw(id, mdp1->set_name, 32);
+	volume_id_set_label_string(id, mdp1->set_name, 32);
+	sprintf(id->type_version, "%u", le32_to_cpu(mdp1->major_version));
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "linux_raid_member";
+	return 0;
+}
+
+int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint64_t sboff;
+
+	/* version 0 at the end of the device */
+	sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES;
+	if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0)
+		return 0;
+
+	/* version 1.0 at the end of the device */
+	sboff = (size & ~(0x1000 - 1)) - 0x2000;
+	if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0)
+		return 0;
+
+	/* version 1.1 at the start of the device */
+	if (volume_id_probe_linux_raid1(id, off, size) == 0)
+		return 0;
+
+	/* version 1.2 at 4k offset from the start */
+	if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0)
+		return 0;
+
+	return -1;
+}

=== added file 'libvolume_id/linux_swap.c'
--- grub-0.97.orig/libvolume_id/linux_swap.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/linux_swap.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,85 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct swap_header_v1_2 {
+	uint8_t		bootbits[1024];
+	uint32_t	version;
+	uint32_t	last_page;
+	uint32_t	nr_badpages;
+	uint8_t		uuid[16];
+	uint8_t		volume_name[16];
+} PACKED;
+
+#define LARGEST_PAGESIZE			0x4000
+
+int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	unsigned int page;
+	struct swap_header_v1_2 *sw;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	/* eek, the swap signature is at the end of the PAGE_SIZE */
+	for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) {
+			buf = volume_id_get_buffer(id, off + page-10, 10);
+			if (buf == NULL)
+				return -1;
+
+			if (memcmp((char *)buf, "SWAP-SPACE", 10) == 0) {
+				strcpy(id->type_version, "1");
+				goto found;
+			}
+
+			if (memcmp((char *)buf, "SWAPSPACE2", 10) == 0) {
+				id->type = "swap";
+				strcpy(id->type_version, "2");
+				goto found_label;
+			}
+
+			if (memcmp((char *)buf, "S1SUSPEND", 9) == 0) {
+				id->type = "suspend";
+				strcpy(id->type_version, "s1suspend");
+				goto found_label;
+			}
+
+			if (memcmp((char *)buf, "ULSUSPEND", 9) == 0) {
+				id->type = "suspend";
+				strcpy(id->type_version, "ulsuspend");
+				goto found_label;
+			}
+	}
+	return -1;
+
+found_label:
+	sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2));
+	if (sw != NULL) {
+		volume_id_set_label_raw(id, sw->volume_name, 16);
+		volume_id_set_label_string(id, sw->volume_name, 16);
+		volume_id_set_uuid(id, sw->uuid, 0, UUID_DCE);
+	}
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_OTHER);
+	return 0;
+}

=== added file 'libvolume_id/lsi_raid.c'
--- grub-0.97.orig/libvolume_id/lsi_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/lsi_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,55 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct lsi_meta {
+	uint8_t		sig[6];
+} PACKED;
+
+#define LSI_SIGNATURE		"$XIDE$"
+
+int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct lsi_meta *lsi;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-1) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	lsi = (struct lsi_meta *) buf;
+	if (memcmp((char *)lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "lsi_mega_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/luks.c'
--- grub-0.97.orig/libvolume_id/luks.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/luks.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,76 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define LUKS_SECTOR_SHIFT		9
+#define LUKS_SECTOR_SIZE		(1 << LUKS_SECTOR_SHIFT)
+
+#define LUKS_CIPHERNAME_L		32
+#define LUKS_CIPHERMODE_L		32
+#define LUKS_HASHSPEC_L			32
+#define LUKS_DIGESTSIZE			20
+#define LUKS_SALTSIZE			32
+#define LUKS_NUMKEYS			8
+
+#define LUKS_MAGIC_L			6
+#define LUKS_PHDR_SIZE			(sizeof(struct luks_phdr)/LUKS_SECTOR_SIZE+1)
+#define UUID_STRING_L			40
+static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
+
+struct luks_phdr {
+	uint8_t		magic[LUKS_MAGIC_L];
+	uint16_t	version;
+	uint8_t		cipherName[LUKS_CIPHERNAME_L];
+	uint8_t		cipherMode[LUKS_CIPHERMODE_L];
+	uint8_t		hashSpec[LUKS_HASHSPEC_L];
+	uint32_t	payloadOffset;
+	uint32_t	keyBytes;
+	uint8_t		mkDigest[LUKS_DIGESTSIZE];
+	uint8_t		mkDigestSalt[LUKS_SALTSIZE];
+	uint32_t	mkDigestIterations;
+	uint8_t		uuid[UUID_STRING_L];
+	struct {
+		uint32_t	active;
+		uint32_t	passwordIterations;
+		uint8_t		passwordSalt[LUKS_SALTSIZE];
+		uint32_t	keyMaterialOffset;
+		uint32_t	stripes;
+	} keyblock[LUKS_NUMKEYS];
+};
+
+int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct luks_phdr *header;
+
+	header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE);
+	if (header == NULL)
+		return -1;
+
+	if (memcmp((char *)header->magic, (char *)LUKS_MAGIC, LUKS_MAGIC_L))
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_CRYPTO);
+	volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING);
+	sprintf(id->type_version, "%u", le16_to_cpu(header->version));
+	id->type = "crypto_LUKS";
+	return 0;
+}

=== added file 'libvolume_id/lvm.c'
--- grub-0.97.orig/libvolume_id/lvm.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/lvm.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,92 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct lvm1_super_block {
+	uint8_t	id[2];
+} PACKED;
+
+struct lvm2_super_block {
+	uint8_t		id[8];
+	uint64_t	sector_xl;
+	uint32_t	crc_xl;
+	uint32_t	offset_xl;
+	uint8_t		type[8];
+} PACKED;
+
+#define LVM1_SB_OFF			0x400
+#define LVM1_MAGIC			"HM"
+
+int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct lvm1_super_block *lvm;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
+	if (buf == NULL)
+		return -1;
+
+	lvm = (struct lvm1_super_block *) buf;
+
+	if (memcmp((char *)lvm->id, LVM1_MAGIC, 2) != 0)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "LVM1_member";
+
+	return 0;
+}
+
+#define LVM2_LABEL_ID			"LABELONE"
+#define LVM2LABEL_SCAN_SECTORS		4
+
+int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	unsigned int soff;
+	struct lvm2_super_block *lvm;
+
+	dbg("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200);
+	if (buf == NULL)
+		return -1;
+
+
+	for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) {
+		lvm = (struct lvm2_super_block *) &buf[soff];
+
+		if (memcmp((char *)lvm->id, LVM2_LABEL_ID, 8) == 0)
+			goto found;
+	}
+
+	return -1;
+
+found:
+	memcpy(id->type_version, lvm->type, 8);
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "LVM2_member";
+
+	return 0;
+}

=== added file 'libvolume_id/minix.c'
--- grub-0.97.orig/libvolume_id/minix.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/minix.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,112 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define MINIX_SUPERBLOCK_OFFSET			0x400
+
+#define MINIX_SUPER_MAGIC			0x137F
+#define MINIX_SUPER_MAGIC2			0x138F
+#define MINIX2_SUPER_MAGIC			0x2468
+#define MINIX2_SUPER_MAGIC2			0x2478
+#define MINIX3_SUPER_MAGIC			0x4d5a
+
+struct minix_super_block
+{
+	uint16_t	s_ninodes;
+	uint16_t	s_nzones;
+	uint16_t	s_imap_blocks;
+	uint16_t	s_zmap_blocks;
+	uint16_t	s_firstdatazone;
+	uint16_t	s_log_zone_size;
+	uint32_t	s_max_size;
+	uint16_t	s_magic;
+	uint16_t	s_state;
+	uint32_t	s_zones;
+} PACKED;
+
+struct minix3_super_block {
+	uint32_t	s_ninodes;
+	uint16_t	s_pad0;
+	uint16_t	s_imap_blocks;
+	uint16_t	s_zmap_blocks;
+	uint16_t	s_firstdatazone;
+	uint16_t	s_log_zone_size;
+	uint16_t	s_pad1;
+	uint32_t	s_max_size;
+	uint32_t	s_zones;
+	uint16_t	s_magic;
+	uint16_t	s_pad2;
+	uint16_t	s_blocksize;
+	uint8_t 	s_disk_version;
+} PACKED;
+
+int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint8_t *buf;
+	struct minix_super_block *ms;
+	struct minix3_super_block *m3s;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	ms = (struct minix_super_block *) buf;
+
+	if (ms->s_magic == MINIX_SUPER_MAGIC ||
+	    ms->s_magic == bswap_16(MINIX_SUPER_MAGIC)) {
+		strcpy(id->type_version, "1");
+		goto found;
+	}
+	if (ms->s_magic == MINIX_SUPER_MAGIC2 ||
+	    ms->s_magic == bswap_16(MINIX_SUPER_MAGIC2)) {
+		strcpy(id->type_version, "1");
+		goto found;
+	}
+	if (ms->s_magic == MINIX2_SUPER_MAGIC ||
+	    ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC)) {
+		strcpy(id->type_version, "2");
+		goto found;
+	}
+	if (ms->s_magic == MINIX2_SUPER_MAGIC2 ||
+	    ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC2)) {
+		strcpy(id->type_version, "2");
+		goto found;
+	}
+
+	m3s = (struct minix3_super_block *) buf;
+	if (m3s->s_magic == MINIX3_SUPER_MAGIC ||
+	    m3s->s_magic == bswap_16(MINIX3_SUPER_MAGIC)) {
+		strcpy(id->type_version, "3");
+		goto found;
+	}
+	goto exit;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "minix";
+	return 0;
+
+exit:
+	return -1;
+}

=== added file 'libvolume_id/misc.c'
--- grub-0.97.orig/libvolume_id/misc.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/misc.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,34 @@
+/*
+ * volume_id/misc.c
+ *
+ * Copyright (C) 2008 Canonical Ltd.
+ *
+ *      This program is free software; you can redistribute it and/or modify it
+ *      under the terms of the GNU General Public License as published by the
+ *      Free Software Foundation version 2 of the License.
+ */
+#define _GNU_SOURCE
+#include <string.h>
+
+/*
+ *  Misc auxiliary functions required for volume_id inside grub
+ */
+size_t strnlen(const char *s, size_t limit)
+{
+	size_t length = 0;
+	while ( (length < limit) && (*s++) ) 
+		length++;
+
+   	return length;
+}
+
+char *strchr (const char *s, int c)
+{
+	do {
+		if ( *s == c ) {
+			return (char*)s;
+      		}
+  	} while ( *s++ );
+
+  	return 0;
+}

=== added file 'libvolume_id/netware.c'
--- grub-0.97.orig/libvolume_id/netware.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/netware.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,98 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define NW_SUPERBLOCK_OFFSET			0x1000
+
+struct netware_super_block {
+	uint8_t		SBH_Signature[4];
+	uint16_t	SBH_VersionMajor;
+	uint16_t	SBH_VersionMinor;
+	uint16_t	SBH_VersionMediaMajor;
+	uint16_t	SBH_VersionMediaMinor;
+	uint32_t	SBH_ItemsMoved;
+	uint8_t		SBH_InternalID[16];
+	uint32_t	SBH_PackedSize;
+	uint32_t	SBH_Checksum;
+	uint32_t	supersyncid;
+	int64_t		superlocation[4];
+	uint32_t	physSizeUsed;
+	uint32_t	sizeUsed;
+	uint32_t	superTimeStamp;
+	uint32_t	reserved0[1];
+	int64_t		SBH_LoggedPoolDataBlk;
+	int64_t		SBH_PoolDataBlk;
+	uint8_t		SBH_OldInternalID[16];
+	uint32_t	SBH_PoolToLVStartUTC;
+	uint32_t	SBH_PoolToLVEndUTC;
+	uint16_t	SBH_VersionMediaMajorCreate;
+	uint16_t	SBH_VersionMediaMinorCreate;
+	uint32_t	SBH_BlocksMoved;
+	uint32_t	SBH_TempBTSpBlk;
+	uint32_t	SBH_TempFTSpBlk;
+	uint32_t	SBH_TempFTSpBlk1;
+	uint32_t	SBH_TempFTSpBlk2;
+	uint32_t 	nssMagicNumber;
+	uint32_t	poolClassID;
+	uint32_t 	poolID;
+	uint32_t	createTime;
+	int64_t		SBH_LoggedVolumeDataBlk;
+	int64_t		SBH_VolumeDataBlk;
+	int64_t		SBH_SystemBeastBlkNum;
+	uint64_t	totalblocks;
+	uint16_t 	SBH_Name[64];
+	uint8_t		SBH_VolumeID[16];
+	uint8_t		SBH_PoolID[16];
+	uint8_t		SBH_PoolInternalID[16];
+	uint64_t	SBH_Lsn;
+	uint32_t	SBH_SS_Enabled;
+	uint32_t	SBH_SS_CreateTime;
+	uint8_t		SBH_SS_OriginalPoolID[16];
+	uint8_t		SBH_SS_OriginalVolumeID[16];
+	uint8_t		SBH_SS_Guid[16];
+	uint16_t	SBH_SS_OriginalName[64];
+	uint32_t	reserved2[64-(2+46)];
+} PACKED;
+
+int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct netware_super_block *nw;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200);
+	if (nw == NULL)
+		return -1;
+
+	if (memcmp((char *)nw->SBH_Signature, "SPB5", 4) != 0)
+		return -1;
+
+	volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE);
+
+	sprintf(id->type_version, "%u.%02u",
+		 le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor));
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "nss";
+
+	return 0;
+}

=== added file 'libvolume_id/ntfs.c'
--- grub-0.97.orig/libvolume_id/ntfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/ntfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,192 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+static struct ntfs_super_block {
+	uint8_t		jump[3];
+	uint8_t		oem_id[8];
+	uint16_t	bytes_per_sector;
+	uint8_t		sectors_per_cluster;
+	uint16_t	reserved_sectors;
+	uint8_t		fats;
+	uint16_t	root_entries;
+	uint16_t	sectors;
+	uint8_t		media_type;
+	uint16_t	sectors_per_fat;
+	uint16_t	sectors_per_track;
+	uint16_t	heads;
+	uint32_t	hidden_sectors;
+	uint32_t	large_sectors;
+	uint16_t	unused[2];
+	uint64_t	number_of_sectors;
+	uint64_t	mft_cluster_location;
+	uint64_t	mft_mirror_cluster_location;
+	int8_t		cluster_per_mft_record;
+	uint8_t		reserved1[3];
+	int8_t		cluster_per_index_record;
+	uint8_t		reserved2[3];
+	uint8_t		volume_serial[8];
+	uint16_t	checksum;
+} PACKED *ns;
+
+static struct master_file_table_record {
+	uint8_t		magic[4];
+	uint16_t	usa_ofs;
+	uint16_t	usa_count;
+	uint64_t	lsn;
+	uint16_t	sequence_number;
+	uint16_t	link_count;
+	uint16_t	attrs_offset;
+	uint16_t	flags;
+	uint32_t	bytes_in_use;
+	uint32_t	bytes_allocated;
+} PACKED *mftr;
+
+static struct file_attribute {
+	uint32_t	type;
+	uint32_t	len;
+	uint8_t		non_resident;
+	uint8_t		name_len;
+	uint16_t	name_offset;
+	uint16_t	flags;
+	uint16_t	instance;
+	uint32_t	value_len;
+	uint16_t	value_offset;
+} PACKED *attr;
+
+static struct volume_info {
+	uint64_t	reserved;
+	uint8_t		major_ver;
+	uint8_t		minor_ver;
+} PACKED *info;
+
+#define MFT_RECORD_VOLUME			3
+#define MFT_RECORD_ATTR_VOLUME_NAME		0x60
+#define MFT_RECORD_ATTR_VOLUME_INFO		0x70
+#define MFT_RECORD_ATTR_OBJECT_ID		0x40
+#define MFT_RECORD_ATTR_END			0xffffffffu
+
+#undef debug
+#define debug grub_printf
+
+int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	unsigned int sector_size;
+	unsigned int cluster_size;
+	uint64_t mft_cluster;
+	uint64_t mft_off;
+	unsigned int mft_record_size;
+	unsigned int attr_type;
+	unsigned int attr_off;
+	unsigned int attr_len;
+	unsigned int val_off;
+	unsigned int val_len;
+	const uint8_t *buf;
+	const uint8_t *val;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200);
+	if (ns == NULL)
+		return -1;
+
+	if (memcmp((char *)ns->oem_id, "NTFS", 4) != 0)
+		return -1;
+
+	volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE);
+
+	sector_size = le16_to_cpu(ns->bytes_per_sector);
+	if (sector_size < 0x200)
+		return -1;
+
+	cluster_size = ns->sectors_per_cluster * sector_size;
+	mft_cluster = le64_to_cpu(ns->mft_cluster_location);
+	mft_off = mft_cluster * cluster_size;
+
+	if (ns->cluster_per_mft_record < 0)
+		/* size = -log2(mft_record_size); normally 1024 Bytes */
+		mft_record_size = 1 << -ns->cluster_per_mft_record;
+	else
+		mft_record_size = ns->cluster_per_mft_record * cluster_size;
+
+	dbg("sectorsize  0x%x", sector_size);
+	dbg("clustersize 0x%x", cluster_size);
+	dbg("mftcluster  %llu", (unsigned long long) mft_cluster);
+	dbg("mftoffset  0x%llx", (unsigned long long) mft_off);
+	dbg("cluster per mft_record  %i", ns->cluster_per_mft_record);
+	dbg("mft record size  %i", mft_record_size);
+
+	buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size),
+			 mft_record_size);
+	if (buf == NULL)
+		return -1;
+
+	mftr = (struct master_file_table_record*) buf;
+	dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]);
+	if (memcmp((char *)mftr->magic, "FILE", 4) != 0)
+		return -1;
+
+	attr_off = le16_to_cpu(mftr->attrs_offset);
+	dbg("file $Volume's attributes are at offset %i", attr_off);
+
+	while (1) {
+		attr = (struct file_attribute*) &buf[attr_off];
+		attr_type = le32_to_cpu(attr->type);
+		attr_len = le16_to_cpu(attr->len);
+		val_off = le16_to_cpu(attr->value_offset);
+		val_len = le32_to_cpu(attr->value_len);
+		attr_off += attr_len;
+
+		if (attr_len == 0)
+			break;
+
+		if (attr_off >= mft_record_size)
+			break;
+
+		if (attr_type == MFT_RECORD_ATTR_END)
+			break;
+
+		dbg("found attribute type 0x%x, len %i, at offset %i",
+		    attr_type, attr_len, attr_off);
+
+		if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) {
+			dbg("found info, len %i", val_len);
+			info = (struct volume_info*) (((uint8_t *) attr) + val_off);
+			sprintf(id->type_version, "%u.%u", info->major_ver, info->minor_ver);
+		}
+
+		if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) {
+			dbg("found label, len %i", val_len);
+			if (val_len > VOLUME_ID_LABEL_SIZE)
+				val_len = VOLUME_ID_LABEL_SIZE;
+
+			val = ((uint8_t *) attr) + val_off;
+			volume_id_set_label_raw(id, val, val_len);
+			volume_id_set_label_unicode16(id, val, LE, val_len);
+		}
+	}
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "ntfs";
+
+	return 0;
+}

=== added file 'libvolume_id/nvidia_raid.c'
--- grub-0.97.orig/libvolume_id/nvidia_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/nvidia_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,59 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct nvidia_meta {
+	uint8_t		vendor[8];
+	uint32_t	size;
+	uint32_t	chksum;
+	uint16_t	version;
+} PACKED;
+
+#define NVIDIA_SIGNATURE		"NVIDIA"
+
+int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct nvidia_meta *nv;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-2) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	nv = (struct nvidia_meta *) buf;
+	if (memcmp((char *)nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	sprintf(id->type_version, "%u", le16_to_cpu(nv->version));
+	id->type = "nvidia_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/ocfs.c'
--- grub-0.97.orig/libvolume_id/ocfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/ocfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,186 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Andre Masella <andre@masella.no-ip.org>
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct ocfs1_super_block_header {
+	uint32_t	minor_version;
+	uint32_t	major_version;
+	uint8_t		signature[128];
+	uint8_t		mount_point[128];
+	uint64_t	serial_num;
+	uint64_t	device_size;
+	uint64_t	start_off;
+	uint64_t	bitmap_off;
+	uint64_t	publ_off;
+	uint64_t	vote_off;
+	uint64_t	root_bitmap_off;
+	uint64_t	data_start_off;
+	uint64_t	root_bitmap_size;
+	uint64_t	root_off;
+	uint64_t	root_size;
+	uint64_t	cluster_size;
+	uint64_t	num_nodes;
+	uint64_t	num_clusters;
+	uint64_t	dir_node_size;
+	uint64_t	file_node_size;
+	uint64_t	internal_off;
+	uint64_t	node_cfg_off;
+	uint64_t	node_cfg_size;
+	uint64_t	new_cfg_off;
+	uint32_t	prot_bits;
+	int32_t		excl_mount;
+} PACKED;
+
+struct ocfs1_super_block_label {
+	struct ocfs1_disk_lock {
+		uint32_t	curr_master;
+		uint8_t		file_lock;
+		uint8_t		compat_pad[3];
+		uint64_t	last_write_time;
+		uint64_t	last_read_time;
+		uint32_t	writer_node_num;
+		uint32_t	reader_node_num;
+		uint64_t	oin_node_map;
+		uint64_t	dlock_seq_num;
+	} PACKED disk_lock;
+	uint8_t		label[64];
+	uint16_t	label_len;
+	uint8_t		vol_id[16];
+	uint16_t	vol_id_len;
+	uint8_t		cluster_name[64];
+	uint16_t	cluster_name_len;
+} PACKED;
+
+struct ocfs2_super_block {
+	uint8_t		i_signature[8];
+	uint32_t	i_generation;
+	int16_t		i_suballoc_slot;
+	uint16_t	i_suballoc_bit;
+	uint32_t	i_reserved0;
+	uint32_t	i_clusters;
+	uint32_t	i_uid;
+	uint32_t	i_gid;
+	uint64_t	i_size;
+	uint16_t	i_mode;
+	uint16_t	i_links_count;
+	uint32_t	i_flags;
+	uint64_t	i_atime;
+	uint64_t	i_ctime;
+	uint64_t	i_mtime;
+	uint64_t	i_dtime;
+	uint64_t	i_blkno;
+	uint64_t	i_last_eb_blk;
+	uint32_t	i_fs_generation;
+	uint32_t	i_atime_nsec;
+	uint32_t	i_ctime_nsec;
+	uint32_t	i_mtime_nsec;
+	uint64_t	i_reserved1[9];
+	uint64_t	i_pad1;
+	uint16_t	s_major_rev_level;
+	uint16_t	s_minor_rev_level;
+	uint16_t	s_mnt_count;
+	int16_t		s_max_mnt_count;
+	uint16_t	s_state;
+	uint16_t	s_errors;
+	uint32_t	s_checkinterval;
+	uint64_t	s_lastcheck;
+	uint32_t	s_creator_os;
+	uint32_t	s_feature_compat;
+	uint32_t	s_feature_incompat;
+	uint32_t	s_feature_ro_compat;
+	uint64_t	s_root_blkno;
+	uint64_t	s_system_dir_blkno;
+	uint32_t	s_blocksize_bits;
+	uint32_t	s_clustersize_bits;
+	uint16_t	s_max_slots;
+	uint16_t	s_reserved1;
+	uint32_t	s_reserved2;
+	uint64_t	s_first_cluster_group;
+	uint8_t		s_label[64];
+	uint8_t		s_uuid[16];
+} PACKED;
+
+int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct ocfs1_super_block_header *osh;
+	struct ocfs1_super_block_label *osl;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	osh = (struct ocfs1_super_block_header *) buf;
+	if (memcmp((char *)osh->signature, "OracleCFS", 9) != 0)
+		return -1;
+	sprintf(id->type_version, "%u.%u", osh->major_version, osh->minor_version);
+
+	dbg("found OracleCFS signature, now reading label");
+	buf = volume_id_get_buffer(id, off + 0x200, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	osl = (struct ocfs1_super_block_label *) buf;
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	if (osl->label_len <= 64) {
+		volume_id_set_label_raw(id, osl->label, 64);
+		volume_id_set_label_string(id, osl->label, 64);
+	}
+	if (osl->vol_id_len == 16)
+		volume_id_set_uuid(id, osl->vol_id, 0, UUID_DCE);
+	id->type = "ocfs";
+	return 0;
+}
+
+#define OCFS2_MAX_BLOCKSIZE		0x1000
+#define OCFS2_SUPER_BLOCK_BLKNO		2
+
+int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct ocfs2_super_block *os;
+	size_t blksize;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) {
+		buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200);
+		if (buf == NULL)
+			return -1;
+
+		os = (struct ocfs2_super_block *) buf;
+		if (memcmp((char *)os->i_signature, "OCFSV2", 6) != 0)
+			continue;
+
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		volume_id_set_label_raw(id, os->s_label, 64);
+		volume_id_set_label_string(id, os->s_label, 64);
+		volume_id_set_uuid(id, os->s_uuid, 0, UUID_DCE);
+		sprintf(id->type_version, "%u.%u", os->s_major_rev_level, os->s_minor_rev_level);
+		id->type = "ocfs2";
+		return 0;
+	}
+	return -1;
+}

=== added file 'libvolume_id/promise_raid.c'
--- grub-0.97.orig/libvolume_id/promise_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/promise_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,65 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct promise_meta {
+	uint8_t	sig[24];
+} PACKED;
+
+#define PDC_CONFIG_OFF		0x1200
+#define PDC_SIGNATURE		"Promise Technology, Inc."
+
+int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	struct promise_meta *pdc;
+	unsigned int i;
+	static unsigned int sectors[] = {
+		63, 255, 256, 16, 399, 0
+	};
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x40000)
+		return -1;
+
+	for (i = 0; sectors[i] != 0; i++) {
+		uint64_t meta_off;
+
+		meta_off = ((size / 0x200) - sectors[i]) * 0x200;
+		buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+		if (buf == NULL)
+			return -1;
+
+		pdc = (struct promise_meta *) buf;
+		if (memcmp((char *)pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0)
+			goto found;
+	}
+	return -1;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	id->type = "promise_fasttrack_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/reiserfs.c'
--- grub-0.97.orig/libvolume_id/reiserfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/reiserfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,113 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005 Tobias Klauser <tklauser@access.unizh.ch>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct reiserfs_super_block {
+	uint32_t	blocks_count;
+	uint32_t	free_blocks;
+	uint32_t	root_block;
+	uint32_t	journal_block;
+	uint32_t	journal_dev;
+	uint32_t	orig_journal_size;
+	uint32_t	dummy2[5];
+	uint16_t	blocksize;
+	uint16_t	dummy3[3];
+	uint8_t		magic[12];
+	uint32_t	dummy4[5];
+	uint8_t		uuid[16];
+	uint8_t		label[16];
+} PACKED;
+
+struct reiser4_super_block {
+	uint8_t		magic[16];
+	uint16_t	dummy[2];
+	uint8_t		uuid[16];
+	uint8_t		label[16];
+	uint64_t	dummy2;
+} PACKED;
+
+#define REISERFS1_SUPERBLOCK_OFFSET		0x2000
+#define REISERFS_SUPERBLOCK_OFFSET		0x10000
+
+int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct reiserfs_super_block *rs;
+	struct reiser4_super_block *rs4;
+	uint8_t	 *buf;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	rs = (struct reiserfs_super_block *) buf;
+	if (memcmp((char *)rs->magic, "ReIsErFs", 8) == 0) {
+		strcpy(id->type_version, "3.5");
+		id->type = "reiserfs";
+		goto found;
+	}
+	if (memcmp((char *)rs->magic, "ReIsEr2Fs", 9) == 0) {
+		strcpy(id->type_version, "3.6");
+		id->type = "reiserfs";
+		goto found_label;
+	}
+	if (memcmp((char *)rs->magic, "ReIsEr3Fs", 9) == 0) {
+		strcpy(id->type_version, "JR");
+		id->type = "reiserfs";
+		goto found_label;
+	}
+
+	rs4 = (struct reiser4_super_block *) buf;
+	if (memcmp((char *)rs4->magic, "ReIsEr4", 7) == 0) {
+		strcpy(id->type_version, "4");
+		volume_id_set_label_raw(id, rs4->label, 16);
+		volume_id_set_label_string(id, rs4->label, 16);
+		volume_id_set_uuid(id, rs4->uuid, 0, UUID_DCE);
+		id->type = "reiser4";
+		goto found;
+	}
+
+	buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	rs = (struct reiserfs_super_block *) buf;
+	if (memcmp((char *)rs->magic, "ReIsErFs", 8) == 0) {
+		strcpy(id->type_version, "3.5");
+		id->type = "reiserfs";
+		goto found;
+	}
+
+	return -1;
+
+found_label:
+	volume_id_set_label_raw(id, rs->label, 16);
+	volume_id_set_label_string(id, rs->label, 16);
+	volume_id_set_uuid(id, rs->uuid, 0, UUID_DCE);
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+
+	return 0;
+}

=== added file 'libvolume_id/romfs.c'
--- grub-0.97.orig/libvolume_id/romfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/romfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,55 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct romfs_super {
+	uint8_t magic[8];
+	uint32_t size;
+	uint32_t checksum;
+	uint8_t name[0];
+} PACKED;
+
+int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct romfs_super *rfs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200);
+	if (rfs == NULL)
+		return -1;
+
+	if (memcmp((char *)rfs->magic, "-rom1fs-", 4) == 0) {
+		size_t len = strlen((char *)rfs->name);
+
+		if (len) {
+			volume_id_set_label_raw(id, rfs->name, len);
+			volume_id_set_label_string(id, rfs->name, len);
+		}
+
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		id->type = "romfs";
+		return 0;
+	}
+
+	return -1;
+}

=== added file 'libvolume_id/silicon_raid.c'
--- grub-0.97.orig/libvolume_id/silicon_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/silicon_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,71 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct silicon_meta {
+	uint8_t		unknown0[0x2E];
+	uint8_t		ascii_version[0x36 - 0x2E];
+	uint8_t		diskname[0x56 - 0x36];
+	uint8_t		unknown1[0x60 - 0x56];
+	uint32_t	magic;
+	uint32_t	unknown1a[0x6C - 0x64];
+	uint32_t	array_sectors_low;
+	uint32_t	array_sectors_high;
+	uint8_t		unknown2[0x78 - 0x74];
+	uint32_t	thisdisk_sectors;
+	uint8_t		unknown3[0x100 - 0x7C];
+	uint8_t		unknown4[0x104 - 0x100];
+	uint16_t	product_id;
+	uint16_t	vendor_id;
+	uint16_t	minor_ver;
+	uint16_t	major_ver;
+} PACKED;
+
+#define SILICON_MAGIC		0x2F000000
+
+int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct silicon_meta *sil;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-1) * 0x200;
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	sil = (struct silicon_meta *) buf;
+	if (le32_to_cpu(sil->magic) != SILICON_MAGIC)
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	sprintf(id->type_version, "%u.%u", le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver));
+	id->type = "silicon_medley_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/squashfs.c'
--- grub-0.97.orig/libvolume_id/squashfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/squashfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,63 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define SQUASHFS_MAGIC		0x73717368
+
+struct squashfs_super {
+	uint32_t	s_magic;
+	uint32_t	inodes;
+	uint32_t	bytes_used_2;
+	uint32_t	uid_start_2;
+	uint32_t	guid_start_2;
+	uint32_t	inode_table_start_2;
+	uint32_t	directory_table_start_2;
+	uint16_t	s_major;
+	uint16_t	s_minor;
+} PACKED;
+
+int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct squashfs_super *sqs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200);
+	if (sqs == NULL)
+		return -1;
+
+	if (sqs->s_magic == SQUASHFS_MAGIC) {
+		sprintf(id->type_version, "%u.%u", sqs->s_major, sqs->s_minor);
+		goto found;
+	}
+	if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) {
+		sprintf(id->type_version, "%u.%u", bswap_16(sqs->s_major), bswap_16(sqs->s_minor));
+		goto found;
+	}
+
+	return -1;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "squashfs";
+	return 0;
+}

=== added file 'libvolume_id/strfuncs.h'
--- grub-0.97.orig/libvolume_id/strfuncs.h	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/strfuncs.h	2008-07-15 12:31:43 +0000
@@ -0,0 +1,5 @@
+
+#include <stdlib.h>
+
+size_t strnlen(const char *s, size_t limit);
+char  *strchr (const char *s, int c);

=== added file 'libvolume_id/sysv.c'
--- grub-0.97.orig/libvolume_id/sysv.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/sysv.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,128 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define SYSV_NICINOD			100
+#define SYSV_NICFREE			50
+
+struct sysv_super
+{
+	uint16_t	s_isize;
+	uint16_t	s_pad0;
+	uint32_t	s_fsize;
+	uint16_t	s_nfree;
+	uint16_t	s_pad1;
+	uint32_t	s_free[SYSV_NICFREE];
+	uint16_t	s_ninode;
+	uint16_t	s_pad2;
+	uint16_t	s_inode[SYSV_NICINOD];
+	uint8_t		s_flock;
+	uint8_t		s_ilock;
+	uint8_t		s_fmod;
+	uint8_t		s_ronly;
+	uint32_t	s_time;
+	uint16_t	s_dinfo[4];
+	uint32_t	s_tfree;
+	uint16_t	s_tinode;
+	uint16_t	s_pad3;
+	uint8_t		s_fname[6];
+	uint8_t		s_fpack[6];
+	uint32_t	s_fill[12];
+	uint32_t	s_state;
+	uint32_t	s_magic;
+	uint32_t	s_type;
+} PACKED;
+
+#define XENIX_NICINOD				100
+#define XENIX_NICFREE				100
+
+struct xenix_super {
+	uint16_t	s_isize;
+	uint32_t	s_fsize;
+	uint16_t	s_nfree;
+	uint32_t	s_free[XENIX_NICFREE];
+	uint16_t	s_ninode;
+	uint16_t	s_inode[XENIX_NICINOD];
+	uint8_t		s_flock;
+	uint8_t		s_ilock;
+	uint8_t		s_fmod;
+	uint8_t		s_ronly;
+	uint32_t	s_time;
+	uint32_t	s_tfree;
+	uint16_t	s_tinode;
+	uint16_t	s_dinfo[4];
+	uint8_t		s_fname[6];
+	uint8_t		s_fpack[6];
+	uint8_t		s_clean;
+	uint8_t		s_fill[371];
+	uint32_t	s_magic;
+	uint32_t	s_type;
+} PACKED;
+
+#define SYSV_SUPERBLOCK_BLOCK			0x01
+#define SYSV_MAGIC				0xfd187e20
+#define XENIX_SUPERBLOCK_BLOCK			0x18
+#define XENIX_MAGIC				0x2b5544
+#define SYSV_MAX_BLOCKSIZE			0x800
+
+int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct sysv_super *vs;
+	struct xenix_super *xs;
+	unsigned int boff;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) {
+		vs = (struct sysv_super *)
+			volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200);
+		if (vs == NULL)
+			return -1;
+
+		if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) {
+			volume_id_set_label_raw(id, vs->s_fname, 6);
+			volume_id_set_label_string(id, vs->s_fname, 6);
+			id->type = "sysv";
+			goto found;
+		}
+	}
+
+	for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) {
+		xs = (struct xenix_super *)
+			volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200);
+		if (xs == NULL)
+			return -1;
+
+		if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) {
+			volume_id_set_label_raw(id, xs->s_fname, 6);
+			volume_id_set_label_string(id, xs->s_fname, 6);
+			id->type = "xenix";
+			goto found;
+		}
+	}
+
+	return -1;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	return 0;
+}

=== added file 'libvolume_id/udf.c'
--- grub-0.97.orig/libvolume_id/udf.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/udf.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,173 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct volume_descriptor {
+	struct descriptor_tag {
+		uint16_t	id;
+		uint16_t	version;
+		uint8_t		checksum;
+		uint8_t		reserved;
+		uint16_t	serial;
+		uint16_t	crc;
+		uint16_t	crc_len;
+		uint32_t	location;
+	} PACKED tag;
+	union {
+		struct anchor_descriptor {
+			uint32_t	length;
+			uint32_t	location;
+		} PACKED anchor;
+		struct primary_descriptor {
+			uint32_t	seq_num;
+			uint32_t	desc_num;
+			struct dstring {
+				uint8_t	clen;
+				uint8_t	c[31];
+			} PACKED ident;
+		} PACKED primary;
+	} PACKED type;
+} PACKED;
+
+struct volume_structure_descriptor {
+	uint8_t		type;
+	uint8_t		id[5];
+	uint8_t		version;
+} PACKED;
+
+#define UDF_VSD_OFFSET			0x8000
+
+int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct volume_descriptor *vd;
+	struct volume_structure_descriptor *vsd;
+	unsigned int bs;
+	unsigned int b;
+	unsigned int type;
+	unsigned int count;
+	unsigned int loc;
+	unsigned int clen;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200);
+	if (vsd == NULL)
+		return -1;
+
+	if (memcmp((char *)vsd->id, "NSR02", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "NSR03", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "BEA01", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "BOOT2", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "CD001", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "CDW02", 5) == 0)
+		goto blocksize;
+	if (memcmp((char *)vsd->id, "TEA03", 5) == 0)
+		goto blocksize;
+	return -1;
+
+blocksize:
+	/* search the next VSD to get the logical block size of the volume */
+	for (bs = 0x800; bs < 0x8000; bs += 0x800) {
+		vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800);
+		if (vsd == NULL)
+			return -1;
+		dbg("test for blocksize: 0x%x", bs);
+		if (vsd->id[0] != '\0')
+			goto nsr;
+	}
+	return -1;
+
+nsr:
+	/* search the list of VSDs for a NSR descriptor */
+	for (b = 0; b < 64; b++) {
+		vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800);
+		if (vsd == NULL)
+			return -1;
+
+		dbg("vsd: %c%c%c%c%c",
+		    vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]);
+
+		if (vsd->id[0] == '\0')
+			return -1;
+		if (memcmp((char *)vsd->id, "NSR02", 5) == 0)
+			goto anchor;
+		if (memcmp((char *)vsd->id, "NSR03", 5) == 0)
+			goto anchor;
+	}
+	return -1;
+
+anchor:
+	/* read anchor volume descriptor */
+	vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200);
+	if (vd == NULL)
+		return -1;
+
+	type = le16_to_cpu(vd->tag.id);
+	if (type != 2) /* TAG_ID_AVDP */
+		goto found;
+
+	/* get desriptor list address and block count */
+	count = le32_to_cpu(vd->type.anchor.length) / bs;
+	loc = le32_to_cpu(vd->type.anchor.location);
+	dbg("0x%x descriptors starting at logical secor 0x%x", count, loc);
+
+	/* pick the primary descriptor from the list */
+	for (b = 0; b < count; b++) {
+		vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200);
+		if (vd == NULL)
+			return -1;
+
+		type = le16_to_cpu(vd->tag.id);
+		dbg("descriptor type %i", type);
+
+		/* check validity */
+		if (type == 0)
+			goto found;
+		if (le32_to_cpu(vd->tag.location) != loc + b)
+			goto found;
+
+		if (type == 1) /* TAG_ID_PVD */
+			goto pvd;
+	}
+	goto found;
+
+pvd:
+	volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32);
+
+	clen = vd->type.primary.ident.clen;
+	dbg("label string charsize=%i bit", clen);
+	if (clen == 8)
+		volume_id_set_label_string(id, vd->type.primary.ident.c, 31);
+	else if (clen == 16)
+		volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31);
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "udf";
+
+	return 0;
+}

=== added file 'libvolume_id/ufs.c'
--- grub-0.97.orig/libvolume_id/ufs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/ufs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,217 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct ufs_super_block {
+	uint32_t	fs_link;
+	uint32_t	fs_rlink;
+	uint32_t	fs_sblkno;
+	uint32_t	fs_cblkno;
+	uint32_t	fs_iblkno;
+	uint32_t	fs_dblkno;
+	uint32_t	fs_cgoffset;
+	uint32_t	fs_cgmask;
+	uint32_t	fs_time;
+	uint32_t	fs_size;
+	uint32_t	fs_dsize;
+	uint32_t	fs_ncg;	
+	uint32_t	fs_bsize;
+	uint32_t	fs_fsize;
+	uint32_t	fs_frag;
+	uint32_t	fs_minfree;
+	uint32_t	fs_rotdelay;
+	uint32_t	fs_rps;	
+	uint32_t	fs_bmask;
+	uint32_t	fs_fmask;
+	uint32_t	fs_bshift;
+	uint32_t	fs_fshift;
+	uint32_t	fs_maxcontig;
+	uint32_t	fs_maxbpg;
+	uint32_t	fs_fragshift;
+	uint32_t	fs_fsbtodb;
+	uint32_t	fs_sbsize;
+	uint32_t	fs_csmask;
+	uint32_t	fs_csshift;
+	uint32_t	fs_nindir;
+	uint32_t	fs_inopb;
+	uint32_t	fs_nspf;
+	uint32_t	fs_optim;
+	uint32_t	fs_npsect_state;
+	uint32_t	fs_interleave;
+	uint32_t	fs_trackskew;
+	uint32_t	fs_id[2];
+	uint32_t	fs_csaddr;
+	uint32_t	fs_cssize;
+	uint32_t	fs_cgsize;
+	uint32_t	fs_ntrak;
+	uint32_t	fs_nsect;
+	uint32_t	fs_spc;	
+	uint32_t	fs_ncyl;
+	uint32_t	fs_cpg;
+	uint32_t	fs_ipg;
+	uint32_t	fs_fpg;
+	struct ufs_csum {
+		uint32_t	cs_ndir;
+		uint32_t	cs_nbfree;
+		uint32_t	cs_nifree;
+		uint32_t	cs_nffree;
+	} PACKED fs_cstotal;
+	int8_t		fs_fmod;
+	int8_t		fs_clean;
+	int8_t		fs_ronly;
+	int8_t		fs_flags;
+	union {
+		struct {
+			int8_t	fs_fsmnt[512];
+			uint32_t	fs_cgrotor;
+			uint32_t	fs_csp[31];
+			uint32_t	fs_maxcluster;
+			uint32_t	fs_cpc;
+			uint16_t	fs_opostbl[16][8];
+		} PACKED fs_u1;
+		struct {
+			int8_t		fs_fsmnt[468];
+			uint8_t		fs_volname[32];
+			uint64_t	fs_swuid;
+			int32_t		fs_pad;
+			uint32_t	fs_cgrotor;
+			uint32_t	fs_ocsp[28];
+			uint32_t	fs_contigdirs;
+			uint32_t	fs_csp;	
+			uint32_t	fs_maxcluster;
+			uint32_t	fs_active;
+			int32_t		fs_old_cpc;
+			int32_t		fs_maxbsize;
+			int64_t		fs_sparecon64[17];
+			int64_t		fs_sblockloc;
+			struct ufs2_csum_total {
+				uint64_t	cs_ndir;
+				uint64_t	cs_nbfree;
+				uint64_t	cs_nifree;
+				uint64_t	cs_nffree;
+				uint64_t	cs_numclusters;
+				uint64_t	cs_spare[3];
+			} PACKED fs_cstotal;
+			struct ufs_timeval {
+				int32_t		tv_sec;
+				int32_t		tv_usec;
+			} PACKED fs_time;
+			int64_t		fs_size;
+			int64_t		fs_dsize;
+			uint64_t	fs_csaddr;
+			int64_t		fs_pendingblocks;
+			int32_t		fs_pendinginodes;
+		} PACKED fs_u2;
+	}  fs_u11;
+	union {
+		struct {
+			int32_t		fs_sparecon[53];
+			int32_t		fs_reclaim;
+			int32_t		fs_sparecon2[1];
+			int32_t		fs_state;
+			uint32_t	fs_qbmask[2];
+			uint32_t	fs_qfmask[2];
+		} PACKED fs_sun;
+		struct {
+			int32_t		fs_sparecon[53];
+			int32_t		fs_reclaim;
+			int32_t		fs_sparecon2[1];
+			uint32_t	fs_npsect;
+			uint32_t	fs_qbmask[2];
+			uint32_t	fs_qfmask[2];
+		} PACKED fs_sunx86;
+		struct {
+			int32_t		fs_sparecon[50];
+			int32_t		fs_contigsumsize;
+			int32_t		fs_maxsymlinklen;
+			int32_t		fs_inodefmt;
+			uint32_t	fs_maxfilesize[2];
+			uint32_t	fs_qbmask[2];
+			uint32_t	fs_qfmask[2];
+			int32_t		fs_state;
+		} PACKED fs_44;
+	} fs_u2;
+	int32_t		fs_postblformat;
+	int32_t		fs_nrpos;
+	int32_t		fs_postbloff;
+	int32_t		fs_rotbloff;
+	uint32_t	fs_magic;
+	uint8_t		fs_space[1];
+} PACKED;
+
+#define UFS_MAGIC			0x00011954
+#define UFS2_MAGIC			0x19540119
+#define UFS_MAGIC_FEA			0x00195612
+#define UFS_MAGIC_LFN			0x00095014
+
+int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	uint32_t magic;
+	int i;
+	struct ufs_super_block *ufs;
+	int offsets[] = {0, 8, 64, 256, -1};
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	for (i = 0; offsets[i] >= 0; i++) {	
+		ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800);
+		if (ufs == NULL)
+			return -1;
+
+		dbg("offset 0x%x", offsets[i] * 0x400);
+		magic = be32_to_cpu(ufs->fs_magic);
+		if ((magic == UFS_MAGIC) ||
+		    (magic == UFS2_MAGIC) ||
+		    (magic == UFS_MAGIC_FEA) ||
+		    (magic == UFS_MAGIC_LFN)) {
+			dbg("magic 0x%08x(be)", magic);
+			goto found;
+		}
+		magic = le32_to_cpu(ufs->fs_magic);
+		if ((magic == UFS_MAGIC) ||
+		    (magic == UFS2_MAGIC) ||
+		    (magic == UFS_MAGIC_FEA) ||
+		    (magic == UFS_MAGIC_LFN)) {
+			dbg("magic 0x%08x(le)", magic);
+			goto found;
+		}
+	}
+	return -1;
+
+found:
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "ufs";
+	switch (magic) {
+	case UFS_MAGIC:
+		strcpy(id->type_version, "1");
+		break;
+	case UFS2_MAGIC:
+		strcpy(id->type_version, "2");
+		volume_id_set_label_raw(id, ufs->fs_u11.fs_u2.fs_volname, 32);
+		volume_id_set_label_string(id, ufs->fs_u11.fs_u2.fs_volname, 32);
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}

=== added file 'libvolume_id/util.c'
--- grub-0.97.orig/libvolume_id/util.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/util.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,472 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "strfuncs.h"
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+static char hex[] = "0123456789abcdef";
+
+#define hexhi(val)   hex[val >> 4]
+#define hexlo(val)   hex[val & 0xf]
+
+/* count of characters used to encode one unicode char */
+static int utf8_encoded_expected_len(const char *str)
+{
+	unsigned char c = (unsigned char)str[0];
+
+	if (c < 0x80)
+		return 1;
+	if ((c & 0xe0) == 0xc0)
+		return 2;
+	if ((c & 0xf0) == 0xe0)
+		return 3;
+	if ((c & 0xf8) == 0xf0)
+		return 4;
+	if ((c & 0xfc) == 0xf8)
+		return 5;
+	if ((c & 0xfe) == 0xfc)
+		return 6;
+	return 0;
+}
+
+/* decode one unicode char */
+static int utf8_encoded_to_unichar(const char *str)
+{
+	int unichar;
+	int len;
+	int i;
+
+	len = utf8_encoded_expected_len(str);
+	switch (len) {
+	case 1:
+		return (int)str[0];
+	case 2:
+		unichar = str[0] & 0x1f;
+		break;
+	case 3:
+		unichar = (int)str[0] & 0x0f;
+		break;
+	case 4:
+		unichar = (int)str[0] & 0x07;
+		break;
+	case 5:
+		unichar = (int)str[0] & 0x03;
+		break;
+	case 6:
+		unichar = (int)str[0] & 0x01;
+		break;
+	default:
+		return -1;
+	}
+
+	for (i = 1; i < len; i++) {
+		if (((int)str[i] & 0xc0) != 0x80)
+			return -1;
+		unichar <<= 6;
+		unichar |= (int)str[i] & 0x3f;
+	}
+
+	return unichar;
+}
+
+/* expected size used to encode one unicode char */
+static int utf8_unichar_to_encoded_len(int unichar)
+{
+	if (unichar < 0x80)
+		return 1;
+	if (unichar < 0x800)
+		return 2;
+	if (unichar < 0x10000)
+		return 3;
+	if (unichar < 0x200000)
+		return 4;
+	if (unichar < 0x4000000)
+		return 5;
+	return 6;
+}
+
+/* check if unicode char has a valid numeric range */
+static int utf8_unichar_valid_range(int unichar)
+{
+	if (unichar > 0x10ffff)
+		return 0;
+	if ((unichar & 0xfffff800) == 0xd800)
+		return 0;
+	if ((unichar > 0xfdcf) && (unichar < 0xfdf0))
+		return 0;
+	if ((unichar & 0xffff) == 0xffff)
+		return 0;
+	return 1;
+}
+
+/* validate one encoded unicode char and return its length */
+int volume_id_utf8_encoded_valid_unichar(const char *str)
+{
+	int len;
+	int unichar;
+	int i;
+
+	len = utf8_encoded_expected_len(str);
+	if (len == 0)
+		return -1;
+
+	/* ascii is valid */
+	if (len == 1)
+		return 1;
+
+	/* check if expected encoded chars are available */
+	for (i = 0; i < len; i++)
+		if ((str[i] & 0x80) != 0x80)
+			return -1;
+
+	unichar = utf8_encoded_to_unichar(str);
+
+	/* check if encoded length matches encoded value */
+	if (utf8_unichar_to_encoded_len(unichar) != len)
+		return -1;
+
+	/* check if value has valid range */
+	if (!utf8_unichar_valid_range(unichar))
+		return -1;
+
+	return len;
+}
+
+size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count)
+{
+	size_t i, j;
+	uint16_t c;
+
+	j = 0;
+	for (i = 0; i + 2 <= count; i += 2) {
+		if (endianess == LE)
+			c = (buf[i+1] << 8) | buf[i];
+		else
+			c = (buf[i] << 8) | buf[i+1];
+		if (c == 0) {
+			str[j] = '\0';
+			break;
+		} else if (c < 0x80) {
+			if (j+1 >= len)
+				break;
+			str[j++] = (uint8_t) c;
+		} else if (c < 0x800) {
+			if (j+2 >= len)
+				break;
+			str[j++] = (uint8_t) (0xc0 | (c >> 6));
+			str[j++] = (uint8_t) (0x80 | (c & 0x3f));
+		} else {
+			if (j+3 >= len)
+				break;
+			str[j++] = (uint8_t) (0xe0 | (c >> 12));
+			str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f));
+			str[j++] = (uint8_t) (0x80 | (c & 0x3f));
+		}
+	}
+	str[j] = '\0';
+	return j;
+}
+
+static char *usage_to_string(enum volume_id_usage usage_id)
+{
+	switch (usage_id) {
+	case VOLUME_ID_FILESYSTEM:
+		return "filesystem";
+	case VOLUME_ID_OTHER:
+		return "other";
+	case VOLUME_ID_RAID:
+		return "raid";
+	case VOLUME_ID_DISKLABEL:
+		return "disklabel";
+	case VOLUME_ID_CRYPTO:
+		return "crypto";
+	case VOLUME_ID_UNPROBED:
+		return "unprobed";
+	case VOLUME_ID_UNUSED:
+		return "unused";
+	}
+	return NULL;
+}
+
+void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id)
+{
+	id->usage_id = usage_id;
+	id->usage = usage_to_string(usage_id);
+}
+
+void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count)
+{
+	if (count > sizeof(id->label))
+		count = sizeof(id->label);
+
+	memcpy(id->label_raw, buf, count);
+	id->label_raw_len = count;
+}
+
+void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count)
+{
+	size_t i;
+
+	if (count >= sizeof(id->label))
+		count = sizeof(id->label)-1;
+
+	memcpy(id->label, buf, count);
+	id->label[count] = '\0';
+
+	/* remove trailing whitespace */
+	i = strnlen(id->label, count);
+	while (i--) {
+		if (!isspace(id->label[i]))
+			break;
+	}
+	id->label[i+1] = '\0';
+}
+
+void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count)
+{
+	if (count >= sizeof(id->label))
+		count = sizeof(id->label)-1;
+
+	 volume_id_set_unicode16((uint8_t *)id->label, sizeof(id->label), buf, endianess, count);
+}
+
+void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format)
+{
+	unsigned int i;
+	unsigned int count = 0;
+	char *uuid;
+
+	if (len > sizeof(id->uuid_raw))
+		len = sizeof(id->uuid_raw);
+
+	switch(format) {
+	case UUID_STRING:
+		count = len;
+		break;
+	case UUID_HEX_STRING:
+		count = len;
+		break;
+	case UUID_DOS:
+		count = 4;
+		break;
+	case UUID_64BIT_LE:
+	case UUID_64BIT_BE:
+		count = 8;
+		break;
+	case UUID_DCE:
+		count = 16;
+		break;
+	case UUID_FOURINT:
+		count = 35;
+		break;
+	}
+	memcpy(id->uuid_raw, buf, count);
+	id->uuid_raw_len = count;
+
+	/* if set, create string in the same format, the native platform uses */
+	for (i = 0; i < count; i++)
+		if (buf[i] != 0)
+			goto set;
+	return;
+
+set:
+	uuid = id->uuid;
+	switch(format) {
+	case UUID_DOS:
+		*uuid++ = hexhi(buf[3]);
+		*uuid++ = hexlo(buf[3]);
+		*uuid++ = hexhi(buf[2]);
+		*uuid++ = hexlo(buf[2]);
+		*uuid++ = '-';
+		*uuid++ = hexhi(buf[1]);
+		*uuid++ = hexlo(buf[1]);
+		*uuid++ = hexhi(buf[0]);
+		*uuid++ = hexlo(buf[0]);
+		*uuid = '\0';
+		break;
+	case UUID_64BIT_LE:
+		*uuid++ = hexhi(buf[7]);
+		*uuid++ = hexlo(buf[7]);
+		*uuid++ = hexhi(buf[6]);
+		*uuid++ = hexlo(buf[6]);
+		*uuid++ = hexhi(buf[5]);
+		*uuid++ = hexlo(buf[5]);
+		*uuid++ = hexhi(buf[4]);
+		*uuid++ = hexlo(buf[4]);
+		*uuid++ = hexhi(buf[3]);
+		*uuid++ = hexlo(buf[3]);
+		*uuid++ = hexhi(buf[2]);
+		*uuid++ = hexlo(buf[2]);
+		*uuid++ = hexhi(buf[1]);
+		*uuid++ = hexlo(buf[1]);
+		*uuid++ = hexhi(buf[0]);
+		*uuid++ = hexlo(buf[0]);
+		*uuid = '\0';
+		break;
+	case UUID_64BIT_BE:
+		*uuid++ = hexhi(buf[0]);
+		*uuid++ = hexlo(buf[0]);
+		*uuid++ = hexhi(buf[1]);
+		*uuid++ = hexlo(buf[1]);
+		*uuid++ = hexhi(buf[2]);
+		*uuid++ = hexlo(buf[2]);
+		*uuid++ = hexhi(buf[3]);
+		*uuid++ = hexlo(buf[3]);
+		*uuid++ = hexhi(buf[4]);
+		*uuid++ = hexlo(buf[4]);
+		*uuid++ = hexhi(buf[5]);
+		*uuid++ = hexlo(buf[5]);
+		*uuid++ = hexhi(buf[6]);
+		*uuid++ = hexlo(buf[6]);
+		*uuid++ = hexhi(buf[7]);
+		*uuid++ = hexlo(buf[7]);
+		*uuid = '\0';
+		break;
+	case UUID_DCE:
+		*uuid++ = hexhi(buf[0]);
+		*uuid++ = hexlo(buf[0]);
+		*uuid++ = hexhi(buf[1]);
+		*uuid++ = hexlo(buf[1]);
+		*uuid++ = hexhi(buf[2]);
+		*uuid++ = hexlo(buf[2]);
+		*uuid++ = hexhi(buf[3]);
+		*uuid++ = hexlo(buf[3]);
+		*uuid++ = '-';
+		*uuid++ = hexhi(buf[4]);
+		*uuid++ = hexlo(buf[4]);
+		*uuid++ = hexhi(buf[5]);
+		*uuid++ = hexlo(buf[5]);
+		*uuid++ = '-';
+		*uuid++ = hexhi(buf[6]);
+		*uuid++ = hexlo(buf[6]);
+		*uuid++ = hexhi(buf[7]);
+		*uuid++ = hexlo(buf[7]);
+		*uuid++ = '-';
+		*uuid++ = hexhi(buf[8]);
+		*uuid++ = hexlo(buf[8]);
+		*uuid++ = hexhi(buf[9]);
+		*uuid++ = hexlo(buf[9]);
+		*uuid++ = '-';
+		*uuid++ = hexhi(buf[10]);
+		*uuid++ = hexlo(buf[10]);
+		*uuid++ = hexhi(buf[11]);
+		*uuid++ = hexlo(buf[11]);
+		*uuid++ = hexhi(buf[12]);
+		*uuid++ = hexlo(buf[12]);
+		*uuid++ = hexhi(buf[13]);
+		*uuid++ = hexlo(buf[13]);
+		*uuid++ = hexhi(buf[14]);
+		*uuid++ = hexlo(buf[14]);
+		*uuid++ = hexhi(buf[15]);
+		*uuid++ = hexlo(buf[15]);
+		*uuid = '\0';
+		break;
+	case UUID_HEX_STRING:
+		/* translate A..F to a..f */
+		memcpy(id->uuid, buf, count);
+		for (i = 0; i < count; i++)
+			if (id->uuid[i] >= 'A' && id->uuid[i] <= 'F')
+				id->uuid[i] = (id->uuid[i] - 'A') + 'a';
+		id->uuid[count] = '\0';
+		break;
+	case UUID_STRING:
+		memcpy(id->uuid, buf, count);
+		id->uuid[count] = '\0';
+		break;
+	case UUID_FOURINT:
+		*uuid++ = hexhi(buf[0]);
+		*uuid++ = hexlo(buf[0]);
+		*uuid++ = hexhi(buf[1]);
+		*uuid++ = hexlo(buf[1]);
+		*uuid++ = hexhi(buf[2]);
+		*uuid++ = hexlo(buf[2]);
+		*uuid++ = hexhi(buf[3]);
+		*uuid++ = hexlo(buf[3]);
+		*uuid++ = ':';
+		*uuid++ = hexhi(buf[4]);
+		*uuid++ = hexlo(buf[4]);
+		*uuid++ = hexhi(buf[5]);
+		*uuid++ = hexlo(buf[5]);
+		*uuid++ = hexhi(buf[6]);
+		*uuid++ = hexlo(buf[6]);
+		*uuid++ = hexhi(buf[7]);
+		*uuid++ = hexlo(buf[7]);
+		*uuid++ = ':';
+		*uuid++ = hexhi(buf[8]);
+		*uuid++ = hexlo(buf[8]);
+		*uuid++ = hexhi(buf[9]);
+		*uuid++ = hexlo(buf[9]);
+		*uuid++ = hexhi(buf[10]);
+		*uuid++ = hexlo(buf[10]);
+		*uuid++ = hexhi(buf[11]);
+		*uuid++ = hexlo(buf[11]);
+		*uuid++ = ':';
+		*uuid++ = hexhi(buf[12]);
+		*uuid++ = hexlo(buf[12]);
+		*uuid++ = hexhi(buf[13]);
+		*uuid++ = hexlo(buf[13]);
+		*uuid++ = hexhi(buf[14]);
+		*uuid++ = hexlo(buf[14]);
+		*uuid++ = hexhi(buf[15]);
+		*uuid++ = hexlo(buf[15]);
+		*uuid = '\0';
+		break;
+	default:
+		*uuid = '\0';
+		break;
+	}
+}
+
+uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
+{
+	info("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len);
+	/* check if requested area fits in superblock buffer */
+	if (off + len <= SB_BUFFER_SIZE) {
+		/* check if we need to read */
+		if ((off + len) > id->sbbuf_len) {
+			if (devread (0, 0, off + len, (char*)id->sbbuf) == 0)
+                        {
+				return NULL;
+                        }
+			id->sbbuf_len = off + len;
+		}
+		return &(id->sbbuf[off]);
+	} else {
+		if (len > SEEK_BUFFER_SIZE) {
+			dbg("seek buffer too small %d", SEEK_BUFFER_SIZE);
+			return NULL;
+		}
+
+		/* check if we need to read */
+		if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) {
+			info("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len);
+			if (devread(off >> 9, off & 0x1ff, len, (char*)id->seekbuf) == 0)
+			{
+				return NULL;
+			}
+			id->seekbuf_off = off;
+			id->seekbuf_len = len;
+		}
+		return &(id->seekbuf[off - id->seekbuf_off]);
+	}
+}

=== added file 'libvolume_id/util.h'
--- grub-0.97.orig/libvolume_id/util.h	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/util.h	2008-07-15 12:31:43 +0000
@@ -0,0 +1,98 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _VOLUME_ID_UTIL_
+#define _VOLUME_ID_UTIL_
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <endian.h>
+#include <byteswap.h>
+#include <syslog.h>
+
+#define ALLOWED_CHARS				"#+-.:=@_"
+
+#ifndef PACKED
+#define PACKED				__attribute__((packed))
+#endif
+
+#define err(format, arg...)	volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg)
+#ifdef INFO
+#define info(format, arg...)	volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg)
+#else
+#define info(format, arg...)    do { } while (0)
+#endif
+
+#ifdef DEBUG
+#define dbg(format, arg...)	volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg)
+#else
+#define dbg(format, arg...)	do { } while (0)
+#endif
+
+/* size of superblock buffer, reiserfs block is at 64k */
+#define SB_BUFFER_SIZE				0x11000
+/* size of seek buffer, FAT cluster is 32k max */
+#define SEEK_BUFFER_SIZE			0x10000
+
+#ifdef __BYTE_ORDER
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#define le16_to_cpu(x) (x)
+#define le32_to_cpu(x) (x)
+#define le64_to_cpu(x) (x)
+#define be16_to_cpu(x) bswap_16(x)
+#define be32_to_cpu(x) bswap_32(x)
+#define cpu_to_le16(x) (x)
+#define cpu_to_le32(x) (x)
+#define cpu_to_be32(x) bswap_32(x)
+#elif (__BYTE_ORDER == __BIG_ENDIAN)
+#define le16_to_cpu(x) bswap_16(x)
+#define le32_to_cpu(x) bswap_32(x)
+#define le64_to_cpu(x) bswap_64(x)
+#define be16_to_cpu(x) (x)
+#define be32_to_cpu(x) (x)
+#define cpu_to_le16(x) bswap_16(x)
+#define cpu_to_le32(x) bswap_32(x)
+#define cpu_to_be32(x) (x)
+#endif
+#endif /* __BYTE_ORDER */
+
+enum uuid_format {
+	UUID_STRING,
+	UUID_HEX_STRING,
+	UUID_DCE,
+	UUID_DOS,
+	UUID_64BIT_LE,
+	UUID_64BIT_BE,
+	UUID_FOURINT,
+};
+
+enum endian {
+	LE = 0,
+	BE = 1
+};
+
+extern int volume_id_utf8_encoded_valid_unichar(const char *str);
+extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count);
+extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id);
+extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count);
+extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count);
+extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count);
+extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format);
+extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len);
+extern void volume_id_free_buffer(struct volume_id *id);
+
+#endif /* _VOLUME_ID_UTIL_ */
+

=== added file 'libvolume_id/via_raid.c'
--- grub-0.97.orig/libvolume_id/via_raid.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/via_raid.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,88 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ * Based on information taken from dmraid:
+ * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct via_meta {
+	uint16_t	signature;
+	uint8_t		version_number;
+	struct via_array {
+		uint16_t	disk_bit_mask;
+		uint8_t		disk_array_ex;
+		uint32_t	capacity_low;
+		uint32_t	capacity_high;
+		uint32_t	serial_checksum;
+	} PACKED array;
+	uint32_t	serial_checksum[8];
+	uint8_t		checksum;
+} PACKED;
+
+#define VIA_SIGNATURE		0xAA55
+
+/* 8 bit checksum on first 50 bytes of metadata. */
+static uint8_t meta_checksum(struct via_meta *via)
+{
+	uint8_t i = 50, sum = 0;
+
+	while (i--)
+		sum += ((uint8_t*) via)[i];
+
+	return sum == via->checksum;
+}
+
+
+int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	const uint8_t *buf;
+	uint64_t meta_off;
+	struct via_meta *via;
+
+	dbg("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	if (size < 0x10000)
+		return -1;
+
+	meta_off = ((size / 0x200)-1) * 0x200;
+
+	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	via = (struct via_meta *) buf;
+	if (le16_to_cpu(via->signature) !=  VIA_SIGNATURE)
+		return -1;
+
+	if (via->version_number > 1)
+		return -1;
+
+	if (!meta_checksum(via))
+		return -1;
+
+	volume_id_set_usage(id, VOLUME_ID_RAID);
+	sprintf(id->type_version, "%u", via->version_number);
+	id->type = "via_raid_member";
+
+	return 0;
+}

=== added file 'libvolume_id/volume_id.c'
--- grub-0.97.orig/libvolume_id/volume_id.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/volume_id.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,222 @@
+/*
+ * volume_id - reads volume label and uuid
+ *
+ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
+ * Grub Port, Copyright (C) 2008 Canonical Ltd.
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include "volume_id.h"
+#include "util.h"
+#include "strfuncs.h"
+#include "shared.h"
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+struct prober {
+	volume_id_probe_fn_t prober;
+	const char *name[4];
+};
+
+#define NOT_SUPPORTED(x)	
+#define SUPPORTED(x)	x
+
+static const struct prober prober_raid[] = {
+	{ volume_id_probe_ddf_raid, { "ddf_raid", } },
+
+	/* { volume_id_probe_linux_raid, { "linux_raid", } },  */
+	/* { volume_id_probe_intel_software_raid, { "isw_raid", } }, */
+	/* { volume_id_probe_lsi_mega_raid, { "lsi_mega_raid", } }, */
+	/* { volume_id_probe_via_raid, { "via_raid", } }, */
+	/* { volume_id_probe_silicon_medley_raid, { "silicon_medley_raid", } }, */
+	/* { volume_id_probe_nvidia_raid, { "nvidia_raid", } }, */
+	/* { volume_id_probe_promise_fasttrack_raid, { "promise_fasttrack_raid", } }, */
+	/* { volume_id_probe_highpoint_45x_raid, { "highpoint_raid", } }, */
+	/* { volume_id_probe_adaptec_raid, { "adaptec_raid", } }, */
+	/* { volume_id_probe_jmicron_raid, { "jmicron_raid", } }, */
+	/* { volume_id_probe_lvm1, { "lvm1", } }, */
+	/* { volume_id_probe_lvm2, { "lvm2", } }, */
+	/* { volume_id_probe_highpoint_37x_raid, { "highpoint_raid", } }, */
+};
+
+static const struct prober prober_filesystem[] = {
+	{ volume_id_probe_vfat, { "vfat", } }, 
+	{ volume_id_probe_luks, { "luks", } }, 
+	{ volume_id_probe_xfs, { "xfs", } }, 
+	{ volume_id_probe_ext, { "ext2", "ext3", "jbd", } }, 
+	{ volume_id_probe_reiserfs, { "reiserfs", "reiser4", } }, 
+	{ volume_id_probe_jfs, { "jfs", } }, 
+	{ volume_id_probe_hfs_hfsplus, { "hfs", "hfsplus", } }, 
+	{ volume_id_probe_ntfs, { "ntfs", } },
+ 	{ volume_id_probe_ocfs1, { "ocfs1", } },
+	{ volume_id_probe_ocfs2, { "ocfs2", } }, 
+
+	/* { volume_id_probe_linux_swap, { "swap", } }, */
+	/* { volume_id_probe_udf, { "udf", } }, */
+	/* { volume_id_probe_iso9660, { "iso9660", } }, */
+	/* { volume_id_probe_ufs, { "ufs", } },  */
+	/* { volume_id_probe_cramfs, { "cramfs", } }, */
+	/* { volume_id_probe_romfs, { "romfs", } }, */
+	/* { volume_id_probe_hpfs, { "hpfs", } }, */
+	/* { volume_id_probe_sysv, { "sysv", "xenix", } }, */
+	/* { volume_id_probe_minix, { "minix",  } }, */
+	/* { volume_id_probe_vxfs, { "vxfs", } }, */
+	/* { volume_id_probe_squashfs, { "squashfs", } }, */
+	/* { volume_id_probe_netware, { "netware", } }, */
+};
+
+/* the user can overwrite this log function */
+static void default_log(int priority, const char *file, int line, const char *format, ...)
+{
+	return;
+}
+
+volume_id_log_fn_t volume_id_log_fn = default_log;
+
+/**
+ * volume_id_get_type:
+ * @id: Probing context
+ * @type: Type string. Must not be freed by the caller.
+ *
+ * Get the type string after a successful probe.
+ *
+ * Returns: 1 if the value was set, 0 otherwise.
+ **/
+int volume_id_get_type(struct volume_id *id, const char **type)
+{
+	if (id == NULL)
+		return 0;
+	if (type == NULL)
+		return 0;
+	if (id->usage_id == VOLUME_ID_UNUSED)
+		return 0;
+
+	*type = id->type;
+	return 1;
+}
+
+
+/**
+ * volume_id_get_uuid:
+ * @id: Probing context.
+ * @uuid: UUID string. Must not be freed by the caller.
+ *
+ * Get the raw UUID string after a successful probe.
+ *
+ * Returns: 1 if the value was set, 0 otherwise.
+ **/
+int volume_id_get_uuid(struct volume_id *id, const char **uuid)
+{
+	if (id == NULL)
+		return 0;
+	if (uuid == NULL)
+		return 0;
+	if (id->usage_id == VOLUME_ID_UNUSED)
+		return 0;
+
+	*uuid = id->uuid;
+	return 1;
+}
+
+/**
+ * volume_id_probe_raid:
+ * @id: Probing context.
+ * @off: Probing offset relative to the start of the device.
+ * @size: Total size of the device.
+ *
+ * Probe device for all known raid signatures.
+ *
+ * Returns: 0 on successful probe, otherwise negative value.
+ **/
+int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	unsigned int i;
+
+	if (id == NULL)
+		return -1;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	for (i = 0; i < ARRAY_SIZE(prober_raid); i++)
+		if (prober_raid[i].prober(id, off, size) == 0)
+			goto found;
+	return -1;
+
+found:
+	return 0;
+}
+
+/**
+ * volume_id_probe_filesystem:
+ * @id: Probing context.
+ * @off: Probing offset relative to the start of the device.
+ * @size: Total size of the device.
+ *
+ * Probe device for all known filesystem signatures.
+ *
+ * Returns: 0 on successful probe, otherwise negative value.
+ **/
+int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	unsigned int i;
+
+	if (id == NULL)
+		return -1;
+
+	info("probing at offset 0x%llx, size 0x%llx",
+	    (unsigned long long) off, (unsigned long long) size);
+
+	for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++)
+		if (prober_filesystem[i].prober(id, off, size) == 0)
+			goto found;
+	return -1;
+
+found:
+	return 0;
+}
+
+/**
+ * volume_id_probe_raid:
+ * @all_probers_fn: prober function to called for all known probing routines.
+ * @id: Context passed to prober function.
+ * @off: Offset value passed to prober function.
+ * @size: Size value passed to prober function.
+ * @data: Arbitrary data passed to the prober function.
+ *
+ * Run a custom function for all known probing routines.
+ **/
+void volume_id_all_probers(all_probers_fn_t all_probers_fn,
+			   struct volume_id *id, uint64_t off, uint64_t size,
+			   void *data)
+{
+	unsigned int i;
+
+	if (all_probers_fn == NULL)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(prober_raid); i++) {	
+		if (all_probers_fn(prober_raid[i].prober, id, off, size, data) != 0)
+			goto out;
+	}
+	for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) {
+		if (all_probers_fn(prober_filesystem[i].prober, id, off, size, data) != 0)
+			goto out;
+	}
+out:
+	return;
+}

=== added file 'libvolume_id/volume_id.h'
--- grub-0.97.orig/libvolume_id/volume_id.h	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/volume_id.h	2008-07-15 12:31:43 +0000
@@ -0,0 +1,137 @@
+/*
+ * volume_id - reads volume label and uuid
+ *
+ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _LIBVOLUME_ID_H_
+#define _LIBVOLUME_ID_H_
+
+#include <stdint.h>
+#include <stddef.h>
+
+typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) ;
+
+extern volume_id_log_fn_t volume_id_log_fn;
+
+struct volume_id;
+typedef int (*volume_id_probe_fn_t)(struct volume_id *id, uint64_t off, uint64_t size);
+typedef int (*all_probers_fn_t)(volume_id_probe_fn_t probe_fn,
+				struct volume_id *id, uint64_t off, uint64_t size,
+				void *data);
+
+extern struct volume_id *volume_id_open_fd(int fd);
+extern void volume_id_close(struct volume_id *id);
+extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size);
+extern const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type);
+extern void volume_id_all_probers(all_probers_fn_t all_probers_fn,
+				  struct volume_id *id, uint64_t off, uint64_t size,
+				  void *data);
+extern int volume_id_get_label(struct volume_id *id, const char **label);
+extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len);
+extern int volume_id_get_uuid(struct volume_id *id, const char **uuid);
+extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len);
+extern int volume_id_get_usage(struct volume_id *id, const char **usage);
+extern int volume_id_get_type(struct volume_id *id, const char **type);
+extern int volume_id_get_type_version(struct volume_id *id, const char **type_version);
+extern int volume_id_encode_string(const char *str, char *str_enc, size_t len);
+
+/*
+ * Note: everything below will be made private or removed from
+ * a future version, and a new major release of libvolume_id
+ */
+
+extern struct volume_id *volume_id_open_node(const char *path);
+
+#define VOLUME_ID_LABEL_SIZE		64
+#define VOLUME_ID_UUID_SIZE		36
+#define VOLUME_ID_FORMAT_SIZE		32
+#define VOLUME_ID_PATH_MAX		256
+#define VOLUME_ID_PARTITIONS_MAX	256
+
+enum volume_id_usage {
+	VOLUME_ID_UNUSED,
+	VOLUME_ID_UNPROBED,
+	VOLUME_ID_OTHER,
+	VOLUME_ID_FILESYSTEM,
+	VOLUME_ID_RAID,
+	VOLUME_ID_DISKLABEL,
+	VOLUME_ID_CRYPTO,
+};
+
+#include <util.h>
+
+struct volume_id {
+	uint8_t		label_raw[VOLUME_ID_LABEL_SIZE];
+	size_t		label_raw_len;
+	char		label[VOLUME_ID_LABEL_SIZE+1];
+	uint8_t		uuid_raw[VOLUME_ID_UUID_SIZE];
+	size_t		uuid_raw_len;
+	char		uuid[VOLUME_ID_UUID_SIZE+1];
+	enum		volume_id_usage usage_id;
+	char		*usage;
+	char		*type;
+	char		type_version[VOLUME_ID_FORMAT_SIZE];
+
+	int		fd;
+	uint8_t		sbbuf[SB_BUFFER_SIZE];
+	size_t		sbbuf_len;
+	uint8_t		seekbuf[SEEK_BUFFER_SIZE];
+	uint64_t	seekbuf_off;
+	size_t		seekbuf_len;
+	int		fd_close:1;
+};
+
+/* filesystems */
+extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size);
+
+/* special formats */
+extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size);
+
+/* raid */
+extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size);
+
+/* bios raid */
+extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size);
+
+#endif

=== added file 'libvolume_id/vxfs.c'
--- grub-0.97.orig/libvolume_id/vxfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/vxfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,49 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+#define VXFS_SUPER_MAGIC	0xa501FCF5
+
+struct vxfs_super {
+	uint32_t		vs_magic;
+	int32_t			vs_version;
+} PACKED;
+
+int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct vxfs_super *vxs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200);
+	if (vxs == NULL)
+		return -1;
+
+	if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) {
+		sprintf(id->type_version, "%u", (unsigned int) vxs->vs_version);
+		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+		id->type = "vxfs";
+		return 0;
+	}
+
+	return -1;
+}

=== added file 'libvolume_id/xfs.c'
--- grub-0.97.orig/libvolume_id/xfs.c	1970-01-01 00:00:00 +0000
+++ grub-0.97/libvolume_id/xfs.c	2008-07-15 12:31:43 +0000
@@ -0,0 +1,59 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ *	This program is free software; you can redistribute it and/or modify it
+ *	under the terms of the GNU General Public License as published by the
+ *	Free Software Foundation version 2 of the License.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "volume_id.h"
+#include "util.h"
+#include "shared.h"
+
+struct xfs_super_block {
+	uint8_t	magic[4];
+	uint32_t	blocksize;
+	uint64_t	dblocks;
+	uint64_t	rblocks;
+	uint32_t	dummy1[2];
+	uint8_t	uuid[16];
+	uint32_t	dummy2[15];
+	uint8_t	fname[12];
+	uint32_t	dummy3[2];
+	uint64_t	icount;
+	uint64_t	ifree;
+	uint64_t	fdblocks;
+} PACKED;
+
+int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	struct xfs_super_block *xs;
+
+	info("probing at offset 0x%llx", (unsigned long long) off);
+
+	xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200);
+	if (xs == NULL)
+		return -1;
+
+	if (memcmp((char *)xs->magic, "XFSB", 4) != 0)
+		return -1;
+
+	volume_id_set_label_raw(id, xs->fname, 12);
+	volume_id_set_label_string(id, xs->fname, 12);
+	volume_id_set_uuid(id, xs->uuid, 0, UUID_DCE);
+
+	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+	id->type = "xfs";
+
+	return 0;
+}

=== modified file 'stage2/Makefile.am'
--- grub-0.97.orig/stage2/Makefile.am	2005-02-02 20:40:05 +0000
+++ grub-0.97/stage2/Makefile.am	2008-07-09 17:23:44 +0000
@@ -13,6 +13,10 @@
 # For <stage1.h>.
 INCLUDES = -I$(top_srcdir)/stage1
 
+if UUID_SUPPORT
+INCLUDES += -I$(top_srcdir)/libvolume_id
+endif
+
 # The library for /sbin/grub.
 noinst_LIBRARIES = libgrub.a
 libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
@@ -61,6 +65,12 @@
 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
 START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
 
+if UUID_SUPPORT
+UUID_FLAGS = -DSUPPORT_UUID=1
+else
+UUID_FLAGS =
+endif
+
 if NETBOOT_SUPPORT
 NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
 else
@@ -82,6 +92,8 @@
 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
 	$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
 
+STAGE2_COMPILE += $(UUID_FLAGS)
+
 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
 
@@ -97,7 +109,12 @@
 
 if NETBOOT_SUPPORT
 pre_stage2_exec_LDADD = ../netboot/libdrivers.a
-endif
+else
+if UUID_SUPPORT
+pre_stage2_exec_LDADD = ../libvolume_id/libvolume_id.a
+endif
+endif
+
 
 if DISKLESS_SUPPORT
 BUILT_SOURCES = stage2_size.h diskless_size.h

=== modified file 'stage2/builtins.c'
--- grub-0.97.orig/stage2/builtins.c	2008-01-28 18:15:31 +0000
+++ grub-0.97/stage2/builtins.c	2008-07-09 17:23:44 +0000
@@ -49,6 +49,10 @@
 # include <md5.h>
 #endif
 
+#ifdef SUPPORT_UUID
+#include <volume_id.h>
+#endif
+
 /* The type of kernel loaded.  */
 kernel_t kernel_type;
 /* The boot device.  */
@@ -4790,6 +4794,168 @@
   "Probe VBE information. If the mode number MODE is specified, show only"
   " the information about only the mode."
 };
+
+
+
+#ifdef SUPPORT_UUID
+
+struct uuid_callback_data
+{
+   int  found;	/* 1 if uuid matches */
+   char *uuid;  /* uuid to look for */
+};
+
+static void uuid_info_print(struct volume_id *id, const char *uuid)
+{
+  const char *type;
+  int i;
+
+  volume_id_get_type(id, &type);
+  grub_printf("(hd%d", current_drive - 0x80);
+  if ((current_partition & 0xFF0000) != 0xFF0000)
+    {
+      grub_printf (",%d", (current_partition >> 16) & 0xFF);
+    }
+  if ((current_partition & 0x00FF00) != 0x00FF00)
+    {
+      grub_printf (",%c", 'a' + ((current_partition >> 8) & 0xFF));
+    }
+  grub_printf(") %s",type);
+  for (i=0;i<6-strlen(type);i++)
+    {
+      grub_putchar(' ');
+    }
+  grub_printf(" %s\n",uuid);
+}
+
+static int uuid_all_probers(volume_id_probe_fn_t probe_fn,
+                            struct volume_id *id, 
+			    uint64_t off, 
+			    uint64_t size, 
+			    void *data)
+{
+  struct uuid_callback_data *uc_data = (struct uuid_callback_data*)data;
+
+  if (probe_fn(id, off, size) == 0)
+    {
+      const char *volume_uuid;
+      if (volume_id_get_uuid(id, &volume_uuid)) 
+        {
+          if (!*(uc_data->uuid))
+            { 
+              uuid_info_print(id, volume_uuid);
+            }
+          else
+           {
+              if (strcmp(volume_uuid, uc_data->uuid) == 0) 
+                {
+                  grub_printf("Boot from ");
+                  uuid_info_print(id, volume_uuid);
+                  uc_data->found = 1;
+                  return 1;
+                }
+            }
+        }
+    }
+  return 0;
+}
+
+/* uuid find */
+/* Search for the uuid arg in all of partitions.  */
+static int
+uuid_func(char *arg, int flag)
+{
+  unsigned long drive;
+  unsigned long tmp_drive = saved_drive;
+  unsigned long tmp_partition = saved_partition;
+  struct uuid_callback_data uc_data;
+
+  uc_data.uuid = arg;
+  uc_data.found = 0;
+
+  /* Just hard disks and USB drives supported by BIOS  */
+  for (drive = 0x80; drive < 0x88; drive++)
+    {
+      unsigned long part = 0xFFFFFF;
+      unsigned long start, len, offset, ext_offset, gpt_offset;
+      int type, entry, gpt_count, gpt_size;
+      char *buf = (char *) RAW_ADDR(0x100000);
+      struct volume_id *vol_id = (struct volume_id *) RAW_ADDR (0x100000 + SECTOR_SIZE);
+
+      current_drive = drive;
+      while (next_partition (drive, 0xFFFFFF, &part, &type,
+			     &start, &len, &offset, &entry,
+			     &ext_offset, &gpt_offset,
+			     &gpt_count, &gpt_size, buf))
+	{
+	  if (type != PC_SLICE_TYPE_NONE
+	      && ! IS_PC_SLICE_TYPE_BSD (type)
+	      && ! IS_PC_SLICE_TYPE_EXTENDED (type))
+	    {
+	      current_partition = part;
+              errnum = ERR_NONE;
+              /* Attempt to open device, conventional way */
+              if (! open_device ())
+                {
+                  errnum = ERR_NONE;
+                  /* Failed, like NTFS or FAT filesystems, so try the rootnoverify way */
+                  if (open_partition ())
+                    {
+                      set_bootdev (0);
+                      if (errnum)
+                        {
+                          /* Give up */
+                          errnum = ERR_NONE;
+                          continue;
+                        }
+                    }
+                }
+
+              /* And probe for uuid across all fs types */
+              saved_drive = current_drive;
+              saved_partition = current_partition;
+		
+              grub_memset(vol_id, 0, sizeof(struct volume_id) );
+              volume_id_all_probers(uuid_all_probers, vol_id, 0, len, (void*)&uc_data);
+              if (uc_data.found)
+                {
+                  /* Success! */
+                  errnum = ERR_NONE;
+                  return 0;
+                }
+	    }
+	  /* We want to ignore any error here.  */
+	  errnum = ERR_NONE;
+	}
+
+      /* next_partition always sets ERRNUM in the last call, so clear it.  */
+      errnum = ERR_NONE;
+    }
+
+  saved_drive = tmp_drive;
+  saved_partition = tmp_partition;
+  current_drive = GRUB_INVALID_DRIVE;
+  current_partition = 0xFFFFFF;
+  errnum = ERR_FILE_NOT_FOUND;
+
+  if (!*arg) 
+    {
+      errnum = ERR_NONE;
+      return 0;
+    }
+  return 1;
+}
+
+static struct builtin builtin_uuid =
+{
+  "uuid",
+  uuid_func,
+  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+  "uuid UUID",
+  "Set the current \"root device\" to the device with the uuid UUID,"
+  " then attempt to mount it"
+};
+#endif
   
 
 /* The table of builtin commands. Sorted in dictionary order.  */
@@ -4879,6 +5045,9 @@
   &builtin_title,
   &builtin_unhide,
   &builtin_uppermem,
+#ifdef SUPPORT_UUID
+  &builtin_uuid,
+#endif
   &builtin_vbeprobe,
   0
 };