mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-29 02:31:05 +00:00
Compare commits
804
Commits
1.98
..
grub-legacy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
125f436763 | ||
|
|
3af093a503 | ||
|
|
9a43953b56 | ||
|
|
8dbf5c8999 | ||
|
|
e8b13ced38 | ||
|
|
f557cee7dc | ||
|
|
53f9ac3175 | ||
|
|
89e617e847 | ||
|
|
bf0c591485 | ||
|
|
ea8f03e60c | ||
|
|
193d1e43d9 | ||
|
|
508a5c4f33 | ||
|
|
6cd4433d3e | ||
|
|
fe11b298f6 | ||
|
|
bce46bf7f1 | ||
|
|
22cd659922 | ||
|
|
1d99c80935 | ||
|
|
c819ffee91 | ||
|
|
79a9f283de | ||
|
|
2ba51692ac | ||
|
|
005098fb1b | ||
|
|
bde9a318fb | ||
|
|
5ac9679fb0 | ||
|
|
7a1b51024a | ||
|
|
b8aa16f505 | ||
|
|
8e68069b48 | ||
|
|
4fe8c0ccf6 | ||
|
|
4ace38464e | ||
|
|
8a4848921a | ||
|
|
8932e40756 | ||
|
|
6d8ace6ee5 | ||
|
|
07741fe577 | ||
|
|
1499969120 | ||
|
|
2b55611a79 | ||
|
|
1262b6e7ef | ||
|
|
6884fee4be | ||
|
|
2b7a7354d9 | ||
|
|
f307cbf7c6 | ||
|
|
257fff664f | ||
|
|
041e243877 | ||
|
|
fb908db4ad | ||
|
|
660e9c195f | ||
|
|
ac1ef04cde | ||
|
|
eb5d4d6776 | ||
|
|
cce5686ea2 | ||
|
|
4022b1bcb5 | ||
|
|
8243a69201 | ||
|
|
577b70d724 | ||
|
|
16ca69f719 | ||
|
|
255d37589f | ||
|
|
31831d933f | ||
|
|
e92d461e1c | ||
|
|
b929761836 | ||
|
|
01eb2cd1f4 | ||
|
|
b84bec9188 | ||
|
|
5b5f6dc772 | ||
|
|
e15e075464 | ||
|
|
5b00a4c20d | ||
|
|
4d4f67b1af | ||
|
|
e86d8458da | ||
|
|
3a65add281 | ||
|
|
e43909c66d | ||
|
|
31def8459d | ||
|
|
12ce4272ee | ||
|
|
dc8bf1d248 | ||
|
|
7b676b85ea | ||
|
|
6355ac9d94 | ||
|
|
3fa2fbb8bd | ||
|
|
84fbf16f40 | ||
|
|
50396703ad | ||
|
|
6525b81507 | ||
|
|
11902433a2 | ||
|
|
fcac0d870d | ||
|
|
3316fed9db | ||
|
|
b9d0cc9dcf | ||
|
|
5d759a9d09 | ||
|
|
caa7c3508b | ||
|
|
de89ab8289 | ||
|
|
4e69adb6ab | ||
|
|
0accb2cab8 | ||
|
|
065f6e0a20 | ||
|
|
4f29a8af45 | ||
|
|
a1d48b992f | ||
|
|
7b43bbe40e | ||
|
|
b42b9b7e22 | ||
|
|
9b1392428c | ||
|
|
8f31d2ff88 | ||
|
|
54566a13ae | ||
|
|
36caa9beb0 | ||
|
|
2524288202 | ||
|
|
dcf4389bde | ||
|
|
469abceb70 | ||
|
|
7b7b9a3f1b | ||
|
|
a756a4a485 | ||
|
|
19f1b8c40b | ||
|
|
d58ebbc94c | ||
|
|
2269fa15f8 | ||
|
|
36ccd040ac | ||
|
|
6e7a81f3aa | ||
|
|
d1d9022b1f | ||
|
|
3b2816320b | ||
|
|
49597fd5cb | ||
|
|
7899a91337 | ||
|
|
e8911332da | ||
|
|
4db8e630b4 | ||
|
|
e4dc4ce8a5 | ||
|
|
3c9fc981a2 | ||
|
|
2e08dad5a8 | ||
|
|
cc1da3b822 | ||
|
|
0c05e9955d | ||
|
|
bbed85e657 | ||
|
|
25fee2345c | ||
|
|
fc2a2dc3d7 | ||
|
|
7c7f8f73ea | ||
|
|
6194afc326 | ||
|
|
4e64061a42 | ||
|
|
00cdabfa51 | ||
|
|
61b109a5ca | ||
|
|
d8544dae43 | ||
|
|
7dd44efcfa | ||
|
|
90537aaed7 | ||
|
|
5eebfaf282 | ||
|
|
0151ef5e78 | ||
|
|
703e8d6852 | ||
|
|
cf4f0a7199 | ||
|
|
df002327f6 | ||
|
|
cd23d85031 | ||
|
|
da7278fc6d | ||
|
|
3e41ca492a | ||
|
|
756934392a | ||
|
|
47bd75581e | ||
|
|
f91040a45f | ||
|
|
e60b85f661 | ||
|
|
53673d9532 | ||
|
|
7c1993fc4c | ||
|
|
6ced081a2d | ||
|
|
ee9202997b | ||
|
|
f8111d3b54 | ||
|
|
631d47d206 | ||
|
|
b27b4d206d | ||
|
|
3ca7f4621f | ||
|
|
3217288404 | ||
|
|
ad2df4cd66 | ||
|
|
772e28b8c2 | ||
|
|
c18257ea65 | ||
|
|
58b292f419 | ||
|
|
0a57f3c3fd | ||
|
|
3201624b93 | ||
|
|
3ff3b071ea | ||
|
|
bf88d91883 | ||
|
|
f5bc93e4de | ||
|
|
a44e6361bc | ||
|
|
6ebab1bf0b | ||
|
|
76deb4cec4 | ||
|
|
ca305dc1b1 | ||
|
|
2c48c7472d | ||
|
|
f891c6f7e4 | ||
|
|
cba84c4d9c | ||
|
|
36ae96d649 | ||
|
|
c97b7d2098 | ||
|
|
7c16231fec | ||
|
|
e184c99216 | ||
|
|
d932c071e9 | ||
|
|
51955d52d8 | ||
|
|
f8b4503f1b | ||
|
|
80d0f93b30 | ||
|
|
1548282786 | ||
|
|
4fcd549f56 | ||
|
|
321b3d6a1d | ||
|
|
1e42fdd201 | ||
|
|
05202f5eb0 | ||
|
|
d53e46f0a9 | ||
|
|
f711a2453a | ||
|
|
fada891e5c | ||
|
|
52c5e2e399 | ||
|
|
e2a3acbed0 | ||
|
|
c628bca2ae | ||
|
|
86dbc3fcbc | ||
|
|
24bd9d82c1 | ||
|
|
eaf934e523 | ||
|
|
2369202e83 | ||
|
|
9ab2360b15 | ||
|
|
afbae72a33 | ||
|
|
970554010c | ||
|
|
db6d85e1ff | ||
|
|
c65ae440c8 | ||
|
|
4339b22d7a | ||
|
|
58a5878421 | ||
|
|
fe3f7e4580 | ||
|
|
b225b42f05 | ||
|
|
f90c3eaf90 | ||
|
|
58703b663c | ||
|
|
2364cf3673 | ||
|
|
1ed089ed1a | ||
|
|
522de743e8 | ||
|
|
20ac296c28 | ||
|
|
73d5c0f09c | ||
|
|
6d4bf545d3 | ||
|
|
bd9abb21c5 | ||
|
|
cc7647f7d5 | ||
|
|
b687a97ef2 | ||
|
|
e6e09deced | ||
|
|
204a870ff7 | ||
|
|
d6f4c1c620 | ||
|
|
86d5582ec2 | ||
|
|
cfce0b1fae | ||
|
|
4c73310092 | ||
|
|
a5ef4c14d6 | ||
|
|
0c8552cfae | ||
|
|
b7f9f38e29 | ||
|
|
dde92f1985 | ||
|
|
30ec0405c4 | ||
|
|
3c5148ff24 | ||
|
|
dfccfe6d92 | ||
|
|
a751da838c | ||
|
|
c34bb04818 | ||
|
|
479bc51947 | ||
|
|
b0c95fd0d4 | ||
|
|
9f4689e21d | ||
|
|
93718b5a41 | ||
|
|
2a06ebce5c | ||
|
|
bff4f998b4 | ||
|
|
30817e1ce8 | ||
|
|
205b46d5bc | ||
|
|
68ef83eeae | ||
|
|
f6d0d914e3 | ||
|
|
60ea787e84 | ||
|
|
7cb0e801d5 | ||
|
|
2fa19ba691 | ||
|
|
f66b84f480 | ||
|
|
278681dc7b | ||
|
|
4388810ef9 | ||
|
|
8d74a9f3f3 | ||
|
|
3190c1f483 | ||
|
|
ca6e068bb9 | ||
|
|
f7eda1235f | ||
|
|
70b173af35 | ||
|
|
a4dea0d17f | ||
|
|
5ca9541403 | ||
|
|
4ea83d7811 | ||
|
|
843ddd9712 | ||
|
|
686f75d678 | ||
|
|
41e19993b5 | ||
|
|
a0c6c8b9af | ||
|
|
973e6f4129 | ||
|
|
daa965eccc | ||
|
|
6e8c6154fb | ||
|
|
59d735d43f | ||
|
|
4cd09c4b6a | ||
|
|
79ae0cd9e8 | ||
|
|
aaccdfc4ba | ||
|
|
f70e5d2409 | ||
|
|
6ff5668ee4 | ||
|
|
728d26ca30 | ||
|
|
f9e7ef1b41 | ||
|
|
3c17445bfd | ||
|
|
f51d8ce561 | ||
|
|
4232395f9f | ||
|
|
502a79c799 | ||
|
|
3a150c2b37 | ||
|
|
1ea7f95da6 | ||
|
|
d05b7706ed | ||
|
|
d619861976 | ||
|
|
36fd6bd0fa | ||
|
|
e5fd53e574 | ||
|
|
902ee9ccaf | ||
|
|
3785f597a0 | ||
|
|
61928d1323 | ||
|
|
a8ac7eb3f9 | ||
|
|
3793b1777b | ||
|
|
62e7ed8b60 | ||
|
|
49312f5981 | ||
|
|
eca369e8d0 | ||
|
|
e9d94149ef | ||
|
|
044d8501b5 | ||
|
|
9e195f47c2 | ||
|
|
cd403b1f05 | ||
|
|
074b0023e7 | ||
|
|
cfbf950f5d | ||
|
|
40c293d41e | ||
|
|
d6fa625300 | ||
|
|
62cba90d65 | ||
|
|
cd93e2f5f9 | ||
|
|
f2ca2f3ea2 | ||
|
|
60415d246c | ||
|
|
fa820ff30d | ||
|
|
b7e8ad7e6d | ||
|
|
49230cb103 | ||
|
|
2f97c78528 | ||
|
|
030d695853 | ||
|
|
00a436ee38 | ||
|
|
123b813394 | ||
|
|
247a4c4a73 | ||
|
|
a5694fb1e4 | ||
|
|
fc528f1b0d | ||
|
|
8e5f64e0d3 | ||
|
|
5efd8753fb | ||
|
|
c7159c3bdb | ||
|
|
e86ba8bd19 | ||
|
|
2edd28f97b | ||
|
|
19477b0574 | ||
|
|
7c0ea24c90 | ||
|
|
68c2bd1e7b | ||
|
|
9e3e10d2c1 | ||
|
|
c610524eb0 | ||
|
|
c2e925be16 | ||
|
|
61fb567304 | ||
|
|
dfee6ac3ec | ||
|
|
348785cfbc | ||
|
|
4b1637c671 | ||
|
|
1372bfd60a | ||
|
|
e85272f436 | ||
|
|
3a598264dc | ||
|
|
f633d9e9c8 | ||
|
|
2601d0686b | ||
|
|
d20f9609ce | ||
|
|
cf58c5c2a9 | ||
|
|
13aaba9380 | ||
|
|
dc1c0a6ccf | ||
|
|
00865a8027 | ||
|
|
9417ebb550 | ||
|
|
7b3aef444e | ||
|
|
fb4f1e3253 | ||
|
|
f30b5c9ca2 | ||
|
|
006737bcc6 | ||
|
|
c325ead317 | ||
|
|
cccfe78a6a | ||
|
|
acc6543257 | ||
|
|
7519621c59 | ||
|
|
1b97631a73 | ||
|
|
ca6efbe093 | ||
|
|
3c8e99279f | ||
|
|
71840f80e9 | ||
|
|
00deed40cc | ||
|
|
d24002df4f | ||
|
|
2f0dff243a | ||
|
|
207a82b176 | ||
|
|
47148b669b | ||
|
|
9f4cb39873 | ||
|
|
fb01925bdf | ||
|
|
b1cdb09358 | ||
|
|
f8e4561c47 | ||
|
|
29aa359512 | ||
|
|
8593e88271 | ||
|
|
8fe3b6de83 | ||
|
|
8eff936f97 | ||
|
|
110ade1398 | ||
|
|
da863ed2de | ||
|
|
5c6112a372 | ||
|
|
65d6a086d0 | ||
|
|
455795862c | ||
|
|
002f8f7c21 | ||
|
|
e3daf570b2 | ||
|
|
d917526690 | ||
|
|
dac1ed52b8 | ||
|
|
ad50fc1180 | ||
|
|
76b7a59d9b | ||
|
|
2d772c5c9a | ||
|
|
9e3eca6950 | ||
|
|
582e55cdc4 | ||
|
|
5ac0d65e2e | ||
|
|
b810c311d0 | ||
|
|
8dd10ab852 | ||
|
|
b16aca65b6 | ||
|
|
33c3b18d40 | ||
|
|
e7a1ff1759 | ||
|
|
81ec37db03 | ||
|
|
ce0052dca8 | ||
|
|
7561bde29d | ||
|
|
728e74eef6 | ||
|
|
4928cfdad2 | ||
|
|
06adfc82ff | ||
|
|
f5588d2f41 | ||
|
|
1f2d29244a | ||
|
|
13a32db008 | ||
|
|
6664288bbc | ||
|
|
579f60a4e5 | ||
|
|
9790818856 | ||
|
|
a2622ee1cc | ||
|
|
2315cb466c | ||
|
|
19a2446669 | ||
|
|
092f32f05b | ||
|
|
11236082ea | ||
|
|
636299cc50 | ||
|
|
84cd6e2879 | ||
|
|
0f8fdcc8b2 | ||
|
|
f6a7cd3d17 | ||
|
|
2a5ae102fe | ||
|
|
9bbcd45d64 | ||
|
|
009bf82dbc | ||
|
|
1301164d4c | ||
|
|
14b7a703a9 | ||
|
|
aa7121490f | ||
|
|
261bf12dcf | ||
|
|
324e93a919 | ||
|
|
5b956a8ac8 | ||
|
|
98be6a00af | ||
|
|
62eafe888b | ||
|
|
504e540242 | ||
|
|
225b464978 | ||
|
|
69e36bc547 | ||
|
|
b3ccacd20f | ||
|
|
11f52a0d70 | ||
|
|
c6c180757e | ||
|
|
0bcf40674e | ||
|
|
bda2eea18d | ||
|
|
b5381c0919 | ||
|
|
4a1f0661d6 | ||
|
|
a9509cdf9a | ||
|
|
aa4e796168 | ||
|
|
af670e41f3 | ||
|
|
5fb0adb667 | ||
|
|
6ee3c49cc8 | ||
|
|
1b38e4d0cf | ||
|
|
abca3d8f72 | ||
|
|
35662478d7 | ||
|
|
36854134df | ||
|
|
9015cd0364 | ||
|
|
6728379880 | ||
|
|
fa8456816f | ||
|
|
7f6d84c46f | ||
|
|
454e26626c | ||
|
|
e8e3b99925 | ||
|
|
a1fafbfb0e | ||
|
|
563b471fc7 | ||
|
|
e705c4bdf8 | ||
|
|
f1c162c0c6 | ||
|
|
16cbb2b422 | ||
|
|
3c5fa0cfe3 | ||
|
|
d91146efac | ||
|
|
2455b65f2e | ||
|
|
7d54a86a52 | ||
|
|
211c9922c4 | ||
|
|
4e0e3cc8af | ||
|
|
443bdcb325 | ||
|
|
fbd0ada4bb | ||
|
|
9f8d97188c | ||
|
|
8b4dd784f7 | ||
|
|
7ab4e9c240 | ||
|
|
028049bbd4 | ||
|
|
bef3d7d863 | ||
|
|
b6092dd0ea | ||
|
|
520ec8572d | ||
|
|
558f2f176e | ||
|
|
8d3a5e79b9 | ||
|
|
77219c6e56 | ||
|
|
952982deb9 | ||
|
|
ca924e1180 | ||
|
|
1e402724c6 | ||
|
|
eef046d8a5 | ||
|
|
436fb5ce95 | ||
|
|
529a2dc5e0 | ||
|
|
c786d8603e | ||
|
|
a4a19300f1 | ||
|
|
e01f0b9514 | ||
|
|
72ca6286fb | ||
|
|
1b9e348ef6 | ||
|
|
fa003769c5 | ||
|
|
05581f3233 | ||
|
|
c13d2ca24e | ||
|
|
063d1c64f3 | ||
|
|
bc61b4d21f | ||
|
|
4056902921 | ||
|
|
f0ae3c922f | ||
|
|
9a41c6b1d4 | ||
|
|
21236a8556 | ||
|
|
5ad5c7796a | ||
|
|
7d6453ac9c | ||
|
|
c67be0dccd | ||
|
|
ada4cc670d | ||
|
|
edb9c0d7b0 | ||
|
|
3899310dca | ||
|
|
1a651ece2c | ||
|
|
9b91c55408 | ||
|
|
cbda4d4b31 | ||
|
|
3c0de98670 | ||
|
|
0eb234f7be | ||
|
|
e92b021096 | ||
|
|
505fa5c440 | ||
|
|
bc0e0af007 | ||
|
|
e4f6307b46 | ||
|
|
e326ae2ea3 | ||
|
|
55b7e8a890 | ||
|
|
72bae78465 | ||
|
|
06663a489d | ||
|
|
d17cbe8f8f | ||
|
|
07f1a2818d | ||
|
|
bec90507d7 | ||
|
|
c7b6b37e1d | ||
|
|
0651145eca | ||
|
|
1675300153 | ||
|
|
bbc286b007 | ||
|
|
7ca6bf9d91 | ||
|
|
83038ffbbc | ||
|
|
f85b90abd2 | ||
|
|
8ba5340fb8 | ||
|
|
f6e3c77ef1 | ||
|
|
3c5b1b14d9 | ||
|
|
a87a341417 | ||
|
|
2d191cc4fb | ||
|
|
fc73dcd7ac | ||
|
|
2a5087243f | ||
|
|
81850d7016 | ||
|
|
84f224a0d7 | ||
|
|
5aef9e78a5 | ||
|
|
d08bfbd094 | ||
|
|
2b8c514095 | ||
|
|
310b41da89 | ||
|
|
ce7c6fd0a9 | ||
|
|
5ff25f9b8f | ||
|
|
26fef18cb8 | ||
|
|
98ca2ba846 | ||
|
|
92fca67cf5 | ||
|
|
215f9012d5 | ||
|
|
9337ad1a47 | ||
|
|
1974a490d8 | ||
|
|
31f1004b74 | ||
|
|
32f9590f2a | ||
|
|
3792b0a01e | ||
|
|
cf37f79b94 | ||
|
|
0a1cbcf442 | ||
|
|
456c1219ee | ||
|
|
4d452e493f | ||
|
|
ba86939fcb | ||
|
|
9cc70dceb4 | ||
|
|
eb321e77f7 | ||
|
|
fa8457769b | ||
|
|
4e418f40bc | ||
|
|
b56d735993 | ||
|
|
562b652532 | ||
|
|
547c203a98 | ||
|
|
098d98d047 | ||
|
|
ab6cc80541 | ||
|
|
b9ff0c2f81 | ||
|
|
a936d03921 | ||
|
|
c62dcb6fa0 | ||
|
|
b0574dee64 | ||
|
|
07996ed613 | ||
|
|
85c66cb4c8 | ||
|
|
7c4acb2539 | ||
|
|
687f54b6b8 | ||
|
|
bfbcbe125e | ||
|
|
b9104596eb | ||
|
|
f328ddf8bb | ||
|
|
899a275d55 | ||
|
|
1bb94397a5 | ||
|
|
844cb6f07d | ||
|
|
d140ed69d8 | ||
|
|
ef1679fa92 | ||
|
|
9fe0449a36 | ||
|
|
a2018f29ff | ||
|
|
80d4c36c2e | ||
|
|
a92313f507 | ||
|
|
b92f3d57e2 | ||
|
|
041bbcac27 | ||
|
|
18c2360755 | ||
|
|
7692b3eab6 | ||
|
|
a033c6beb3 | ||
|
|
68b1a3d231 | ||
|
|
adcd2008e1 | ||
|
|
4ca2160923 | ||
|
|
817ae7fd92 | ||
|
|
13d0ca1bd4 | ||
|
|
372831bc72 | ||
|
|
161b9f4dde | ||
|
|
2745c43fd4 | ||
|
|
1a1f49c966 | ||
|
|
5343bda835 | ||
|
|
9f3e0b8ec5 | ||
|
|
1f9a7e6efc | ||
|
|
ca0ad141b6 | ||
|
|
a6d7cb06db | ||
|
|
a40c3176c2 | ||
|
|
9f88649c8c | ||
|
|
8bc82ce256 | ||
|
|
c95941d65d | ||
|
|
a3d2f9bee9 | ||
|
|
ee4e0d44b3 | ||
|
|
f273c77790 | ||
|
|
61a9fc4684 | ||
|
|
8ab768e9d4 | ||
|
|
7b326e1351 | ||
|
|
c6ec01220b | ||
|
|
8fb66b3a69 | ||
|
|
0612bf14c0 | ||
|
|
d7c7eb7897 | ||
|
|
d0f94a1f1c | ||
|
|
3195af515d | ||
|
|
482c5a1631 | ||
|
|
9d7344365c | ||
|
|
c17c927969 | ||
|
|
821c05373e | ||
|
|
7c1baa7ada | ||
|
|
8ae7fd5f6f | ||
|
|
4b1ec86348 | ||
|
|
24b486cfc3 | ||
|
|
1f6d422a9a | ||
|
|
f4c8bacd5a | ||
|
|
c14ac03919 | ||
|
|
42afef19eb | ||
|
|
460515b963 | ||
|
|
08ba682d78 | ||
|
|
19c9df87bc | ||
|
|
28f2016a13 | ||
|
|
e865376cd5 | ||
|
|
0f2f1a5cc4 | ||
|
|
ded4da6a6e | ||
|
|
fa2dd120e4 | ||
|
|
2e5bb743c7 | ||
|
|
ec2469fa84 | ||
|
|
0263e922f1 | ||
|
|
f0932cbf46 | ||
|
|
8f83254679 | ||
|
|
4e769ee998 | ||
|
|
191c0eea0a | ||
|
|
8d19545f6b | ||
|
|
41df320a22 | ||
|
|
45ec04e62e | ||
|
|
3764236446 | ||
|
|
bd47df86dc | ||
|
|
c16ba0eb9d | ||
|
|
5f9112c4a8 | ||
|
|
1e67cbf7d0 | ||
|
|
5a0b14429c | ||
|
|
1a8f41bc4c | ||
|
|
ce8fc4e5a0 | ||
|
|
07b947e669 | ||
|
|
c7b7ecb074 | ||
|
|
d66e649b3f | ||
|
|
18637363ba | ||
|
|
adadc62ff3 | ||
|
|
43921a97ca | ||
|
|
3ccfc3bed1 | ||
|
|
55d36b7e2b | ||
|
|
9bfb72e5d8 | ||
|
|
50016e0e32 | ||
|
|
88efa06787 | ||
|
|
ba8c5e1f8c | ||
|
|
073695fe81 | ||
|
|
133581fe5c | ||
|
|
dc73edd77c | ||
|
|
dc267a70d2 | ||
|
|
c58d9a073e | ||
|
|
84bf7c7d5d | ||
|
|
d6279335bb | ||
|
|
dfe653fc49 | ||
|
|
4ea54f2d0a | ||
|
|
e8d6ef494e | ||
|
|
47ba3d654e | ||
|
|
be514997d2 | ||
|
|
694616c180 | ||
|
|
7aca93df60 | ||
|
|
8d969f6798 | ||
|
|
5ef3bd9c37 | ||
|
|
e7e309350c | ||
|
|
3c77f34cc1 | ||
|
|
95a60f61ce | ||
|
|
99c588976f | ||
|
|
82889257ad | ||
|
|
f2151e4b57 | ||
|
|
6ec8139b75 | ||
|
|
2430aa08f4 | ||
|
|
f0ef2907eb | ||
|
|
cb145227ae | ||
|
|
6fdc01aaf8 | ||
|
|
3b34bb5343 | ||
|
|
6608e1b9e2 | ||
|
|
20d2c3d284 | ||
|
|
e079197cd6 | ||
|
|
04ed0a2bf7 | ||
|
|
c085904fd1 | ||
|
|
9bf749438c | ||
|
|
d409155dc8 | ||
|
|
69be37a233 | ||
|
|
83b3d5eee0 | ||
|
|
434d8607cc | ||
|
|
29286d8365 | ||
|
|
25de0c4bba | ||
|
|
7e9a0794d0 | ||
|
|
0f4f88a9d9 | ||
|
|
d52edd8638 | ||
|
|
4d1186c003 | ||
|
|
10436796ef | ||
|
|
afd18d4fa3 | ||
|
|
ce03b57275 | ||
|
|
0623b3f394 | ||
|
|
89b82dcc84 | ||
|
|
50fa325cd0 | ||
|
|
70ba31d512 | ||
|
|
c19c1a588f | ||
|
|
1d4df6991d | ||
|
|
cec4786ec2 | ||
|
|
cb6a267f1e | ||
|
|
5cbce8e5a6 | ||
|
|
edec404c96 | ||
|
|
a7575f806c | ||
|
|
9fac49f209 | ||
|
|
5b7c93c156 | ||
|
|
95dfefd185 | ||
|
|
cb7e6d5e4e | ||
|
|
d66583f802 | ||
|
|
f6fb25a807 | ||
|
|
fc6fa9d5e2 | ||
|
|
6336679de2 | ||
|
|
bdd07e3f83 | ||
|
|
225bd167d7 | ||
|
|
f5611449b1 | ||
|
|
ec20f58cbc | ||
|
|
f4d54f710a | ||
|
|
efbf4469d4 | ||
|
|
2465e9eb0b | ||
|
|
1c5533a18f | ||
|
|
9350d46a2a | ||
|
|
bd6d015f8e | ||
|
|
9819c1d771 | ||
|
|
31ce1aae5f | ||
|
|
a0ca5d0c06 | ||
|
|
45d89b3d1a | ||
|
|
d3b0391801 | ||
|
|
a75a6efb40 | ||
|
|
01997403fe | ||
|
|
d2b9bc0db8 | ||
|
|
0d6c15713b | ||
|
|
5f44ad81f0 | ||
|
|
447e862f7e | ||
|
|
cc1aa59379 | ||
|
|
8b55b165f2 | ||
|
|
b1c1211adb | ||
|
|
cfd87522af | ||
|
|
b06ee733ef | ||
|
|
adbb228ab7 | ||
|
|
dbcd1c22b7 | ||
|
|
16d25afeb3 | ||
|
|
7e5417927c | ||
|
|
9ad024eb56 | ||
|
|
765c4a7662 | ||
|
|
bef8f221fd | ||
|
|
421dbceb11 | ||
|
|
05b7b72e3c | ||
|
|
d60914e5b6 | ||
|
|
22c4b56b59 | ||
|
|
d654cfa0fd | ||
|
|
0efa52337e | ||
|
|
05930f0511 | ||
|
|
be705674e1 | ||
|
|
8c2e2a840c | ||
|
|
7920c7861f | ||
|
|
074ac263be | ||
|
|
0daef3e856 | ||
|
|
08ca05f500 | ||
|
|
8a1b524d47 | ||
|
|
d61ce9f2a4 | ||
|
|
4cf606a18e | ||
|
|
eea6c34440 | ||
|
|
3688d873d4 | ||
|
|
db34e7d7f1 | ||
|
|
e269083de6 | ||
|
|
ab6e2839e5 | ||
|
|
b0016b886e | ||
|
|
b296e6bad2 | ||
|
|
651a5cbd66 | ||
|
|
3f99b1e9c0 | ||
|
|
d34ac5a182 | ||
|
|
8d793b9a7e | ||
|
|
90ed71c809 | ||
|
|
8fa9d1fb3a | ||
|
|
5223272174 | ||
|
|
17b6dcd892 | ||
|
|
5cb4326ac5 | ||
|
|
48b4b138ff | ||
|
|
4b55a25ce8 | ||
|
|
791601f51d | ||
|
|
5cf05b32d2 | ||
|
|
8b2e640b8c | ||
|
|
553fec6022 | ||
|
|
6b874486ce | ||
|
|
b117211d4a | ||
|
|
6239c1ac50 | ||
|
|
ae8a5f8069 | ||
|
|
23e6ed1deb | ||
|
|
acd07871bc | ||
|
|
4080247fe9 | ||
|
|
6f9468d1b7 | ||
|
|
6658d7314d | ||
|
|
d72f916818 | ||
|
|
ae07073cec | ||
|
|
30aa899004 | ||
|
|
ad4a9bed29 | ||
|
|
79d769da3f | ||
|
|
e1a55a7b85 | ||
|
|
7f437f37f3 | ||
|
|
9a77866af3 | ||
|
|
9e5921e84c | ||
|
|
b5cfb73063 | ||
|
|
cb5190119e | ||
|
|
d30c778c28 | ||
|
|
9a37393599 | ||
|
|
b7c560f837 | ||
|
|
1ce29ae611 | ||
|
|
dabb354821 | ||
|
|
38e0cfc823 | ||
|
|
228a5751f2 | ||
|
|
d2dee25f8c | ||
|
|
f397c4797c |
No files matched your search
-65
@@ -1,65 +0,0 @@
|
|||||||
00_header
|
|
||||||
10_*
|
|
||||||
30_os-prober
|
|
||||||
40_custom
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
build_env.mk
|
|
||||||
.bzrignore
|
|
||||||
config.cache
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
conf/*.mk
|
|
||||||
conf/gcry.rmk
|
|
||||||
*.d
|
|
||||||
DISTLIST
|
|
||||||
docs/*.info
|
|
||||||
docs/stamp-vti
|
|
||||||
docs/version.texi
|
|
||||||
*.elf
|
|
||||||
*.exec
|
|
||||||
genkernsyms.sh
|
|
||||||
gensymlist.sh
|
|
||||||
grub-dumpbios
|
|
||||||
grub-editenv
|
|
||||||
grub-emu
|
|
||||||
grub_emu_init.c
|
|
||||||
grub_emu_init.h
|
|
||||||
grub-fstest
|
|
||||||
grub_fstest_init.c
|
|
||||||
grub_fstest_init.h
|
|
||||||
grub-install
|
|
||||||
grub-mk*
|
|
||||||
grub-pbkdf2
|
|
||||||
grub-pe2elf
|
|
||||||
grub-probe
|
|
||||||
grub_probe_init.c
|
|
||||||
grub_probe_init.h
|
|
||||||
grub_script.tab.c
|
|
||||||
grub_script.tab.h
|
|
||||||
grub-setup
|
|
||||||
grub_setup_init.c
|
|
||||||
grub_setup_init.h
|
|
||||||
*.img
|
|
||||||
include/grub/cpu
|
|
||||||
include/grub/machine
|
|
||||||
install-sh
|
|
||||||
lib/libgcrypt-grub
|
|
||||||
*.lst
|
|
||||||
Makefile
|
|
||||||
*.mod
|
|
||||||
mod-*.c
|
|
||||||
missing
|
|
||||||
*.pf2
|
|
||||||
po/*.mo
|
|
||||||
po/grub.pot
|
|
||||||
stamp-h
|
|
||||||
stamp-h1
|
|
||||||
stamp-h.in
|
|
||||||
symlist.c
|
|
||||||
update-grub_lib
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.deps
|
||||||
|
Makefile
|
||||||
|
autom4te.cache
|
||||||
|
config.cache
|
||||||
|
config.h
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
stamp-h
|
||||||
|
stamp-h1
|
||||||
@@ -1,23 +1,54 @@
|
|||||||
|
VaX#n8 (real name unknown) wrote shared_src/fsys_ext2fs.c.
|
||||||
|
|
||||||
|
Heiko Schroeder rewrote shared_src/stage1.S to be more readable.
|
||||||
|
|
||||||
The following authors assigned copyright on their work to the Free
|
The following authors assigned copyright on their work to the Free
|
||||||
Software Foundation:
|
Software Foundation:
|
||||||
|
|
||||||
Yoshinori K. Okuji designed and implemented the initial version.
|
Erich Stefan Boleyn originally designed and implemented GRUB.
|
||||||
|
|
||||||
Jeroen Dekkers added initrd support, Multiboot support, and fixed bugs
|
Gordon Matzigkeit adopted GRUB into the GNU Project. He fixed several
|
||||||
in ext2fs.
|
bugs, added symbolic link support to shared_src/fsys_ext2fs.c, and
|
||||||
|
began the implementation of /sbin/grub. He was an official maintainer.
|
||||||
|
|
||||||
Marco Gerards added ext2fs support, grub-emu, a new command-line
|
Yoshinori K. Okuji contributed many bugfixes and new features, such as
|
||||||
engine, and fixed many bugs.
|
working LBA support, /sbin/grub support for configuration files, the
|
||||||
|
script /sbin/grub-install, the utility /bin/mbchk, the new engine for
|
||||||
|
builtin commands, disk swapping support, keyboard configuration support,
|
||||||
|
network support, online help support, command-line history support,
|
||||||
|
hidden menu support, the new Linux loader, serial terminal support,
|
||||||
|
single-line editing support, the utility /sbin/grub-md5-crypt, the new
|
||||||
|
GRUB manual, and several new commands. He is the current official
|
||||||
|
maintainer.
|
||||||
|
|
||||||
Omniflux added terminfo and serial support.
|
Peter Astrand added support for a color menu.
|
||||||
|
|
||||||
Vincent Pelletier added Sparc64 support.
|
Pavel Roskin contributed many bugfixes and new features, such as FreeBSD
|
||||||
|
support for the grub shell, and configure process cleanups.
|
||||||
|
|
||||||
Hollis Blanchard implemented many parts of PowerPC support.
|
Klaus Reichl wrote stage2/fsys_minix.c.
|
||||||
|
|
||||||
Tomas Ebenlendr added the command chainloader into the normal mode,
|
Per Lundberg added graphics support to the Multiboot Specification.
|
||||||
fixed some bugs.
|
|
||||||
|
|
||||||
Guillem Jover merged architecture-independent ELF support code.
|
Jochen Hoenicke rewrote stage2/fsys_fat.c and wrote
|
||||||
|
stage2/fsys_reiserfs.c and stage2/md5.c.
|
||||||
|
|
||||||
Vesa Jaaskelainen added VBE support.
|
Christoph Plattner added support for Net Boot Image Proposal.
|
||||||
|
|
||||||
|
Frank Mehnert added support for hercules console.
|
||||||
|
|
||||||
|
Kristoffer Branemyr added VSTa filesystem support.
|
||||||
|
|
||||||
|
Serguei Tzukanov added JFS and XFS support.
|
||||||
|
|
||||||
|
Jason Thomas added Linux DAC960 support and support for hiding/unhiding
|
||||||
|
logical partitions, and did a significant bugfix for the terminal stuff.
|
||||||
|
|
||||||
|
Tilmann Bubeck added support for vt100-incompatible terminals.
|
||||||
|
|
||||||
|
KB Sriram added a better detection of FAT filesystem and fixed a
|
||||||
|
network device completion.
|
||||||
|
|
||||||
|
Eric Kvaalen fixed a lot of problems in the GRUB manual.
|
||||||
|
|
||||||
|
Leonid Lisovskiy added El Torito support.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
See the Bug Tracking System for GNU GRUB on Savannah. The URL is:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/bugs/?group_id=68 (without SSL)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
https://savannah.gnu.org/bugs/?group_id=68 (with SSL)
|
||||||
@@ -1,625 +1,284 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
The licenses for most software are designed to take away your
|
||||||
software and other kinds of works.
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
The licenses for most software and other practical works are designed
|
software--to make sure the software is free for all its users. This
|
||||||
to take away your freedom to share and change the works. By contrast,
|
General Public License applies to most of the Free Software
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
Foundation's software and to any other program whose authors commit to
|
||||||
share and change all versions of a program--to make sure it remains free
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
have the freedom to distribute copies of free software (and charge for
|
have the freedom to distribute copies of free software (and charge for
|
||||||
them if you wish), that you receive source code or can get it if you
|
this service if you wish), that you receive source code or can get it
|
||||||
want it, that you can change the software or use pieces of it in new
|
if you want it, that you can change the software or use pieces of it
|
||||||
free programs, and that you know you can do these things.
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
To protect your rights, we need to make restrictions that forbid
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
These restrictions translate to certain responsibilities for you if you
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
For example, if you distribute copies of such a program, whether
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
you have. You must make sure that they, too, receive or can get the
|
||||||
or can get the source code. And you must show them these terms so they
|
source code. And you must show them these terms so they know their
|
||||||
know their rights.
|
rights.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
distribute and/or modify the software.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
Also, for each author's protection and ours, we want to make certain
|
||||||
that there is no warranty for this free software. For both users' and
|
that everyone understands that there is no warranty for this free
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
software. If the software is modified by someone else and passed on, we
|
||||||
changed, so that their problems will not be attributed erroneously to
|
want its recipients to know that what they have is not the original, so
|
||||||
authors of previous versions.
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
Finally, any free program is threatened constantly by software
|
||||||
modified versions of the software inside them, although the manufacturer
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
program will individually obtain patent licenses, in effect making the
|
||||||
protecting users' freedom to change the software. The systematic
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
0. Definitions.
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
refers to any such program or work, and a "work based on the Program"
|
||||||
works, such as semiconductor masks.
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
either verbatim or with modifications and/or translated into another
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
language. (Hereinafter, translation is included without limitation in
|
||||||
"recipients" may be individuals or organizations.
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
Activities other than copying, distribution and modification are not
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
covered by this License; they are outside its scope. The act of
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
running the Program is not restricted, and the output from the Program
|
||||||
earlier work or a work "based on" the earlier work.
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
A "covered work" means either the unmodified Program or a work based
|
Whether that is true depends on what the Program does.
|
||||||
on the Program.
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
To "propagate" a work means to do anything with it that, without
|
source code as you receive it, in any medium, provided that you
|
||||||
permission, would make you directly or secondarily liable for
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
infringement under applicable copyright law, except executing it on a
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
notices that refer to this License and to the absence of any warranty;
|
||||||
distribution (with or without modification), making available to the
|
and give any other recipients of the Program a copy of this License
|
||||||
public, and in some countries other activities as well.
|
along with the Program.
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
of it, thus forming a work based on the Program, and copy and
|
||||||
to the extent that it includes a convenient and prominently visible
|
distribute such modifications or work under the terms of Section 1
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
above, provided that you also meet all of these conditions:
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
a) You must cause the modified files to carry prominent notices
|
||||||
work under this License, and how to view a copy of this License. If
|
stating that you changed the files and the date of any change.
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
1. Source Code.
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
c) If the modified program normally reads commands interactively
|
||||||
form of a work.
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
A "Standard Interface" means an interface that either is an official
|
announcement including an appropriate copyright notice and a
|
||||||
standard defined by a recognized standards body, or, in the case of
|
notice that there is no warranty (or else, saying that you provide
|
||||||
interfaces specified for a particular programming language, one that
|
a warranty) and that users may redistribute the program under
|
||||||
is widely used among developers working in that language.
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
The "System Libraries" of an executable work include anything, other
|
does not normally print such an announcement, your work based on
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
the Program is not required to print an announcement.)
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
These requirements apply to the modified work as a whole. If
|
||||||
Major Component, or to implement a Standard Interface for which an
|
identifiable sections of that work are not derived from the Program,
|
||||||
implementation is available to the public in source code form. A
|
and can be reasonably considered independent and separate works in
|
||||||
"Major Component", in this context, means a major essential component
|
themselves, then this License, and its terms, do not apply to those
|
||||||
(kernel, window system, and so on) of the specific operating system
|
sections when you distribute them as separate works. But when you
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
distribute the same sections as part of a whole which is a work based
|
||||||
produce the work, or an object code interpreter used to run it.
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
The "Corresponding Source" for a work in object code form means all
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
control those activities. However, it does not include the work's
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
System Libraries, or general-purpose tools or generally available free
|
exercise the right to control the distribution of derivative or
|
||||||
programs which are used unmodified in performing those activities but
|
collective works based on the Program.
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
In addition, mere aggregation of another work not based on the Program
|
||||||
the work, and the source code for shared libraries and dynamically
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
linked subprograms that the work is specifically designed to require,
|
a storage or distribution medium does not bring the other work under
|
||||||
such as by intimate data communication or control flow between those
|
the scope of this License.
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
The Corresponding Source need not include anything that users
|
under Section 2) in object code or executable form under the terms of
|
||||||
can regenerate automatically from other parts of the Corresponding
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
Source.
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
The Corresponding Source for a work in source code form is that
|
source code, which must be distributed under the terms of Sections
|
||||||
same work.
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
2. Basic Permissions.
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
All rights granted under this License are granted for the term of
|
cost of physically performing source distribution, a complete
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
machine-readable copy of the corresponding source code, to be
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
permission to run the unmodified Program. The output from running a
|
customarily used for software interchange; or,
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
c) Accompany it with the information you received as to the offer
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
You may make, run and propagate covered works that you do not
|
received the program in object code or executable form with such
|
||||||
convey, without conditions so long as your license otherwise remains
|
an offer, in accord with Subsection b above.)
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
The source code for a work means the preferred form of the work for
|
||||||
with facilities for running those works, provided that you comply with
|
making modifications to it. For an executable work, complete source
|
||||||
the terms of this License in conveying all material for which you do
|
code means all the source code for all modules it contains, plus any
|
||||||
not control copyright. Those thus making or running the covered works
|
associated interface definition files, plus the scripts used to
|
||||||
for you must do so exclusively on your behalf, under your direction
|
control compilation and installation of the executable. However, as a
|
||||||
and control, on terms that prohibit them from making any copies of
|
special exception, the source code distributed need not include
|
||||||
your copyrighted material outside their relationship with you.
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
Conveying under any other circumstances is permitted solely under
|
operating system on which the executable runs, unless that component
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
itself accompanies the executable.
|
||||||
makes it unnecessary.
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
No covered work shall be deemed part of an effective technological
|
distribution of the source code, even though third parties are not
|
||||||
measure under any applicable law fulfilling obligations under article
|
compelled to copy the source along with the object code.
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
measures.
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
void, and will automatically terminate your rights under this License.
|
||||||
circumvention of technological measures to the extent such circumvention
|
However, parties who have received copies, or rights, from you under
|
||||||
is effected by exercising rights under this License with respect to
|
this License will not have their licenses terminated so long as such
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
parties remain in full compliance.
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
5. You are not required to accept this License, since you have not
|
||||||
technological measures.
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
4. Conveying Verbatim Copies.
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
You may convey verbatim copies of the Program's source code as you
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
receive it, in any medium, provided that you conspicuously and
|
all its terms and conditions for copying, distributing or modifying
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
the Program or works based on it.
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
Program), the recipient automatically receives a license from the
|
||||||
recipients a copy of this License along with the Program.
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
You may charge any price or no price for each copy that you convey,
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
and you may offer support or warranty protection for a fee.
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
this License.
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
patent license under the contributor's essential patent claims, to
|
infringement or for any other reason (not limited to patent issues),
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
excuse you from the conditions of this License. If you cannot
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
License and any other pertinent obligations, then as a consequence you
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
may not distribute the Program at all. For example, if a patent
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
license would not permit royalty-free redistribution of the Program by
|
||||||
the Program, the only way you could satisfy both those terms and this
|
all those who receive copies directly or indirectly through you, then
|
||||||
License would be to refrain entirely from conveying the Program.
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
It is not the purpose of this section to induce you to infringe any
|
||||||
permission to link or combine any covered work with a work licensed
|
patents or other property right claims or to contest validity of any
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
such claims; this section has the sole purpose of protecting the
|
||||||
combined work, and to convey the resulting work. The terms of this
|
integrity of the free software distribution system, which is
|
||||||
License will continue to apply to the part which is the covered work,
|
implemented by public license practices. Many people have made
|
||||||
but the special requirements of the GNU Affero General Public License,
|
generous contributions to the wide range of software distributed
|
||||||
section 13, concerning interaction through a network will apply to the
|
through that system in reliance on consistent application of that
|
||||||
combination as such.
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
the GNU General Public License from time to time. Such new versions will
|
of the General Public License from time to time. Such new versions will
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the Program
|
||||||
Program specifies that a certain numbered version of the GNU General
|
specifies a version number of this License which applies to it and "any
|
||||||
Public License "or any later version" applies to it, you have the
|
later version", you have the option of following the terms and conditions
|
||||||
option of following the terms and conditions either of that numbered
|
either of that version or of any later version published by the Free
|
||||||
version or of any later version published by the Free Software
|
Software Foundation. If the Program does not specify a version number of
|
||||||
Foundation. If the Program does not specify a version number of the
|
this License, you may choose any version ever published by the Free Software
|
||||||
GNU General Public License, you may choose any version ever published
|
Foundation.
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
programs whose distribution conditions are different, write to the author
|
||||||
public statement of acceptance of a version permanently authorizes you
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
to choose that version for the Program.
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
NO WARRANTY
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
@@ -628,15 +287,15 @@ free software which everyone can redistribute and change under these terms.
|
|||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
To do so, attach the following notices to the program. It is safest
|
||||||
to attach them to the start of each source file to most effectively
|
to attach them to the start of each source file to most effectively
|
||||||
state the exclusion of warranty; and each file should have at least
|
convey the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) 19yy <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
@@ -645,30 +304,37 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
If the program is interactive, make it output a short notice like this
|
||||||
notice like this when it starts in an interactive mode:
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
parts of the General Public License. Of course, your program's commands
|
parts of the General Public License. Of course, the commands you use may
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or your
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
necessary. Here is a sample; alter the names:
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
<signature of Ty Coon>, 1 April 1989
|
||||||
Public License instead of this License. But first, please read
|
Ty Coon, President of Vice
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
-*- Text -*-
|
|
||||||
|
|
||||||
This is the GRUB. Welcome.
|
|
||||||
|
|
||||||
This file contains instructions for compiling and installing the GRUB.
|
|
||||||
|
|
||||||
The Requirements
|
|
||||||
================
|
|
||||||
|
|
||||||
GRUB depends on some software packages installed into your system. If
|
|
||||||
you don't have any of them, please obtain and install them before
|
|
||||||
configuring the GRUB.
|
|
||||||
|
|
||||||
* GCC 4.1.3 or later
|
|
||||||
* GNU Make
|
|
||||||
* GNU Bison 2.3 or later
|
|
||||||
* GNU gettext 0.17 or later
|
|
||||||
* GNU binutils 2.9.1.0.23 or later
|
|
||||||
* Other standard GNU/Unix tools
|
|
||||||
|
|
||||||
If you use a development snapshot or want to hack on GRUB you may
|
|
||||||
need the following.
|
|
||||||
|
|
||||||
* Ruby 1.6 or later
|
|
||||||
* Python 2.5.2 or later
|
|
||||||
* Autoconf 2.60 or later
|
|
||||||
* Automake 1.10.1 or later
|
|
||||||
|
|
||||||
Prerequisites for make-check:
|
|
||||||
|
|
||||||
* qemu, specifically the binary 'qemu-system-i386'
|
|
||||||
|
|
||||||
Configuring the GRUB
|
|
||||||
====================
|
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
|
||||||
various system-dependent variables used during compilation. It uses
|
|
||||||
those values to create a `Makefile' in each directory of the package.
|
|
||||||
It may also create one or more `.h' files containing system-dependent
|
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
|
||||||
you can run in the future to recreate the current configuration, a
|
|
||||||
file `config.cache' that saves the results of its tests to speed up
|
|
||||||
reconfiguring, and a file `config.log' containing compiler output
|
|
||||||
(useful mainly for debugging `configure').
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try to
|
|
||||||
figure out how `configure' could check whether to do them, and mail
|
|
||||||
diffs or instructions to the address given in the `README' so they can
|
|
||||||
be considered for the next release. If at some point `config.cache'
|
|
||||||
contains results you don't want to keep, you may remove or edit it.
|
|
||||||
|
|
||||||
The file `configure.ac' is used to create `configure' by a program
|
|
||||||
called `autoconf'. You only need `configure.in' if you want to change
|
|
||||||
it or regenerate `configure' using a newer version of `autoconf'.
|
|
||||||
|
|
||||||
|
|
||||||
Building the GRUB
|
|
||||||
=================
|
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code. If
|
|
||||||
you don't use a release tarball you have to type `./autogen.sh'.
|
|
||||||
Type `./configure' to configure the package for your system.
|
|
||||||
If you're using `csh' on an old version of System V, you might
|
|
||||||
need to type `sh ./configure' instead to prevent `csh' from trying
|
|
||||||
to execute `configure' itself.
|
|
||||||
|
|
||||||
Running `configure' takes awhile. While running, it prints some
|
|
||||||
messages telling which features it is checking for.
|
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
|
||||||
the package.
|
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
5. You can remove the program binaries and object files from the
|
|
||||||
source code directory by typing `make clean'. To also remove the
|
|
||||||
files that `configure' created (so you can compile the package for
|
|
||||||
a different kind of computer), type `make distclean'. There is
|
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
|
||||||
for the package's developers. If you use it, you may have to get
|
|
||||||
all sorts of other programs in order to regenerate files that came
|
|
||||||
with the distribution.
|
|
||||||
|
|
||||||
|
|
||||||
Compiling For Multiple Architectures
|
|
||||||
====================================
|
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
|
||||||
same time, by placing the object files for each architecture in their
|
|
||||||
own directory. `cd' to the directory where you want the object files
|
|
||||||
and executables to go and run the `configure' script. `configure'
|
|
||||||
automatically checks for the source code in the directory that
|
|
||||||
`configure' is in and in `..'.
|
|
||||||
|
|
||||||
|
|
||||||
Installation Names
|
|
||||||
==================
|
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
|
||||||
installation prefix by giving `configure' the option `--prefix=PATH'.
|
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
|
||||||
architecture-specific files and architecture-independent files. If
|
|
||||||
you give `configure' the option `--exec-prefix=PATH', the package will
|
|
||||||
use PATH as the prefix for installing programs and libraries.
|
|
||||||
Documentation and other data files will still use the regular prefix.
|
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
|
||||||
options like `--bindir=PATH' to specify different values for
|
|
||||||
particular kinds of files. Run `configure --help' for a list of the
|
|
||||||
directories you can set and what kinds of files go in them.
|
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
|
||||||
with an extra prefix or suffix on their names by giving `configure'
|
|
||||||
the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
|
||||||
|
|
||||||
Please note, however, that the GRUB knows where it is located in the
|
|
||||||
filesystem. If you have installed it in an unusual location, the
|
|
||||||
system might not work properly, or at all. The chief utility of these
|
|
||||||
options for the GRUB is to allow you to "install" in some alternate
|
|
||||||
location, and then copy these to the actual root filesystem later.
|
|
||||||
|
|
||||||
|
|
||||||
Sharing Defaults
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
|
||||||
you can create a site shell script called `config.site' that gives
|
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
|
||||||
A warning: not all `configure' scripts look for a site script.
|
|
||||||
|
|
||||||
|
|
||||||
Operation Controls
|
|
||||||
==================
|
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
|
||||||
operates.
|
|
||||||
|
|
||||||
`--cache-file=FILE'
|
|
||||||
Use and save the results of the tests in FILE instead of
|
|
||||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
|
||||||
debugging `configure'.
|
|
||||||
|
|
||||||
`--help'
|
|
||||||
Print a summary of the options to `configure', and exit.
|
|
||||||
|
|
||||||
`--quiet'
|
|
||||||
`--silent'
|
|
||||||
`-q'
|
|
||||||
Do not print messages saying which checks are being made.
|
|
||||||
|
|
||||||
`--srcdir=DIR'
|
|
||||||
Look for the package's source code in directory DIR. Usually
|
|
||||||
`configure' can determine that directory automatically.
|
|
||||||
|
|
||||||
`--version'
|
|
||||||
Print the version of Autoconf used to generate the `configure'
|
|
||||||
script, and exit.
|
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
-*- text -*-
|
||||||
|
|
||||||
|
This is a list of random notes for GRUB maintainers. If you are not a
|
||||||
|
maintainer, you need to ask maintainers to do these instead of doing
|
||||||
|
these yourself.
|
||||||
|
|
||||||
|
How to update the online manual: (FIXME: this is obsoelete)
|
||||||
|
1. Copy docs/*.texi (excluding "multiboot.texi") to fencepost.gnu.org.
|
||||||
|
2. Make a symbolic link from ~mohit/gnudoc/gnudoc_template to the
|
||||||
|
directory under which *.texi were copied, if the link isn't present.
|
||||||
|
3. Run ``~mohit/gnudoc/gendocs.sh grub "GNU GRUB Manual"''.
|
||||||
|
4. Copy the contents of the directory ``manual'' to
|
||||||
|
gnudist.gnu.org:~ftp/gnu/Manuals/grub-VERSION (VERSION is, for
|
||||||
|
example, 1.0).
|
||||||
|
5. Run ``ln -sf grub-VERSION grub'' in gnudist.gnu.org:~ftp/gnu/Manuals.
|
||||||
|
6. Run ``cd grub; ln -s grub.html index.html''.
|
||||||
|
7. Verify the new online manual with a WWW browser.
|
||||||
|
8. Update manual.html by hand.
|
||||||
|
|
||||||
|
How to release a version:
|
||||||
|
1. Check out the source tree from the CVS from scratch.
|
||||||
|
2. Check if ``make distcheck'' succeeds.
|
||||||
|
3. Run ``util/grub-image''.
|
||||||
|
4. Check the resulted images, for example, using bochs.
|
||||||
|
5. Copy grub-VERSION.tar.gz, grub-VERSION-i386-pc.tar.gz and
|
||||||
|
grub-VERSION-i386-pc.ext2fs to fencepost.gnu.org:~ftp/gnu/grub.
|
||||||
|
6. Move older files in that directory above to the directory ``old'',
|
||||||
|
if you think they are eyesores.
|
||||||
|
7. Post an announcement to bug-grub@gnu.org. It would be a good idea to
|
||||||
|
send a carbon copy to bug-hurd@gnu.org and
|
||||||
|
debian-hurd@lists.debian.org. If the announcement is for a stable
|
||||||
|
version, you can inform info-gnu@gnu.org as well.
|
||||||
|
8. Optionally, post an announcement to Freshmeat.net.
|
||||||
|
|
||||||
|
Legal issues:
|
||||||
|
1. If a patch is not significant (in size), you don't have to care about
|
||||||
|
the copyright.
|
||||||
|
2. If a patch is significant, you shouldn't apply the patch to the CVS.
|
||||||
|
Before doing that, you must ask the contributor to assign or disclaim
|
||||||
|
the copyright. Send ``/gd/gnuorg/request-assign.changes'' or
|
||||||
|
``/gd/gnuorg/request-assign.future'' to the contributor, and wait
|
||||||
|
until the FSF finishes the legal work.
|
||||||
|
3. You can check if a contributor has already assigned his/her copyright
|
||||||
|
to the FSF by looking at ``/gd/gnuorg/copyright.list''.
|
||||||
|
|
||||||
|
What you should have in your mind:
|
||||||
|
1. Don't add features unnecessarily! You may think it is a Good Thing to
|
||||||
|
have more features, but you must be prepared for more burdens.
|
||||||
|
DO THAT ONLY IF YOU BELIEVE THAT THE FEATURE IS ESSENTIAL.
|
||||||
|
2. Don't break backward-compatibility! Don't apply any patch which could
|
||||||
|
break existing features. Otherwise you would receive a lot of
|
||||||
|
complaints. DO THAT ONLY IF YOU BELIEVE THAT THE INCOMPATIBILITY IS
|
||||||
|
INEVITABLE.
|
||||||
|
3. Write good code. Be not satisfied with ad hoc workarounds or quick
|
||||||
|
hacks. NEVER WRITE BAD CODE.
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
* http://www.gnu.org/prep/maintain_toc.html
|
||||||
|
* http://www.gnu.org/prep/standards_toc.html
|
||||||
|
* http://www.gnu.org/server/fsf-html-style-sheet.html
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# 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
|
||||||
|
EXTRA_DIST = BUGS MAINTENANCE
|
||||||
-544
@@ -1,544 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This Makefile.in is free software; the author
|
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
|
||||||
# with or without modifications, as long as this notice is preserved.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
||||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
### The configure script will replace these variables.
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
|
||||||
|
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
transform = @program_transform_name@
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
builddir = @builddir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
prefix = @prefix@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
|
|
||||||
bindir = @bindir@
|
|
||||||
sbindir = @sbindir@
|
|
||||||
libexecdir = @libexecdir@
|
|
||||||
datarootdir = @datarootdir@
|
|
||||||
datadir = @datadir@
|
|
||||||
sysconfdir = @sysconfdir@
|
|
||||||
sharedstatedir = @sharedstatedir@
|
|
||||||
localstatedir = @localstatedir@
|
|
||||||
libdir = @libdir@
|
|
||||||
infodir = @infodir@
|
|
||||||
mandir = @mandir@
|
|
||||||
includedir = @includedir@
|
|
||||||
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
|
|
||||||
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
|
|
||||||
|
|
||||||
# Internationalization library.
|
|
||||||
LIBINTL = @LIBINTL@
|
|
||||||
|
|
||||||
XGETTEXT = @XGETTEXT@
|
|
||||||
MSGMERGE = @MSGMERGE@
|
|
||||||
MSGFMT = @MSGFMT@
|
|
||||||
|
|
||||||
LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \
|
|
||||||
if test -e $$i ; then echo $$i ; fi ; \
|
|
||||||
done | sed -e "s,.*/po/\(.*\)\.po$$,\1,")
|
|
||||||
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
|
||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
|
||||||
PACKAGE_STRING = @PACKAGE_STRING@
|
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
|
||||||
|
|
||||||
host_os = @host_os@
|
|
||||||
host_kernel = @host_kernel@
|
|
||||||
host_cpu = @host_cpu@
|
|
||||||
|
|
||||||
target_cpu = @target_cpu@
|
|
||||||
platform = @platform@
|
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
|
||||||
MKDIR_P = @MKDIR_P@
|
|
||||||
|
|
||||||
mkinstalldirs = $(srcdir)/mkinstalldirs
|
|
||||||
|
|
||||||
LIBS = @LIBS@ $(LIBINTL)
|
|
||||||
|
|
||||||
CC = @CC@
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
ASFLAGS = @ASFLAGS@
|
|
||||||
LDFLAGS = @LDFLAGS@ $(LIBS)
|
|
||||||
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
|
||||||
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
|
||||||
TARGET_CC = @TARGET_CC@
|
|
||||||
TARGET_CFLAGS = @TARGET_CFLAGS@
|
|
||||||
TARGET_ASFLAGS = @TARGET_ASFLAGS@
|
|
||||||
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
|
|
||||||
TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
|
||||||
OBJCONV = @OBJCONV@
|
|
||||||
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
|
||||||
-Wall -W
|
|
||||||
TARGET_LDFLAGS = @TARGET_LDFLAGS@
|
|
||||||
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
|
||||||
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
|
|
||||||
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
|
||||||
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
OBJCOPY = @OBJCOPY@
|
|
||||||
STRIP = @STRIP@
|
|
||||||
NM = @NM@
|
|
||||||
RUBY = @RUBY@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
|
||||||
ifeq (, $(MAKEINFO))
|
|
||||||
MAKEINFO = true
|
|
||||||
endif
|
|
||||||
HELP2MAN = @HELP2MAN@
|
|
||||||
ifeq (, $(HELP2MAN))
|
|
||||||
HELP2MAN = true
|
|
||||||
else
|
|
||||||
HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF
|
|
||||||
endif
|
|
||||||
AWK = @AWK@
|
|
||||||
LIBCURSES = @LIBCURSES@
|
|
||||||
LIBUSB = @LIBUSB@
|
|
||||||
LIBSDL = @LIBSDL@
|
|
||||||
LIBPCIACCESS = @LIBPCIACCESS@
|
|
||||||
YACC = @YACC@
|
|
||||||
FONT_SOURCE = @FONT_SOURCE@
|
|
||||||
|
|
||||||
# Options.
|
|
||||||
enable_grub_emu_usb = @enable_grub_emu_usb@
|
|
||||||
enable_grub_emu_sdl = @enable_grub_emu_sdl@
|
|
||||||
enable_grub_emu_pci = @enable_grub_emu_pci@
|
|
||||||
enable_grub_fstest = @enable_grub_fstest@
|
|
||||||
enable_grub_pe2elf = @enable_grub_pe2elf@
|
|
||||||
enable_grub_mkfont = @enable_grub_mkfont@
|
|
||||||
freetype_cflags = @freetype_cflags@
|
|
||||||
freetype_libs = @freetype_libs@
|
|
||||||
enable_efiemu = @enable_efiemu@
|
|
||||||
|
|
||||||
### General variables.
|
|
||||||
|
|
||||||
RMKFILES = $(wildcard conf/*.rmk)
|
|
||||||
|
|
||||||
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
|
||||||
|
|
||||||
PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
|
|
||||||
$(pkglib_DATA) $(pkglib_BUILDDIR)
|
|
||||||
PKGDATA = $(pkgdata_DATA)
|
|
||||||
PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES)
|
|
||||||
SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(grub-mkconfig_SCRIPTS) \
|
|
||||||
$(lib_SCRIPTS)
|
|
||||||
INFOS = $(info_INFOS)
|
|
||||||
|
|
||||||
CLEANFILES =
|
|
||||||
MOSTLYCLEANFILES =
|
|
||||||
DISTCLEANFILES = config.status config.cache config.log config.h \
|
|
||||||
Makefile stamp-h stamp-h1 include/grub/cpu include/grub/machine \
|
|
||||||
gensymlist.sh genkernsyms.sh build_env.mk \
|
|
||||||
docs/grub.info docs/version.texi docs/stamp-vti
|
|
||||||
|
|
||||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
|
||||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
|
||||||
|
|
||||||
# The default target.
|
|
||||||
all: all-local
|
|
||||||
|
|
||||||
### Include an arch-specific Makefile.
|
|
||||||
$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
|
|
||||||
if test "x$(RUBY)" = x; then \
|
|
||||||
touch $@; \
|
|
||||||
else \
|
|
||||||
$(RUBY) $(srcdir)/genmk.rb < $< > $@; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ifeq ($(platform), emu)
|
|
||||||
include $(srcdir)/conf/any-emu.mk
|
|
||||||
else
|
|
||||||
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
|
|
||||||
# For tests.
|
|
||||||
include $(srcdir)/conf/tests.mk
|
|
||||||
# For external modules.
|
|
||||||
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
|
||||||
endif
|
|
||||||
|
|
||||||
### General targets.
|
|
||||||
|
|
||||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
|
||||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
|
||||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
|
||||||
cat $(DEFSYMFILES) /dev/null \
|
|
||||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
|
||||||
|| (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
command.lst: $(COMMANDFILES)
|
|
||||||
cat $^ /dev/null | sort > $@
|
|
||||||
|
|
||||||
fs.lst: $(FSFILES)
|
|
||||||
cat $^ /dev/null | sort > $@
|
|
||||||
|
|
||||||
partmap.lst: $(PARTMAPFILES)
|
|
||||||
cat $^ /dev/null | sort > $@
|
|
||||||
|
|
||||||
handler.lst: $(HANDLERFILES)
|
|
||||||
cat $^ /dev/null | sort > $@
|
|
||||||
|
|
||||||
terminal.lst: $(TERMINALFILES)
|
|
||||||
cat $^ /dev/null | sort > $@
|
|
||||||
|
|
||||||
parttool.lst: $(PARTTOOLFILES)
|
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
|
||||||
|
|
||||||
video.lst: $(VIDEOFILES)
|
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
|
||||||
|
|
||||||
crypto.lst: lib/libgcrypt-grub/cipher/crypto.lst
|
|
||||||
cp $^ $@
|
|
||||||
|
|
||||||
ifneq (true, $(MAKEINFO))
|
|
||||||
info_INFOS += docs/grub.info
|
|
||||||
endif
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += vti.tmp
|
|
||||||
MAINTAINER_CLEANFILES += docs/stamp-vti docs/version.texi
|
|
||||||
docs/version.texi: docs/stamp-vti
|
|
||||||
docs/stamp-vti: docs/grub.texi configure.ac
|
|
||||||
$(MKDIR_P) docs
|
|
||||||
(set `$(SHELL) $(srcdir)/docs/mdate-sh $<`; \
|
|
||||||
echo "@set UPDATED $$1 $$2 $$3"; \
|
|
||||||
echo "@set UPDATED-MONTH $$2 $$3"; \
|
|
||||||
echo "@set EDITION $(PACKAGE_VERSION)"; \
|
|
||||||
echo "@set VERSION $(PACKAGE_VERSION)") > vti.tmp
|
|
||||||
@cmp -s vti.tmp $(builddir)/docs/version.texi \
|
|
||||||
|| (echo "Updating $(builddir)/docs/version.texi"; \
|
|
||||||
cp vti.tmp $(builddir)/docs/version.texi)
|
|
||||||
-@rm -f vti.tmp
|
|
||||||
@cp $(builddir)/docs/version.texi $@
|
|
||||||
|
|
||||||
# Use --force until such time as the documentation is cleaned up.
|
|
||||||
docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
|
|
||||||
$(MKDIR_P) docs
|
|
||||||
-$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
|
|
||||||
|
|
||||||
ifeq (, $(FONT_SOURCE))
|
|
||||||
else
|
|
||||||
|
|
||||||
ifeq ($(enable_grub_mkfont),yes)
|
|
||||||
|
|
||||||
pkgdata_DATA += unicode.pf2 ascii.pf2 ascii.h
|
|
||||||
CLEANFILES += ascii.bitmaps
|
|
||||||
|
|
||||||
# Arrows and lines are needed to draw the menu, so we always include them
|
|
||||||
UNICODE_ARROWS=0x2190-0x2193
|
|
||||||
UNICODE_LINES=0x2501-0x251B
|
|
||||||
|
|
||||||
unicode.pf2: $(FONT_SOURCE) grub-mkfont
|
|
||||||
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
|
|
||||||
|
|
||||||
ascii.pf2: $(FONT_SOURCE) grub-mkfont
|
|
||||||
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
|
||||||
|
|
||||||
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
|
|
||||||
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
|
|
||||||
|
|
||||||
ascii.h: ascii.bitmaps grub-bin2h
|
|
||||||
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
|
|
||||||
|
|
||||||
TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Used for building modules externally
|
|
||||||
pkglib_BUILDDIR += build_env.mk
|
|
||||||
build_env.mk: Makefile
|
|
||||||
(\
|
|
||||||
echo "TARGET_CC=$(TARGET_CC)" ; \
|
|
||||||
echo "TARGET_CFLAGS=$(TARGET_CFLAGS)" ; \
|
|
||||||
echo "TARGET_ASFLAGS=$(TARGET_ASFLAGS)" ; \
|
|
||||||
echo "TARGET_CPPFLAGS=$(TARGET_CPPFLAGS) -I$(pkglibdir) -I$(includedir)" ; \
|
|
||||||
echo "STRIP=$(STRIP)" ; \
|
|
||||||
echo "OBJCONV=$(OBJCONV)" ; \
|
|
||||||
echo "TARGET_MODULE_FORMAT=$(TARGET_MODULE_FORMAT)" ; \
|
|
||||||
echo "TARGET_APPLE_CC=$(TARGET_APPLE_CC)" ; \
|
|
||||||
echo "COMMON_ASFLAGS=$(COMMON_ASFLAGS)" ; \
|
|
||||||
echo "COMMON_CFLAGS=$(COMMON_CFLAGS)" ; \
|
|
||||||
echo "COMMON_LDFLAGS=$(COMMON_LDFLAGS)"\
|
|
||||||
) > $@
|
|
||||||
pkglib_BUILDDIR += config.h grub_script.tab.h
|
|
||||||
|
|
||||||
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
|
|
||||||
|
|
||||||
install: install-local
|
|
||||||
|
|
||||||
install-local: all
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
|
|
||||||
rm -f $(DESTDIR)$(pkglibdir)/*
|
|
||||||
@list='$(PKGLIB)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkglibdir)/$$dest; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
|
|
||||||
@list='$(PKGDATA)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
|
||||||
@list='$(bin_UTILITIES)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
|
||||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
|
||||||
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
|
||||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
|
||||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
|
||||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
|
||||||
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
|
|
||||||
done
|
|
||||||
@list='$(grub-mkconfig_DATA)'; for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(libdir)/grub
|
|
||||||
@list='$(lib_SCRIPTS)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
|
|
||||||
done
|
|
||||||
@langs='$(LINGUAS)'; \
|
|
||||||
for lang in $$langs; do \
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
|
|
||||||
file="po/$$lang.mo"; \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
|
|
||||||
done
|
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
|
|
||||||
@list='$(info_INFOS)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(infodir); \
|
|
||||||
if (install-info --version && \
|
|
||||||
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
|
|
||||||
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$dest" || :; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-strip:
|
|
||||||
$(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
@list='$(PKGLIB)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
rm -f $(DESTDIR)$(pkglibdir)/$$dest; \
|
|
||||||
done
|
|
||||||
@list='$(PKGDATA)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
|
|
||||||
done
|
|
||||||
@list='$(bin_UTILITIES) $(bin_SCRIPTS)'; for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
rm -f $(DESTDIR)$(bindir)/$$dest; \
|
|
||||||
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
|
|
||||||
done
|
|
||||||
@list='$(sbin_UTILITIES) $(sbin_SCRIPTS)'; for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
rm -f $(DESTDIR)$(sbindir)/$$dest; \
|
|
||||||
rm -f $(DESTDIR)$(mandir)/man8/$$dest.8; \
|
|
||||||
done
|
|
||||||
@list='$(grub-mkconfig_SCRIPTS) $(grub-mkconfig_DATA)'; for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
|
||||||
rm -f $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
|
|
||||||
done
|
|
||||||
@list='$(lib_SCRIPTS)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
echo rm -f $(DESTDIR)$(libdir)/$$dest; \
|
|
||||||
rm -f $(DESTDIR)$(libdir)/grub/$$dest; \
|
|
||||||
done
|
|
||||||
@list='$(info_INFOS)'; \
|
|
||||||
for file in $$list; do \
|
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
|
||||||
if (install-info --version && \
|
|
||||||
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
|
|
||||||
if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$dest"; then \
|
|
||||||
:; \
|
|
||||||
else \
|
|
||||||
test ! -f "$(DESTDIR)$(infodir)/$$dest" || exit 1; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
rm -f $(DESTDIR)$(infodir)/$$dest; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean: $(CLEAN_IMAGE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_UTILITY_TARGETS)
|
|
||||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
|
||||||
|
|
||||||
mostlyclean: clean $(MOSTLYCLEAN_IMAGE_TARGETS) $(MOSTLYCLEAN_MODULE_TARGETS) $(MOSTLYCLEAN_UTILITY_TARGETS)
|
|
||||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
|
||||||
|
|
||||||
distclean: mostlyclean
|
|
||||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
|
||||||
-rm -rf $(srcdir)/autom4te.cache
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
|
|
||||||
|
|
||||||
info:
|
|
||||||
|
|
||||||
dvi:
|
|
||||||
|
|
||||||
distdir=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
|
|
||||||
|
|
||||||
DISTLIST: gendistlist.sh
|
|
||||||
$(SHELL) $(srcdir)/gendistlist.sh > $(srcdir)/DISTLIST
|
|
||||||
|
|
||||||
distdir: DISTLIST
|
|
||||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
|
||||||
$(SHELL) $(mkinstalldirs) $(distdir)
|
|
||||||
for i in `cat $(srcdir)/DISTLIST`; do \
|
|
||||||
dir=`echo "$$i" | sed 's:/[^/]*$$::'`; \
|
|
||||||
if test -d $(srcdir)/$$dir; then \
|
|
||||||
$(SHELL) $(mkinstalldirs) $(distdir)/$$dir; \
|
|
||||||
fi; \
|
|
||||||
cp -p $(srcdir)/$$i $(distdir)/$$i || exit 1; \
|
|
||||||
done
|
|
||||||
chmod -R a+r $(distdir)
|
|
||||||
|
|
||||||
GZIP_ENV = --best
|
|
||||||
|
|
||||||
dist: distdir
|
|
||||||
tar chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
|
||||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
|
||||||
|
|
||||||
distcheck: dist
|
|
||||||
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
|
|
||||||
GZIP=$(GZIP_ENV) gzip -cd $(distdir).tar.gz | tar xf -
|
|
||||||
chmod -R a-w $(distdir)
|
|
||||||
chmod a+w $(distdir)
|
|
||||||
mkdir $(distdir)/=build
|
|
||||||
mkdir $(distdir)/=inst
|
|
||||||
chmod a-w $(distdir)
|
|
||||||
dc_instdir=`CDPATH=: && cd $(distdir)/=inst && pwd` \
|
|
||||||
&& cd $(distdir)/=build \
|
|
||||||
&& $(SHELL) ../configure --srcdir=.. --prefix=$$dc_instdir \
|
|
||||||
&& $(MAKE) all dvi check install && $(MAKE) uninstall \
|
|
||||||
&& (test `find $$dc_instdir -type f -print | wc -l` -le 1 \
|
|
||||||
|| (echo "Error: files left after uninstall" 1>&2; \
|
|
||||||
exit 1)) \
|
|
||||||
&& $(MAKE) dist && $(MAKE) distclean \
|
|
||||||
&& rm -f $(distdir).tar.gz \
|
|
||||||
&& (test `find . -type f -print | wc -l` -eq 0 \
|
|
||||||
|| (echo "Error: files left after distclean" 1>&2; \
|
|
||||||
exit 1))
|
|
||||||
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
|
|
||||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
|
||||||
sed 'h;s/./=/g;p;x;p;x'
|
|
||||||
|
|
||||||
check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS)
|
|
||||||
@list="$(UNIT_TESTS)"; \
|
|
||||||
set -e; \
|
|
||||||
for file in $$list; do \
|
|
||||||
$(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
@list="$(FUNCTIONAL_TESTS)"; \
|
|
||||||
set -e; \
|
|
||||||
for file in $$list; do \
|
|
||||||
mod=`basename $$file .mod`; \
|
|
||||||
echo "insmod functional_test; insmod $$mod; functional_test" \
|
|
||||||
| $(builddir)/grub-shell; \
|
|
||||||
done
|
|
||||||
@list="$(SCRIPTED_TESTS)"; \
|
|
||||||
set -e; \
|
|
||||||
for file in $$list; do \
|
|
||||||
$(builddir)/$$file; \
|
|
||||||
done
|
|
||||||
|
|
||||||
.SUFFIX:
|
|
||||||
.SUFFIX: .c .o .S .d
|
|
||||||
|
|
||||||
# Regenerate configure and Makefile automatically.
|
|
||||||
$(srcdir)/aclocal.m4: configure.ac acinclude.m4
|
|
||||||
cd $(srcdir) && aclocal
|
|
||||||
|
|
||||||
$(srcdir)/configure: configure.ac aclocal.m4
|
|
||||||
cd $(srcdir) && autoconf
|
|
||||||
|
|
||||||
$(srcdir)/config.h.in: stamp-h.in
|
|
||||||
$(srcdir)/stamp-h.in: configure.ac aclocal.m4
|
|
||||||
cd $(srcdir) && autoheader
|
|
||||||
echo timestamp > $(srcdir)/stamp-h.in
|
|
||||||
|
|
||||||
config.h: stamp-h
|
|
||||||
stamp-h: config.h.in config.status
|
|
||||||
$(SHELL) ./config.status
|
|
||||||
|
|
||||||
Makefile: Makefile.in config.status
|
|
||||||
$(SHELL) ./config.status
|
|
||||||
|
|
||||||
config.status: configure
|
|
||||||
$(SHELL) ./config.status --recheck
|
|
||||||
|
|
||||||
gensymlist.sh: gensymlist.sh.in config.status
|
|
||||||
$(SHELL) ./config.status
|
|
||||||
|
|
||||||
genkernsyms.sh: genkernsyms.sh.in config.status
|
|
||||||
$(SHELL) ./config.status
|
|
||||||
|
|
||||||
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
|
||||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
|
|
||||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
|
|
||||||
|
|
||||||
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
|
|
||||||
$(MSGMERGE) -U $@ $^
|
|
||||||
|
|
||||||
po/%.mo: po/%.po
|
|
||||||
$(MKDIR_P) $$(dirname $@)
|
|
||||||
$(MSGFMT) -c --statistics -o $@ $^
|
|
||||||
|
|
||||||
.PHONY: all install install-strip uninstall clean mostlyclean distclean
|
|
||||||
.PHONY: maintainer-clean info dvi dist check
|
|
||||||
|
|
||||||
# Prevent an overflow.
|
|
||||||
.NOEXPORT:
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
@@ -1,266 +1,558 @@
|
|||||||
New in 1.98 - 2010-03-06:
|
NEWS - list of user-visible changes between releases of GRUB
|
||||||
|
|
||||||
|
New in 0.97 - 2005-05-08:
|
||||||
|
* Fix the prototypes and the definitions of nested functions. This was
|
||||||
|
required for gcc-4.
|
||||||
|
* Implement a more robust workaround for buggy BIOSes which don't pass
|
||||||
|
boot drive correctly (notably for HP Vectra).
|
||||||
|
|
||||||
|
New in 0.96 - 2005-01-30:
|
||||||
|
* The command "fallback" supports mutiple fallback entries.
|
||||||
|
* The command "savedefault" supports an optional argument which
|
||||||
|
is the number of next boot entry or the special keyword `fallback'.
|
||||||
|
* New utility "grub-set-default".
|
||||||
|
* New section "Making your system robust" in the manual.
|
||||||
|
|
||||||
|
New in 0.95 - 2004-06-13:
|
||||||
|
* Add support for ReiserFS 3.
|
||||||
|
* Fix support for FreeBSD 5.
|
||||||
|
* Support ATARAID for Linux in the grub shell and grub-install.
|
||||||
|
* Add CDROM support for El Torito with no emulation mode. You can use
|
||||||
|
(cd) as a CDROM drive in the config file.
|
||||||
|
* Option --no-mem-option is implied for Linux 2.4.18 and newer.
|
||||||
|
* Add support for UFS2.
|
||||||
|
|
||||||
|
New in 0.94 - 2004-01-25:
|
||||||
|
* Support building on x86-64 with gcc -m32.
|
||||||
|
* Use a BIOS call to turn on/off Gate A20. This should solve various
|
||||||
|
problems related to Gate A20 in modern BIOSes.
|
||||||
|
* Add a workaround for buggy BIOSes (notably HP Vectra series) which
|
||||||
|
don't pass the boot drive correctly.
|
||||||
|
* Display "GNU GRUB" instead of "GRUB" in the menu.
|
||||||
|
* Add support for QNX RTP into the grub shell.
|
||||||
|
* Add support for the initrd max address of a kernel header in Linux.
|
||||||
|
* Support 32 bit and 64 bit dev_t.
|
||||||
|
* Add support for an install device in GRUB's notation with no
|
||||||
|
parenthesis (e.g. grub-install hd0).
|
||||||
|
* Improve the manual a lot.
|
||||||
|
|
||||||
|
New in 0.93 - 2002-12-08:
|
||||||
|
* Define the behavior of the boot loader when the load end address is
|
||||||
|
zero and the bss end address is zero in the Multiboot Specification.
|
||||||
|
Also, add the support into GRUB.
|
||||||
|
* Finally, we have a Bug Tracking System! Now the preferable way to
|
||||||
|
report bugs is to use the BTS rather than sending e-mail to bug-grub.
|
||||||
|
See <http://bugcomm.enbug.org/?project=grub&mode=project>, for more
|
||||||
|
details.
|
||||||
|
* The appendix "FAQ" in the manual is removed. See the GNU GRUB FAQ on
|
||||||
|
the web <http://www.gnu.org/software/grub/grub-faq.html> instead.
|
||||||
|
* The terminal handling code is rewritten radically, and many bugfixes
|
||||||
|
are made at the same time.
|
||||||
|
* The command "color" is effective even in the command-line.
|
||||||
|
* The command "terminal" takes two new options, ``--no-echo'' and
|
||||||
|
``--no-edit''. If you specify ``--no-echo'', GRUB won't echo back
|
||||||
|
input characters. If you specify ``--no-edit'', GRUB will disable the
|
||||||
|
BASH-like editing feature. These options are useful when using an
|
||||||
|
intelligent terminal (such as the comint mode in GNU Emacs).
|
||||||
|
* The utility ``grub-md5-crypt'' prompts to retype a password and checks
|
||||||
|
if the passwords match.
|
||||||
|
* Support for booting Linux is rewritten, so GRUB now supports
|
||||||
|
large-EBDA systems.
|
||||||
|
* The menu interfaces supports Page Up, Page Down, and Right Key.
|
||||||
|
* New command "terminfo", for vt100-incompatible terminals.
|
||||||
|
* New options, ``-D'', ``-g'' and ``-m'' are supported for FreeBSD.
|
||||||
|
|
||||||
|
New in 0.92 - 2002-04-30:
|
||||||
|
* The command "displaymem" uses only hex digits for consistency.
|
||||||
|
* The netboot code goes back to the progress bars instead of dots, for
|
||||||
|
the notation of data transfers. And, that is displayed only in debug
|
||||||
|
mode, that is to say, nothing is displayed by default. Remember that
|
||||||
|
you can turn on debug mode via the command "debug".
|
||||||
|
* The command "help" doesn't show all the available commands by default,
|
||||||
|
when no argument is specified. Rarely used commands (such as
|
||||||
|
"testload") and useless commands in interactive use (such as
|
||||||
|
"savedefault") are hidden. If you want to see help messages for those
|
||||||
|
commands, specify the new option "--all".
|
||||||
|
* A built-in, `more'-like pager is added. When a command prints too many
|
||||||
|
lines to fit the screen, GRUB waits until you hit return key. This
|
||||||
|
feature can be turned off by the new command "pager".
|
||||||
|
* The command "terminal" accepts a new option, "--lines=LINES". You can
|
||||||
|
set the maximum number of lines arbitrarily with this option. If you
|
||||||
|
don't specify it, the maximum number will be 24.
|
||||||
|
* The command "terminal" accepts another new option, "--silent". You can
|
||||||
|
suppress the "Press any key to continue" message with this option.
|
||||||
|
* The mem= option for Linux is recognized and used to limit the maximum
|
||||||
|
address of initrd.
|
||||||
|
* A fallback entry is executed immediately after a default entry,
|
||||||
|
without prompting a user's intervention, as the manual has ever been
|
||||||
|
saying.
|
||||||
|
* The utility ``grub-install'' makes sure that GRUB images have been
|
||||||
|
written to a physical disk completely. To assist this feature, a new
|
||||||
|
command "dump" is added.
|
||||||
|
|
||||||
|
New in 0.91 - 2002-01-21:
|
||||||
|
* Support for Linux DAC960 is added.
|
||||||
|
* JFS and XFS support is added.
|
||||||
|
* The commands "hide" and "unhide" support logical partitions.
|
||||||
|
* The utility ``grub-install'' supports NetBSD.
|
||||||
|
* The network support is updated to Etherboot-5.0.5.
|
||||||
|
* The manner of handling the preset menu changes. In the previous
|
||||||
|
implementation, the preset menu is used only when opening the
|
||||||
|
configuration file failed. Now try to use the preset menu first. And,
|
||||||
|
if the configuration file is available, it is read after readoing the
|
||||||
|
preset menu. In this case, menu entries in the preset menu (if any)
|
||||||
|
are overrided by the configuration file.
|
||||||
|
* Diskless support is a bit changed. In the previous, GRUB set up a
|
||||||
|
network automatically via a special function. In the current, the
|
||||||
|
function is gone and the preset menu feature is used (i.e. just
|
||||||
|
execute the command "bootp" as if you specified it in the preset
|
||||||
|
menu). This has no impact against most users, but you should take care
|
||||||
|
if using the preset menu for your own purpose, because GRUB doesn't
|
||||||
|
call "bootp" implicitly when the preset menu is used explicitly. In
|
||||||
|
this case, you would probably need to insert commands to initialize a
|
||||||
|
network into your preset menu.
|
||||||
|
* Important bugfixes are made for ReiserFS, APM, TFTP, LBA, etc.
|
||||||
|
|
||||||
|
New in 0.90 - 2001-07-11:
|
||||||
|
* The command "setkey" resets key mappings, when no argument is
|
||||||
|
specified.
|
||||||
|
* Linux devfs support is added.
|
||||||
|
* The utility ``grub-install'' accepts a new option, `--recheck'. If
|
||||||
|
this option is specified, probe a device map, even if it already
|
||||||
|
exists. You should use this option whenever you add/remove a disk.
|
||||||
|
* The command "password" supports a md5 password if the option `--md5'
|
||||||
|
is given. This command can now also be used to protect specific menu
|
||||||
|
items with their own passwords.
|
||||||
|
* New command, "displayapm".
|
||||||
|
* New command, "md5crypt".
|
||||||
|
* The new utility ``grub-md5-crypt'' is a frontend of the grub shell. It
|
||||||
|
encrypts a password in MD5 format.
|
||||||
|
* New commands, "testvbe" and "vbeprobe".
|
||||||
|
* The configure script accepts a new option, `--enable-preset-menu'. You
|
||||||
|
can embed an arbitrary configuration which will be used when Stage 2
|
||||||
|
cannot open a real configuration file, with this option. The argument
|
||||||
|
must be an existing file.
|
||||||
|
* EZ-BIOS support is added.
|
||||||
|
* Booting Windows from a logical partition is supported.
|
||||||
|
* The example Multiboot kernel in the directory "docs" is built, if you
|
||||||
|
specify the option `--enable-example-kernel' to the configure script.
|
||||||
|
* New command, "ifconfig".
|
||||||
|
* Linux software RAID support is added (only for RAID-1).
|
||||||
|
* Hercules support is added.
|
||||||
|
* The configure script now accepts `--disable-auto-linux-mem-opt', which
|
||||||
|
has the same meaning as you specify the option `--no-mem-option' to the
|
||||||
|
command "kernel".
|
||||||
|
* Jump to the physical entry address of a Multiboot kernel when booting
|
||||||
|
it up. The old behavior was to use the virtual one, regardless of the
|
||||||
|
setting of the physical address.
|
||||||
|
* The commands "bootp" and "dhcp" accepts a new option
|
||||||
|
`--with-configfile', so that you can load a remotely specified
|
||||||
|
configuration file automatically, like the network boot images.
|
||||||
|
* VSTa filesystem support is added.
|
||||||
|
* ELF symbol loading support is added.
|
||||||
|
|
||||||
|
New in 0.5.96 - 2000-10-04:
|
||||||
|
* New commands, "reboot" and "halt".
|
||||||
|
* New command, "hiddenmenu". You can hide the menu interface by default
|
||||||
|
with this command.
|
||||||
|
* You can specify `--no-mem-option' to the command "kernel", if you want
|
||||||
|
GRUB not to pass a Linux's mem option automatically.
|
||||||
|
* Now GRUB is compliant with the Linux/i386 boot protocol version 2.02.
|
||||||
|
* The network support is updated to Etherboot-4.6.4.
|
||||||
|
* Symlinks in ReiserFS are supported.
|
||||||
|
* Add a workaround into the grub shell, so that it works fine even under
|
||||||
|
Linux 2.4.
|
||||||
|
* Add a new option `--stage2' into the commands "install" and "setup",
|
||||||
|
to let the grub shell know what the file name of Stage 2 is under your
|
||||||
|
operating system. You must specify the option correctly, if you cannot
|
||||||
|
unmount the partition where GRUB images reside. We'd recommend _not_
|
||||||
|
using those commands directly, but using the utility "grub-install"
|
||||||
|
instead, because this is safer.
|
||||||
|
* One violation against the Network Boot Image Proposal was found and
|
||||||
|
fixed. So now the image `nbgrub' can work fine even with a card such
|
||||||
|
as rtl8139.
|
||||||
|
* Serial terminal support is added. The configure script accepts
|
||||||
|
a new option `--disable-serial'. Unless it is specified, you can use
|
||||||
|
two new commands, "serial" and "terminal" in the command-line and the
|
||||||
|
menu. See the manual, for more details.
|
||||||
|
* Preserve the possible magic number used by Windows NT in a MBR.
|
||||||
|
* The command-line interface is switched to single-line editing mode.
|
||||||
|
* Only for developers: the configure script accepts
|
||||||
|
`--enable-serial-speed-simulation', which is useful when you want to
|
||||||
|
simulate the speed of a serial device on a psuedo terminal.
|
||||||
|
* Also only for developers: you can specify an optional argument to the
|
||||||
|
option `--hold' for the grub shell. The argument means how many
|
||||||
|
seconds the grub shell should wait until diving into the main routine.
|
||||||
|
* New command, "savedefault". Now you can save current entry number to
|
||||||
|
your disk with this command and then you can set the default boot
|
||||||
|
entry to it by the command "default saved".
|
||||||
|
* Add a new option `--prefix' into the command "setup", so that you can
|
||||||
|
specify the name of a directory which contains GRUB images. And, the
|
||||||
|
behavior of this command changed slightly, that is, this command now
|
||||||
|
searchs stage1 automatically under "/boot/grub" and "/grub", unless
|
||||||
|
you specify the option `--prefix'.
|
||||||
|
* The utility `grub-install' recognizes a separate boot partition
|
||||||
|
automatically.
|
||||||
|
* New commands, "partnew" and "parttype". You can modify partition
|
||||||
|
tables with these commands.
|
||||||
|
|
||||||
|
New in 0.5.95 - 2000-06-27:
|
||||||
|
* NetBSD ELF kernel support is added. You have to specify the new option
|
||||||
|
to the command "kernel". See below.
|
||||||
|
* Added a new option `--type=TYPE' into the command "kernel". This
|
||||||
|
option suggests what type of kernel you want to load. TYPE must be
|
||||||
|
either of "netbsd", "freebsd", "openbsd", "linux", "biglinux" and
|
||||||
|
"multiboot". Actually, this option will be necessary only if you want
|
||||||
|
to load a NetBSD ELF kernel, because GRUB can automatically determine
|
||||||
|
a kernel type in the other cases.
|
||||||
|
* ReiserFS support is added.
|
||||||
|
* Added a new option `--force-lba' into the command "install". This
|
||||||
|
option disables some sanity checks for LBA mode (but not all). If you
|
||||||
|
are sure that your machine supports LBA mode but GRUB doesn't work in
|
||||||
|
LBA mode, you should specify it. It is necessary if your BIOS is too
|
||||||
|
buggy. In the previous version, it was a compile-time option, but you
|
||||||
|
don't have to recompile GRUB any longer.
|
||||||
|
* Likewise, now the command "setup" and the script "grub-install" also
|
||||||
|
accept `--force-lba' option. Specifying this option to "setup" or
|
||||||
|
"grub-install" has the same effect as to the command "install".
|
||||||
|
* The configure script doesn't accept the option
|
||||||
|
`--disable-lba-support-bitmap-check' any longer. Use the option above.
|
||||||
|
* The network support is updated to Etherboot-4.6.1. So now we have
|
||||||
|
3Com59x and DEPCA drivers.
|
||||||
|
* Now you can omit the configuration file argument to the command
|
||||||
|
"password". If you omit it, then GRUB will just unlock privileged
|
||||||
|
instructions (such as `c') when you enter a correct password.
|
||||||
|
* The new command "lock" can be used to prevent end-users from executing
|
||||||
|
arbitrary menu entries. This command will emit an error until the user
|
||||||
|
enters a correct password.
|
||||||
|
* Recognize the Linux extended partition type.
|
||||||
|
* Pass a correct memory size to Linux and *BSD.
|
||||||
|
* Diskless support is added. Now configure accepts --enable-diskless,
|
||||||
|
and "make" will produce two additional images, ``nbgrub'' for Net Boot
|
||||||
|
Image Proposal and ``pxegrub'' for Preboot Execution Environment. See
|
||||||
|
the documentation, for more details.
|
||||||
|
* The command "tftpserver" overrides a TFTP server address returned by a
|
||||||
|
BOOTP server, a DHCP server or a RARP server.
|
||||||
|
* Fix a serious bug about LBA support. It is possible that you don't
|
||||||
|
disable the LBA support bitmap check any longer. Please send a report,
|
||||||
|
if you must still disable it. We need to know if we should get rid of
|
||||||
|
the option.
|
||||||
|
|
||||||
|
New in 0.5.94 - 2000-03-06:
|
||||||
|
* Stage 1 supports both the LBA mode and the CHS mode.
|
||||||
|
* The NetBSD and OpenBSD boot bug is fixed.
|
||||||
|
* The more automatic installation command "setup" is added.
|
||||||
|
* The command "embed" embeds a Stage 1.5 in the sectors after a MBR.
|
||||||
|
* Support symbolic color name syntax in the command "color".
|
||||||
|
* The grub shell loads the BIOS drive mapping information from a device
|
||||||
|
map file if it is specified and can be opened. If not found, try to
|
||||||
|
create it based on the guessed information.
|
||||||
|
* NetBSD support in the grub shell is improved.
|
||||||
|
* A simple checker for the format of a Multiboot kernel, ``mbchk'', is
|
||||||
|
added.
|
||||||
|
* The command "find" searches for a filename in all devices and print
|
||||||
|
the list of the devices which contain the file.
|
||||||
|
* The command "map" maps a drive to another drive so that we can
|
||||||
|
chain-load some foolish operating systems (such as DOS) even if such
|
||||||
|
an operating system resides at a non-first drive.
|
||||||
|
* The command "setkey" maps a key to another.
|
||||||
|
* The GRUB manual is rewritten, and now consists of three parts and
|
||||||
|
appendices.
|
||||||
|
* The command "ioprobe" detects what I/O ports are used for a BIOS
|
||||||
|
drive.
|
||||||
|
* OpenBSD support in the grub shell is improved.
|
||||||
|
* The command "install" can now patch a Stage 2 with a different
|
||||||
|
filename from "/boot/grub/menu.lst" even if a Stage 1.5 is used.
|
||||||
|
* New program, ``grub-install''.
|
||||||
|
* The command "blocklist" prints the blocklist notation of a file.
|
||||||
|
* The command "chainloader" now accepts an option "--force", which is
|
||||||
|
required if you want to chain-load a boot loader defective in the
|
||||||
|
signature, such as SCO Unixware 7.1.
|
||||||
|
* The netboot support is heavily rewritten, based on Etherboot-4.4.3.
|
||||||
|
Most of the device drivers are stolen from it, so we now have many
|
||||||
|
network drivers. See netboot/README.netboot for more details.
|
||||||
|
* Now configure accepts the option `--disable-lba-support-bitmap-check'
|
||||||
|
to ignore an incorrect LBA support bitmap returned by a buggy BIOS. If
|
||||||
|
you are sure that your BIOS does support LBA mode but GRUB doesn't
|
||||||
|
work in LBA mode, recompile GRUB with this option specified. You can
|
||||||
|
check if GRUB accesses a drive in LBA mode by the command "geometry".
|
||||||
|
* New commands "bootp", "dhcp" and "rarp" can be used to initialize a
|
||||||
|
network device and get IP addresses from a network.
|
||||||
|
* Long filename support in the FAT filesystem is added.
|
||||||
|
* The command "cmp" compares each bytes in two files.
|
||||||
|
|
||||||
|
New in 0.5.93 - 1999-10-30:
|
||||||
|
* ELF format of FreeBSD kernel is supported.
|
||||||
|
* Support the partition ids for NetBSD and OpenBSD.
|
||||||
|
* Exit from the grub shell just by pushing the key `q' in the menu.
|
||||||
|
* New options for configure can disable some functions in Stage 2. See
|
||||||
|
the output from `configure --help' for more information.
|
||||||
|
* FAT32 support is added.
|
||||||
|
* Minix fs support is added.
|
||||||
|
* New commands "hide" and "unhide".
|
||||||
|
* The character `=' after a command is not necessary any longer, but it
|
||||||
|
is supported for backward compatibility.
|
||||||
|
* The command "help" displays helpful information about builtin
|
||||||
|
commands.
|
||||||
|
* The command "geometry" displays the information of a drive specified
|
||||||
|
and set the geometry to arbitrary C/H/S values if the optional
|
||||||
|
arguments are used.
|
||||||
|
* The command "configfile" loads a configuration file interactively.
|
||||||
|
* The command "device" assigns a BIOS drive to an arbitrary filename in
|
||||||
|
the grub shell.
|
||||||
|
* The option `--no-floppy' force the grub shell to assume that there is
|
||||||
|
no floppy, and the option `--probe-second-floppy' enables the probe of
|
||||||
|
the second floppy drive.
|
||||||
|
* Integrated the netboot support in the Dresden version of GRUB.
|
||||||
|
* FreeBSD support in the grub shell is improved.
|
||||||
|
* Killing (C-u and C-k), yanking (C-y) and manipulating the history
|
||||||
|
(C-p and C-n) are supported.
|
||||||
|
* The address argument for the command "install" is now optional.
|
||||||
|
* Better completion support.
|
||||||
|
* The command "cat" displays the contents of a file.
|
||||||
|
|
||||||
|
New in 0.5.92 - 1999-07-26:
|
||||||
|
* Bug fixes (i.e. Stage 1.5 can work fine again).
|
||||||
|
* The /sbin/grub stage2 simulator now works at least on GNU/Linux, and
|
||||||
|
uses the Linux HDIO_GETGEO ioctl to determine hard disk geometry.
|
||||||
|
* TAB not only lists filenames, but also completes a filename when the
|
||||||
|
filename is unique.
|
||||||
|
* Password is not echoed back, put an asterisk for each of input
|
||||||
|
characters.
|
||||||
|
* stage2_debug is removed, and the debugging features are added into
|
||||||
|
stage2.
|
||||||
|
* Color menu support.
|
||||||
|
* New command "quit".
|
||||||
|
* The man page for /sbin/grub.
|
||||||
|
* All documents become Texinfo.
|
||||||
|
* Linux video mode selection is supported.
|
||||||
|
* The new Stage 1 `stage1_lba' supports LBA addressing mode.
|
||||||
|
|
||||||
|
New in 0.5.91 - 1999-03-14, Gordon Matzigkeit:
|
||||||
|
* LBA and preliminary AWARD BIOS disk extension support.
|
||||||
|
* Started docs/grub.texi.
|
||||||
|
* /sbin/grub GUI now works (but it doesn't yet access disks properly).
|
||||||
|
Run `configure --enable-sbin-grub' to build this program in the grub
|
||||||
|
subdirectory.
|
||||||
|
|
||||||
|
New in 0.5.90 - 1999-03-01, Gordon Matzigkeit:
|
||||||
|
* Bug fixes.
|
||||||
|
* GRUB understands symlinks on ext2fs (but still not ffs).
|
||||||
|
* Many source code and build cleanups to comply with GNU standards.
|
||||||
|
|
||||||
|
New in 0.5 - 1998-08-20, Erich Boleyn:
|
||||||
|
|
||||||
|
* Improved error messages in the stage1 to be strings (easier to read
|
||||||
|
than the previous case of single characters), and removed any
|
||||||
|
display in the case of no error (less confusing).
|
||||||
|
|
||||||
|
* New document describing error conditions and messages.
|
||||||
|
|
||||||
|
* Improved configure/build process.
|
||||||
|
|
||||||
|
* Made the early bootup interrupt-safe. Wasn't doing cli/sti when
|
||||||
|
necessary sometimes.
|
||||||
|
|
||||||
|
* GRUB now shuts off the floppy before transferring control to any
|
||||||
|
other programs/modules/loaders. (chain-loading doesn't matter here,
|
||||||
|
just loading 32-bit modules/kernels)
|
||||||
|
|
||||||
|
* Fixed a few stupid bugs, including a several in the ext2fs code.
|
||||||
|
|
||||||
|
* Linux boot format support extended from just "zImage" to include
|
||||||
|
"bzImage" and initial ramdisk (also called "initrd") support for
|
||||||
|
both. "initrd" support is untested, but the critical parts were
|
||||||
|
taken from a supplied patch and seem OK.
|
||||||
|
|
||||||
|
* Several new command features. See the command-listing for details.
|
||||||
|
|
||||||
|
New in 0.4 - 1998-03-19, Erich Boleyn:
|
||||||
|
|
||||||
|
* GRUB now correctly points ES:SI at a partition descriptor when
|
||||||
|
chain-loading.
|
||||||
|
|
||||||
|
* Many minor bugs fixed (some in the build scripts).
|
||||||
|
|
||||||
|
* Intel MPS 1.4 config/check code is totally new, and the "syscmd="
|
||||||
|
command is completely removed. Check command-listing for details.
|
||||||
|
|
||||||
|
Version 0.4-pre, Erich Boleyn:
|
||||||
|
|
||||||
|
* Reorganized docs, moved most "NOTE" items to a FAQ (with new entries
|
||||||
|
as well).
|
||||||
|
|
||||||
|
* Now supports automatic decompression of any files loaded via the
|
||||||
|
GRUB stage2 filesystem code. Simply compress the file using GNU
|
||||||
|
gzip normally, then when loading, the GRUB internals will see the
|
||||||
|
contents in the decompressed state... i.e. all GRUB functions
|
||||||
|
operate normally as if it is the uncompressed file. An extra
|
||||||
|
version of the "module" loading function has been added which
|
||||||
|
disables this functionality if desired (in all the other cases, not
|
||||||
|
decompressing doesn't make sense).
|
||||||
|
|
||||||
* Multiboot on EFI support.
|
* Changed device strings used in filesystem code to more logical
|
||||||
|
format. Added "relative" disk and partition capability, see
|
||||||
|
command-listing and filesystem syntax description for details.
|
||||||
|
|
||||||
* Graphical menu support.
|
* "install=" command vastly improved. Also moved to non-debug area.
|
||||||
|
Check command-listing and install documentation for details.
|
||||||
|
|
||||||
* MIPS support.
|
* Added several new commands: "rootnoverify=", "uppermem=", and a new
|
||||||
|
debug command "displaymem". Check command-listing for details.
|
||||||
|
|
||||||
* Saved default menu entry support, with new utilities `grub-reboot' and
|
* Added versioning numbers (and subsequently broke compatibility with
|
||||||
`grub-set-default'.
|
some of the previous code, so GRUB should be re-installed!).
|
||||||
|
|
||||||
* Unit testing framework.
|
* Added unattended booting support via new "fallback=" command.
|
||||||
|
|
||||||
* Support for multiple terminals.
|
* During debug probe of SMP configuration table compatible with Intel
|
||||||
|
MPS 1.4 standard, GRUB now checks for a pointer in the EBDA.
|
||||||
|
|
||||||
* Encrypted password support, with a new utility `grub-mkpasswd-pbkdf2'.
|
* Using a "default=" entry greater than 11 caused the UI to do funny
|
||||||
|
things (it didn't pre-scroll the list to the appropriate place).
|
||||||
|
|
||||||
* `grub-mkfloppy' removed; use `grub-mkrescue' to create floppy images.
|
* Reading files on FAT floppies had yet more problems related by many
|
||||||
|
users of version 0.3 6/17/96. Again, all known problems fixed.
|
||||||
|
|
||||||
* Add grub-probe support for GNU/Hurd.
|
* "Extended" partitions now work (still cannot make an extended
|
||||||
|
partition active with "makeactive" command).
|
||||||
|
|
||||||
* Add support for gettext.
|
* The build environment is greatly simplified, now using an
|
||||||
|
autoconf-like "configure" script.
|
||||||
|
|
||||||
New in 1.97:
|
New in 0.3-19960617 - 1996-06-17, Erich Boleyn:
|
||||||
|
|
||||||
* Add support for loading XNU (MacOS X kernel).
|
* Yet more documentation improvements.
|
||||||
|
|
||||||
* ACPI override support.
|
* Known bugs in floppy operation fixed (12-bit FAT didn't work for
|
||||||
|
most cases, and inserting other floppies didn't flush the filesystem
|
||||||
|
cache).
|
||||||
|
|
||||||
* Integrated gptsync.
|
* NASTY uninitialized pointer bug causing "raw" floppy operation to
|
||||||
|
crash on several PCs is now fixed. This seems to have been the root
|
||||||
|
cause of all of the compatibility problems that have currently been
|
||||||
|
observed.
|
||||||
|
|
||||||
* Password protection support.
|
* debug-mode command added to automate most difficult step of
|
||||||
|
installation for common cases (new install method #4).
|
||||||
|
|
||||||
* Partition manipulation tool.
|
* Testing "mini-debugger" now merged with command-line when "DEBUG"
|
||||||
|
defined in compile (no SYSDEBUG option anymore). See description of
|
||||||
|
commands in the command-line for details.
|
||||||
|
|
||||||
* Add `keystatus' command.
|
New in 0.3-19960602 - 1996-06-02, Erich Boleyn:
|
||||||
|
|
||||||
* Unicode fonts are now used by default.
|
* Completed initial licenses.
|
||||||
|
|
||||||
* Add `hdparm' command.
|
* Initial filesystem documentation written.
|
||||||
|
|
||||||
* Add support for getting the current date and time from CMOS as variables.
|
* Block-list and FAT filesystems now work as documented (in
|
||||||
|
particular, for the blocklist filesystem, shortcuts like "+1" for
|
||||||
|
"0+1,512" now work correctly).
|
||||||
|
|
||||||
* Add `drivemap' command.
|
* Fixed several problems (old and new) in the various filesystems (for
|
||||||
|
example, the ext2fs filesystem code is now much faster, as it caches
|
||||||
|
some mapping blocks where it didn't at all before). Filesystem
|
||||||
|
semantics are much more uniform as well (symbolic links and reading
|
||||||
|
a directory as a file now return errors where it would silently fail
|
||||||
|
before).
|
||||||
|
|
||||||
* Add support for RAID levels 4,6 and 10.
|
* "makeactive" now works for standard PC partitions on hard disks (not
|
||||||
|
extended partitions... so any PC partition number above 3 will give
|
||||||
|
a "no such partition" error). If a BSD sub-partition is is used, it
|
||||||
|
will ignore it, and only use the primary PC partition number.
|
||||||
|
|
||||||
* update-grub is replaced by grub-mkconfig.
|
New in 0.3-19960520 - 1996-05-20, Erich Boleyn:
|
||||||
|
|
||||||
* When booting from PXE, PXE can be used to load files.
|
* Updated instructions (though still very sparse).
|
||||||
|
|
||||||
* High resolution timer support.
|
* New floppy probe (works much like the Linux floppy boot probe)
|
||||||
|
attempts to find the size of a floppy in a drive. Might still need
|
||||||
|
work! Please try on various floppy drives with various media!
|
||||||
|
|
||||||
* Image loaders now support IO buffering.
|
* New floppy handler will claim a non-existent drive if the floppy
|
||||||
|
disk isn't present in the drive. (for example, it won't be on the
|
||||||
|
list of installed drives unless a floppy is present)
|
||||||
|
|
||||||
* Add `crc' command.
|
* Stage1 now compatible with both a hard disk MBR and the DOS BIOS
|
||||||
|
parameter block (see "install/README" for more details on how this
|
||||||
|
can be used).
|
||||||
|
|
||||||
* Add Cygwin support.
|
* Block-list filesystem partially works, as described in the file
|
||||||
|
"NOTES". Loading an a.out or elf kernel won't work with it, but all
|
||||||
|
other filetypes pretty much should. (certainly chain-loading works
|
||||||
|
OK)
|
||||||
|
|
||||||
* Add x86_64 EFI support.
|
NOTE: you must use the full format "0+1,512" for just he first
|
||||||
|
block... no parameters can be implicit in this version.. THis is
|
||||||
|
being fixed too.
|
||||||
|
|
||||||
* Use LZMA compression instead of LZO.
|
* Linux ext2 filesystem works. (it's very slow for big files, but
|
||||||
|
this is being fixed)
|
||||||
|
|
||||||
* Support for saving the environment from and loading the environment
|
* Linux boot type now supported. Use a standard piggybacked image as
|
||||||
from a file.
|
with LILO. Put in hack to support >64MB via GRUB placing the RAM
|
||||||
|
size as the first item on the command-line automatically. Must pass
|
||||||
|
root partition on command-line using normal Linux syntax... if not,
|
||||||
|
it uses it's builtin root partition.
|
||||||
|
|
||||||
* Allow the UUID to be used as device name.
|
* Supports chain-loading. For details, see "COMMANDS" and the
|
||||||
|
examples directory. (was able to boot DOS and Windows NT on my test
|
||||||
|
box). NOTE that the "root partition" must be set to work right.
|
||||||
|
"makeactive" is currently a no-op.
|
||||||
|
|
||||||
* The `search' command can use UUIDs now.
|
* Several weird bugs fixed. One important note: If you recompile, it
|
||||||
|
will warn about a clash with builtin "strcmp". This is normal...
|
||||||
|
do NOT remove the strcmp definition, as then GCC will possibly put
|
||||||
|
inline code from it's own builtin function in some places. (my
|
||||||
|
strcmp has slightly different functionality, hence the problem)
|
||||||
|
|
||||||
* Add support for IEEE 1275 on i386.
|
* Mini-debugger is currently broken.
|
||||||
|
|
||||||
* Create partmap.lst and use it to automatically load partition map
|
New in 0.2 - 1996-04-12, Erich Boleyn:
|
||||||
modules.
|
|
||||||
|
|
||||||
* grub-mkconfig supports os-prober to add operating systems to the
|
* Completely new menu-based UI. See "COMMANDS" and the examples
|
||||||
boot menu.
|
directory for details. NOTE that the argument to a command must be
|
||||||
|
preceded by a space between it and the '=', in both the config file
|
||||||
|
and the command-line. This will be fixed.
|
||||||
|
|
||||||
* The ATA driver supports devices bigger than 2 TiB.
|
New in 0.1 - 1996-03-31, Erich Boleyn:
|
||||||
|
|
||||||
* Add support for the UDF, AFS and EXT4 filesystems.
|
* Newer version of Multiboot Standard (version 0.6) supported.
|
||||||
|
|
||||||
* The ISO9660 filesystem supports the Joliet extension
|
* Autodetects kernel types. Supports Multiboot, FreeBSD, NetBSD
|
||||||
|
(Linux isn't finished).
|
||||||
|
|
||||||
* Add support for loading kernels of FreeBSD, NetBSD and OpenBSD.
|
* Stage 1.5 works now. Default setup is now for working with a BSD
|
||||||
|
FFS floppy loading "/grub/stage2" as the main bootloader.
|
||||||
|
|
||||||
* Add new command `sleep'.
|
* Filesystem support improved. It didn't work on many floppies before
|
||||||
|
(problem with the partition-detection code).
|
||||||
|
|
||||||
* Support for direct access to AT keyboards.
|
* Memory probe now supports arbitrary amounts of RAM (some technical
|
||||||
|
limitations exist, see Multiboot standard version 0.6 for details).
|
||||||
|
|
||||||
* New utility `grub-fstest'.
|
* A mini-debugger is included by default, activated by hitting '~' on
|
||||||
|
the command-line (it might interfere with things, but it seems OK
|
||||||
|
for my alpha-testing). The commands are in the function
|
||||||
|
"enter_sysdebug" defined in "common.c". If you have an Intel MPS-
|
||||||
|
compatible machine, there are extra commands enabled for SMP cpu
|
||||||
|
testing. 'q' exits and goes back to what you were doing before.
|
||||||
|
|
||||||
New in 1.96 - 2008-02-03:
|
New in 0.0-19960206 - 1996-02-06, Erich Boleyn:
|
||||||
|
|
||||||
* The license term is changed to GNU General Public License Version 3.
|
* Newer version of Multiboot Standard (version 0.4) supported.
|
||||||
|
|
||||||
* grub-emu is made optional. Now you have to use
|
New in 0.0-19951210 - 1995-12-10, Erich Boleyn:
|
||||||
`--enable-grub-emu' to enable it.
|
|
||||||
|
|
||||||
* Add Multiboot2 support.
|
* You can now perform TAB-based completion listing of any valid
|
||||||
|
partially completed disk/partition/file-name combination. Try it
|
||||||
|
out to see what you like, examples are in the NOTES file under
|
||||||
|
"Device completion".
|
||||||
|
|
||||||
* grub-emu can access the host filesystem now.
|
* Fixed a bug causing the memory size routine to sometimes report
|
||||||
|
ridiculous values.
|
||||||
|
|
||||||
* Add support for the NTFS, cpio/tar and Reiserfs filesystems.
|
* Fixed some documentation (what little there is :-/ and a few
|
||||||
|
assembly bugs in the BIOS access routines that nobody reported yet,
|
||||||
* Add support for ATA/ATAPI.
|
so I won't detail it here.
|
||||||
|
|
||||||
* Add update-grub script to generate grub.cfg.
|
|
||||||
|
|
||||||
* Add grub-mkrescue script to generate floppy or ElTorito images
|
|
||||||
(i386-pc only).
|
|
||||||
|
|
||||||
* Add support for background images in gfxterm (background_image command).
|
|
||||||
|
|
||||||
* Add support for detection of 64-bit support in CPU (cpuid command).
|
|
||||||
|
|
||||||
* GPT is now enabled in i386-pc target.
|
|
||||||
|
|
||||||
* Add grub-install for EFI.
|
|
||||||
|
|
||||||
* Ported to the following new platforms: Efika, coreboot (a.k.a. LinuxBIOS),
|
|
||||||
OLPC XO.
|
|
||||||
|
|
||||||
* Add support for colored menu (menu_color_normal and menu_color_highlight
|
|
||||||
variables).
|
|
||||||
|
|
||||||
* Fix support for loading Linux zImages (such as memtest86).
|
|
||||||
|
|
||||||
New in 1.95 - 2006-10-15:
|
|
||||||
|
|
||||||
* Number partitions from 1 instead of 0. For instance, the first
|
|
||||||
partition of "hd0" is now "hd0,1" but not "hd0,0".
|
|
||||||
|
|
||||||
* grub-probefs is renamed to grub-probe, and supports printing a
|
|
||||||
guessed OS device name and a GRUB drive name.
|
|
||||||
|
|
||||||
* RAID and LVM support is added.
|
|
||||||
|
|
||||||
* New command, echo.
|
|
||||||
|
|
||||||
* The disk API is changed to support 64-bit addressing.
|
|
||||||
|
|
||||||
* A TGA loader is added for the video API.
|
|
||||||
|
|
||||||
New in 1.94 - 2006-06-04:
|
|
||||||
|
|
||||||
* Fix several serious bugs in HFS+.
|
|
||||||
|
|
||||||
* Add experimental EFI support. Chainloading and Linux loading are
|
|
||||||
supported at the moment.
|
|
||||||
|
|
||||||
* Add a new command "blocklist" to show a block list.
|
|
||||||
|
|
||||||
* Use --with-platform to specify a boot environment. For now, efi,
|
|
||||||
ieee1275 and pc are supported.
|
|
||||||
|
|
||||||
* Use the filename "kernel.elf" instead of "grubof" on ieee1275.
|
|
||||||
|
|
||||||
* Install GRUB into pkglibdir instead of pkgdatadir.
|
|
||||||
|
|
||||||
* Support environmental variables. You can export variables by the
|
|
||||||
command "export".
|
|
||||||
|
|
||||||
* Remove the commands "default" and "timeout". They are now variables.
|
|
||||||
|
|
||||||
* Add the commands "source" and "." to include a file.
|
|
||||||
|
|
||||||
* Implement experimental Video API and a new terminal "gfxterm" based
|
|
||||||
on the Video API.
|
|
||||||
|
|
||||||
|
|
||||||
New in 1.93 - 2006-03-10:
|
|
||||||
|
|
||||||
* Add support for the HFS+ wrapper.
|
|
||||||
|
|
||||||
* Major improvements to scripting support.
|
|
||||||
|
|
||||||
* Menu entries are now scriptable.
|
|
||||||
|
|
||||||
|
|
||||||
New in 1.92 - 2005-12-25:
|
|
||||||
|
|
||||||
* Add support for GPT partition table format.
|
|
||||||
|
|
||||||
* Add a new command "play" to play an audio file on PC.
|
|
||||||
|
|
||||||
* Add support for Linux/ADFS partition table format.
|
|
||||||
|
|
||||||
* Add support for BASH-like scripting.
|
|
||||||
|
|
||||||
* Add support for Apple HFS+ filesystems.
|
|
||||||
|
|
||||||
|
|
||||||
New in 1.91 - 2005-10-15:
|
|
||||||
|
|
||||||
* Add support for LZO version 2.
|
|
||||||
|
|
||||||
* Support completion in the entry editor.
|
|
||||||
|
|
||||||
* Add VBE support.
|
|
||||||
|
|
||||||
* New commands, "search", "vbetest" and "vbeinfo".
|
|
||||||
|
|
||||||
* The option BOOT_IMAGE is passed to Linux.
|
|
||||||
|
|
||||||
* Add support for automatic decompression for gzip.
|
|
||||||
|
|
||||||
* Add support for terminfo and serial.
|
|
||||||
|
|
||||||
* Add support for x86_64.
|
|
||||||
|
|
||||||
* GRUB itself is a Multiboot-compliant kernel.
|
|
||||||
|
|
||||||
* Add new filesystems: XFS, SFS, and AFFS.
|
|
||||||
|
|
||||||
|
|
||||||
New in 1.90 - 2005-08-07:
|
|
||||||
|
|
||||||
* Rename the project name PUPA to GRUB. Now this version is the
|
|
||||||
developmental version of GRUB officially.
|
|
||||||
|
|
||||||
* The GRUB emulator ``grub-emu'' is added.
|
|
||||||
|
|
||||||
* Add support for newworld Mac. This should work with other
|
|
||||||
PowerPC-based machines as well, if they use IEEE 1275
|
|
||||||
(Open Firmware).
|
|
||||||
|
|
||||||
* Too many changes to describe. Look at ChangeLog for more details.
|
|
||||||
|
|
||||||
|
|
||||||
New in 0.7:
|
|
||||||
|
|
||||||
* Problems in cross-compiling PUPA are fixed.
|
|
||||||
|
|
||||||
* Use -mrtd and -mregparm=3 to reduce the generated code sizes. This
|
|
||||||
means that any missing prototypes could be fatal. Also, you must take
|
|
||||||
care when writing assembly code. See the comments at the beginning of
|
|
||||||
startup.S, for more details.
|
|
||||||
|
|
||||||
* New utility, ``pupa-setup''. This sets up PUPA to make it bootable
|
|
||||||
from a real disk.
|
|
||||||
|
|
||||||
* New commands, "prefix", "insmod", "rmmod" and "lsmod" are added into
|
|
||||||
the rescue mode to manipulate PUPA modules.
|
|
||||||
|
|
||||||
* Linux support is added. Initrd is not support yet.
|
|
||||||
|
|
||||||
* Reduce the size of a core image significantly by compressing a large
|
|
||||||
part of the core image and decompressing itself at boot time. The
|
|
||||||
currently used algorithm is LZO (more precisely, LZO1X-999). So you
|
|
||||||
have to install LZO to build PUPA. See
|
|
||||||
<http://www.oberhumer.com/opensource/lzo/>, for more information.
|
|
||||||
|
|
||||||
|
|
||||||
New in 0.6 - 2002-12-27, Yoshinori K. Okuji:
|
|
||||||
|
|
||||||
* The chainloader and the FAT filesystem are modularized.
|
|
||||||
|
|
||||||
* The structure of the source tree is a bit changed.
|
|
||||||
|
|
||||||
* Support for building loadable modules is added.
|
|
||||||
|
|
||||||
* Some generic parts of pupa-mkimage are segregated.
|
|
||||||
|
|
||||||
* Some documentation files are added, according to the GNU Coding
|
|
||||||
Standards.
|
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
This is GRUB 2, the second version of the GRand Unified Bootloader.
|
This is GNU GRUB, the GRand Unified Bootloader. GRUB is intended to
|
||||||
GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more
|
provide important bootloader features that are missing from typical
|
||||||
robust, more powerful, and more portable.
|
personal computer BIOSes:
|
||||||
|
|
||||||
See the file NEWS for a description of recent changes to GRUB 2.
|
- provides fully-featured command line and graphical interfaces
|
||||||
|
- recognizes fdisk partitions and BSD disklabels
|
||||||
|
- can dynamically read Linux ext2fs, ReiserFS, JFS and XFS, BSD ufs,
|
||||||
|
MS-DOS FAT16 and FAT32, Minix fs, and VSTa fs filesystems, plus
|
||||||
|
hardcoded blocklists
|
||||||
|
- can boot Multiboot-compliant kernels (such as GNU Mach), as well
|
||||||
|
as standard Linux and *BSD kernels
|
||||||
|
|
||||||
|
See the file NEWS for a description of recent changes to GRUB.
|
||||||
|
|
||||||
|
If you are interested in the network support, see the file
|
||||||
|
README.netboot under the directory netboot.
|
||||||
|
|
||||||
See the file INSTALL for instructions on how to build and install the
|
See the file INSTALL for instructions on how to build and install the
|
||||||
GRUB 2 data and program files.
|
GRUB data and program files. See the GRUB manual for details about
|
||||||
|
using GRUB as your boot loader. Type "info grub" in the shell prompt.
|
||||||
|
|
||||||
Please visit the official web page of GRUB 2, for more information.
|
Please visit the official web page of GNU GRUB, for more information.
|
||||||
The URL is <http://www.gnu.org/software/grub/grub.html>.
|
The URL is <http://www.gnu.org/software/grub/grub.html>.
|
||||||
|
|
||||||
For now, there is not much documentation yet. Please look at the GRUB
|
|
||||||
Wiki <http://grub.enbug.org> for testing procedures.
|
|
||||||
@@ -1,38 +1,124 @@
|
|||||||
GRUB 2 would not be what it is today without the invaluable help of
|
GRUB would not be what it is today without the invaluable help of
|
||||||
everybody who was kind enough to spend time testing it and reporting
|
everybody who was kind enough to spend time testing it and reporting
|
||||||
bugs.
|
bugs.
|
||||||
|
|
||||||
The following people made especially gracious contributions of their
|
The following people made especially gracious contributions of their
|
||||||
time and energy in helping to track down bugs, add new features, and
|
time and energy in helping to track down bugs, add new features, and
|
||||||
generally assist in the GRUB 2 maintainership process:
|
generally assist in the GRUB maintainership process:
|
||||||
|
|
||||||
Andrey Shuvikov <mr_hyro@yahoo.com>
|
Adam Lackorzynski <adam@os.inf.tu-dresden.de>
|
||||||
Bibo Mao <bibo.mao@intel.com>
|
Adrian Phillips <a.phillips@dnmi.no>
|
||||||
David Miller <davem@davemloft.net>
|
Alban Crequy <alban.crequy@apinc.org>
|
||||||
Guillem Jover <guillem@hadrons.org>
|
Alessandro Rubini <rubini@gnu.org>
|
||||||
Harley D. Eades III <hde@foobar-qux.org>
|
Alexander K. Hudek <alexhudek@home.com>
|
||||||
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>
|
Alexander Langer <alex@big.endian.de>
|
||||||
Hollis Blanchard <hollis@penguinppc.org>
|
Alfred M. Szmidt <ams@kemisten.nu>
|
||||||
Jeroen Dekkers <jeroen@dekkers.cx>
|
Andrew Clausen <clausen@gnu.org>
|
||||||
Johan Rydberg <jrydberg@gnu.org>
|
Andrew Walrond <andrew@walrond.org>
|
||||||
Marco Gerards <marco@gnu.org>
|
Ben Liblit <liblit@eecs.berkeley.edu>
|
||||||
Michael Guntsche <mike@it-loops.com>
|
Bernhard Treutwein <Bernhard.Treutwein@Verwaltung.Uni-Muenchen.DE>
|
||||||
NIIBE Yutaka <gniibe@m17n.org>
|
Bodo Rueskamp <br@itchigo.com>.
|
||||||
Omniflux <omniflux@omniflux.com>
|
Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com>
|
||||||
Robert Bihlmeyer <robbe@orcus.priv.at>
|
Bradford Hovinen <hovinen@redrose.net>
|
||||||
Roger Leigh <rleigh@whinlatter.ukfsn.org>
|
Brian Brunswick <brian@skarpsey.demon.co.uk>
|
||||||
Ruslan Nikolaev <nruslan@mail.com>
|
Bryan Ford <baford@cs.utah.edu>
|
||||||
|
Cedric Ware <ware@com.enst.fr>
|
||||||
|
Chip Salzenberg <chip@valinux.com>
|
||||||
|
Christian Jones <chjones@aleph0.com>
|
||||||
|
Christoph Plattner <Christoph.Plattner@dot.at>
|
||||||
|
Damian Ivereigh <damian@cisco.com>
|
||||||
|
David Weinehall <tao@debian.org>
|
||||||
|
Dan J. Walters <djw@cs.utexas.edu>
|
||||||
|
Daniel Farrell <s2108287@student.rmit.edu.au>
|
||||||
|
Daniel Pittman <daniel@rimspace.net>
|
||||||
|
Daniel Wagner <wagi@gmx.ch>
|
||||||
|
Danilo Godec <danci@agenda.si>
|
||||||
|
Dennis Kitzman <dennis-kitzman@uiowa.edu>
|
||||||
|
Derrik Pates <dpates@dsdk12.net>
|
||||||
|
Edmund GRIMLEY EVANS <edmundo@rano.demon.co.uk>
|
||||||
|
Eduard Guzovsky <eguzovsk@enterasys.com>
|
||||||
|
Edward Killips <ekillips@triton.net>
|
||||||
|
Egmont Koblinger <egmont@uhulinux.hu>
|
||||||
|
Eric Hanchrow <erich@microsoft.com>
|
||||||
|
Erik Schoenfelder <schoenfr@gaertner.de>
|
||||||
|
Eugene Doudine <dudin@np.nk.nornik.ru>
|
||||||
|
Florian Hatat <mininet@wanadoo.fr>
|
||||||
|
Frank Mehnert <fm3@os.inf.tu-dresden.de>
|
||||||
|
Gary Poppitz <gpoppitz@tachyon.net>
|
||||||
|
Goran Koruga <goran.koruga@hermes.si>
|
||||||
|
Hal Snyder <hal@vailsys.com>
|
||||||
|
HASEGAWA Tomoki <thasegawa@mta.biglobe.ne.jp>
|
||||||
|
Heikki Vatiainen <hessu@cs.tut.fi>
|
||||||
|
Heiko Schroeder <heiko@pool.informatik.rwth-aachen.de>
|
||||||
|
Henrik Nordstrom <hno@marasystems.com>
|
||||||
|
Herbert Nachtnebel <nachtneb@iaee.tuwien.ac.at>
|
||||||
|
Hidetoshi Nishimaki <nishimaki@mxs.nes.nec.co.jp>
|
||||||
|
Hisazumi Kenji <nel@soraneko.com>
|
||||||
|
HORIKAWA Kazunori <kaz-hori@tkd.att.ne.jp>
|
||||||
|
Ilguiz Latypov <ilatypov@superbt.com>
|
||||||
|
Jan Fricke <fricke@uni-greifswald.de>
|
||||||
|
Jan Zerebecki <jan.list@elite-pferde.de>
|
||||||
|
Jason Thomas <jason@topic.com.au>
|
||||||
|
Jean-Jacques Michel <jjmichel@linbox.com>
|
||||||
|
Jeremy Katz <katzj@redhat.com>
|
||||||
|
Jochen Hoenicke <jochen@gnu.org>
|
||||||
|
Johannes Kroeger <hanne@squirrel.owl.de>
|
||||||
|
John Goerzen <jgoerzen@complete.org>
|
||||||
|
John Tobey <spam@john-edwin-tobey.org>
|
||||||
|
Josip Rodin <joy@cibalia.gkvk.hr>
|
||||||
|
Julien Bordet <julien.bordet@int-evry.fr>
|
||||||
|
Julien Perrot <julien.perrot@iie.cnam.fr>
|
||||||
|
Kalle Olavi Niemitalo <tosi@ees2.oulu.fi>
|
||||||
|
Karsten Scheibler <karsten.scheibler@student.uni-halle.de>
|
||||||
|
KB Sriram <mail_kb@yahoo.com>
|
||||||
|
Khimenko Victor <grub@khim.sch57.msk.ru>
|
||||||
|
Klaus Reichl <klaus.reichl@alcatel.at>
|
||||||
|
Kristoffer Branemyr <ztion@swipnet.se>
|
||||||
|
Kunihiro Ishiguro <kunihiro@zebra.org>
|
||||||
|
Leendert Meyer <leen.meyer@home.nl>
|
||||||
|
Leonid Lisovskiy <lly@pisem.net>
|
||||||
|
M. Meiarashi <mes@st.rim.or.jp>
|
||||||
|
Mark Kettenis <kettenis@chello.nl>
|
||||||
|
Mark Lundeberg <aa026@pgfn.bc.ca>
|
||||||
|
Matt Perry <matt@primefactor.com>
|
||||||
|
Matt Yourst <yourst@mit.edu>
|
||||||
|
Matthias Granberry <matthias@slurpee.org>
|
||||||
|
Matthias Kretschmer <m.kretschmer@bsdger.org>
|
||||||
|
Michael Hohmuth <hohmuth@innocent.com>
|
||||||
|
Michael Sullivan <mike@trdlnk.com>
|
||||||
|
Mike Meyer <mwm@mired.org>
|
||||||
|
Miles Bader <miles@gnu.org>
|
||||||
|
NATORI Shin <natori@adm.s.u-tokyo.ac.jp>
|
||||||
|
Neal H Walfield <neal@walfield.org>
|
||||||
|
Neelkanth Natu <neelnatu@yahoo.com>
|
||||||
|
OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
Pavel Roskin <proski@gnu.org>
|
||||||
|
Per Lundberg <plundis@byggdok.se>
|
||||||
|
Peter Astrand <altic@lysator.liu.se>
|
||||||
|
Ralf Medow <ralf.medow@t-online.de>
|
||||||
|
Ramon van Handel <vhandel@chem.vu.nl>
|
||||||
|
Robert Millan <robertmh@gnu.org>
|
||||||
|
Roderich Schupp <rsch@ExperTeam.de>
|
||||||
|
Rogelio M. Serrano Jr. <rogelio@victorio.com>
|
||||||
|
Sergey Matveychuk <sem@ciam.ru>
|
||||||
|
Serguei Tzukanov <tzukanov@narod.ru>
|
||||||
|
Stefan Ondrejicka <ondrej@idata.sk>
|
||||||
|
Stephen Early <steve@greenend.org.uk>
|
||||||
|
Steven Dick <ssd.gnu@mmae.ucf.edu>
|
||||||
|
Sven Wegener <swegener@gentoo.org>
|
||||||
|
Takehiro Suzuki <takehiro@coral.ocn.ne.jp>
|
||||||
|
Taketo Kabe <kabe@sra-tohoku.co.jp>
|
||||||
|
Thierry DELHAISE <thierry.delhaise@delhaise.com>
|
||||||
|
Thierry Laronde <thierry.laronde@polynum.com>
|
||||||
|
Thomas Schweikle <tschweikle@fiducia.de>
|
||||||
|
Thomas Schwinge <kischde@gmx.net>
|
||||||
|
Tilmann Bubeck <t.bubeck@reinform.de>
|
||||||
Timothy Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
|
Timothy Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
|
||||||
Tomas Ebenlendr <ebik@ucw.cz>
|
Torsten Duwe <duwe@caldera.de>
|
||||||
Tristan Gingold <tristan.gingold@bull.net>
|
Uwe Dannowski <ud3@ira.uka.de>
|
||||||
Tsuneyoshi Yasuo <tuneyoshi@naic.co.jp>
|
VaX#n8 <vax@linkdead.paranoia.com>
|
||||||
Vesa Jaaskelainen <chaac@nic.fi>
|
Vesa Jaaskelainen <jaaskela@tietomyrsky.fi>
|
||||||
Vincent Guffens <guffens@inma.ucl.ac.be>
|
Yedidyah Bar-David <didi@post.tau.ac.il>
|
||||||
Vincent Pelletier <subdino2004@yahoo.fr>
|
Yury V. Umanets <umka@namesys.com>
|
||||||
Vladimir Serbinenko <phcoder@gmail.com>
|
Yuri Zaporogets <yuriz@ukr.net>
|
||||||
|
Vitaly Fertman <vitaly@namesys.com>
|
||||||
Also, we thank the projects GNU Automake and LZMA. Some code
|
|
||||||
was stolen from them.
|
|
||||||
|
|
||||||
This project was supported by Information-technology Promotion Agency,
|
|
||||||
Japan.
|
|
||||||
@@ -1,13 +1,102 @@
|
|||||||
|
-*- Mode: Outline -*-
|
||||||
|
|
||||||
Before working on improving GRUB, it's very important that you
|
Before working on anything in this file, it's very important that you
|
||||||
make contact with the core GRUB developers. Things herein might be
|
make contact with the core GRUB developers. Things herein might be
|
||||||
slightly out of date or otherwise not easy to understand at first
|
slightly out of date or otherwise not easy to understand at first
|
||||||
glance. So write to <grub-devel@gnu.org> first.
|
glance. So write to <bug-grub@gnu.org> first.
|
||||||
|
|
||||||
For bug tracking, refer to:
|
Priorities:
|
||||||
|
Reported bugs generally have top priority.
|
||||||
|
Non-reported and non-encountered bugs (things we know don't work,
|
||||||
|
but don't really impede things) have lower priority.
|
||||||
|
Things in this file are ranked with one to three !; the more, the
|
||||||
|
higher priority.
|
||||||
|
|
||||||
http://savannah.gnu.org/bugs/?group=grub
|
|
||||||
|
|
||||||
Our wiki also lists some areas that need work:
|
Things that should be done before 1.0:
|
||||||
|
|
||||||
http://grub.enbug.org/
|
* Finish the Multiboot Speicification 0.7. !!!
|
||||||
|
|
||||||
|
* Add more --disable-FOO options to configure, so that you can create a
|
||||||
|
minimum GRUB image. This is useful for boot floppies because of the size
|
||||||
|
restriction. !
|
||||||
|
|
||||||
|
* Implement a new version of track_int13, using Virtual 8086 Mode. !!!
|
||||||
|
|
||||||
|
* Add missing features of graphics support. !!
|
||||||
|
|
||||||
|
Things that should _not_ be done before 1.0:
|
||||||
|
|
||||||
|
* Add configuration inclusion support by adding a command "include". !
|
||||||
|
|
||||||
|
* Add automatic configuration support.
|
||||||
|
|
||||||
|
* Add bunzip2 support.
|
||||||
|
|
||||||
|
* Define the module system.
|
||||||
|
|
||||||
|
* Add BSD syntax support, using results of ioprobe to map drives. !
|
||||||
|
(0x1f0-0x1f7 = primary IDE, 0x170-0x176 = secondary,
|
||||||
|
0x1e8-0x1ef = tertiary, 0x168-0x16f = quaternary).
|
||||||
|
|
||||||
|
* Add a real scripting language, possibly retaining backward
|
||||||
|
compatibility so that old config files can be used.
|
||||||
|
|
||||||
|
* Add internationalization support, emulating gettext as much as is
|
||||||
|
feasible.
|
||||||
|
|
||||||
|
* Support other architectures than i386-pc.
|
||||||
|
|
||||||
|
* Add real memory management.
|
||||||
|
|
||||||
|
|
||||||
|
Things that may be done anytime:
|
||||||
|
|
||||||
|
* Port the script ``grub-install'' to OpenBSD. At least you will have to
|
||||||
|
modify the function `convert' so that it can translate a native device
|
||||||
|
name into the corresponding GRUB drive representation. !
|
||||||
|
|
||||||
|
* Add a command to run a GRUB script file. !!
|
||||||
|
|
||||||
|
* Add commands to manipulate the menu from the command-line interface. !
|
||||||
|
|
||||||
|
* Make symbolic links work for BSD FFS.
|
||||||
|
|
||||||
|
* Add indirect block support to the BSD FFS filesystem code, so files
|
||||||
|
larger than 16MB can be read.
|
||||||
|
|
||||||
|
* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot
|
||||||
|
parameters.
|
||||||
|
|
||||||
|
* Support embedding a Stage 1.5 in the "bootloader" area of a FFS
|
||||||
|
partition. (We already have the code, but need an approval by an
|
||||||
|
expert before turning on the support. Any volunteers?)
|
||||||
|
|
||||||
|
* Support embedding a Stage 1.5 in the EXT2_BOOT_LOADER_INO of an ext2fs
|
||||||
|
partition, so that it won't be accidentally erased or modified by
|
||||||
|
the kernel.
|
||||||
|
|
||||||
|
* Add ISA PnP support.
|
||||||
|
|
||||||
|
* Add more filesystems support (NTFS, etc.)
|
||||||
|
|
||||||
|
* Add more remote console support (parallel and net).
|
||||||
|
|
||||||
|
* Add (real) RAID support.
|
||||||
|
|
||||||
|
? Add a partition naming syntax that means ``the first partition of
|
||||||
|
this type''. We need this for clean Hurd install floppies.
|
||||||
|
Nope. Improving the `find' command would solve this problem.
|
||||||
|
|
||||||
|
* Add CDROM-chainloading support. It would be enough to support only
|
||||||
|
BIOSes which have bootable-CDROM support (so you may use the "Bootable
|
||||||
|
CDROM" BIOS calls). It is not trivial to support BIOSes without the
|
||||||
|
capability to boot CDROM.
|
||||||
|
|
||||||
|
? Divide pxegrub into two parts, so the initial image doesn't exceed
|
||||||
|
the 32KB limit. I'm not sure if this is really necessary, because the
|
||||||
|
PXE standard just says that it is _recommended_ to improve the
|
||||||
|
modularity of a boot image. Obviously, this reason doesn't apply to
|
||||||
|
GRUB, as pxegrub is merely a secondary boot loader. So whether this
|
||||||
|
task should be done depends on if existing PXE ROMs support >32KB
|
||||||
|
images or not, after all.
|
||||||
+186
-280
@@ -1,47 +1,12 @@
|
|||||||
dnl Redefine AC_LANG_PROGRAM with a "-Wstrict-prototypes -Werror"-friendly
|
|
||||||
dnl version. Patch submitted to bug-autoconf in 2009-09-16.
|
|
||||||
m4_define([AC_LANG_PROGRAM(C)],
|
|
||||||
[$1
|
|
||||||
int
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
dnl Do *not* indent the following line: there may be CPP directives.
|
|
||||||
dnl Don't move the `;' right after for the same reason.
|
|
||||||
$2
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Check whether target compiler is working
|
|
||||||
AC_DEFUN([grub_PROG_TARGET_CC],
|
|
||||||
[AC_MSG_CHECKING([whether target compiler is working])
|
|
||||||
AC_CACHE_VAL(grub_cv_prog_target_cc,
|
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
asm (".globl start; start:");
|
|
||||||
int main (void);
|
|
||||||
]], [[]])],
|
|
||||||
[grub_cv_prog_target_cc=yes],
|
|
||||||
[grub_cv_prog_target_cc=no])
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT([$grub_cv_prog_target_cc])
|
|
||||||
|
|
||||||
if test "x$grub_cv_prog_target_cc" = xno; then
|
|
||||||
AC_MSG_ERROR([cannot compile for the target])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl grub_ASM_USCORE checks if C symbols get an underscore after
|
dnl grub_ASM_USCORE checks if C symbols get an underscore after
|
||||||
dnl compiling to assembler.
|
dnl compiling to assembler.
|
||||||
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
|
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
|
||||||
dnl Erich Boleyn and modified by Yoshinori K. Okuji.
|
dnl Erich Boleyn and modified by OKUJI Yoshinori
|
||||||
AC_DEFUN([grub_ASM_USCORE],
|
AC_DEFUN([grub_ASM_USCORE],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
||||||
AC_CACHE_VAL(grub_cv_asm_uscore,
|
AC_CACHE_VAL(grub_cv_asm_uscore,
|
||||||
[cat > conftest.c <<\EOF
|
[cat > conftest.c <<\EOF
|
||||||
int func (int *);
|
|
||||||
int
|
int
|
||||||
func (int *list)
|
func (int *list)
|
||||||
{
|
{
|
||||||
@@ -79,7 +44,6 @@ AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
|
|||||||
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
||||||
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
||||||
[cat > conftest.c <<\EOF
|
[cat > conftest.c <<\EOF
|
||||||
void cmain (void);
|
|
||||||
void
|
void
|
||||||
cmain (void)
|
cmain (void)
|
||||||
{
|
{
|
||||||
@@ -92,12 +56,12 @@ else
|
|||||||
AC_MSG_ERROR([${CC-cc} cannot compile C source code])
|
AC_MSG_ERROR([${CC-cc} cannot compile C source code])
|
||||||
fi
|
fi
|
||||||
grub_cv_prog_objcopy_absolute=yes
|
grub_cv_prog_objcopy_absolute=yes
|
||||||
for link_addr in 0x2000 0x8000 0x7C00; do
|
for link_addr in 2000 8000 7C00; do
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
|
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
|
||||||
fi
|
fi
|
||||||
if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
|
if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
|
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
|
||||||
fi
|
fi
|
||||||
@@ -109,33 +73,7 @@ for link_addr in 0x2000 0x8000 0x7C00; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])
|
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])])
|
||||||
|
|
||||||
if test "x$grub_cv_prog_objcopy_absolute" = xno; then
|
|
||||||
AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Supply --build-id=none to ld if building modules.
|
|
||||||
dnl This suppresses warnings from ld on some systems
|
|
||||||
AC_DEFUN([grub_PROG_LD_BUILD_ID_NONE],
|
|
||||||
[AC_MSG_CHECKING([whether linker accepts --build-id=none])
|
|
||||||
AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
|
|
||||||
[save_LDFLAGS="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS -Wl,--build-id=none"
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_prog_ld_build_id_none=yes],
|
|
||||||
[grub_cv_prog_ld_build_id_none=no])
|
|
||||||
LDFLAGS="$save_LDFLAGS"
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT([$grub_cv_prog_ld_build_id_none])
|
|
||||||
|
|
||||||
if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none"
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Mass confusion!
|
dnl Mass confusion!
|
||||||
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
|
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
|
||||||
@@ -149,86 +87,56 @@ dnl them.
|
|||||||
dnl
|
dnl
|
||||||
dnl We only support the newer versions, because the old versions cause
|
dnl We only support the newer versions, because the old versions cause
|
||||||
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
||||||
dnl asm files.
|
dnl stage1/stage1.S.
|
||||||
AC_DEFUN([grub_I386_ASM_ADDR32],
|
AC_DEFUN([grub_ASM_ADDR32],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
|
AC_REQUIRE([grub_ASM_PREFIX_REQUIREMENT])
|
||||||
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
||||||
AC_CACHE_VAL(grub_cv_i386_asm_addr32,
|
AC_CACHE_VAL(grub_cv_asm_addr32,
|
||||||
[cat > conftest.s.in <<\EOF
|
[cat > conftest.s.in <<\EOF
|
||||||
.code16
|
.code16
|
||||||
l1: @ADDR32@ movb %al, l1
|
l1: @ADDR32@ movb %al, l1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
|
if test "x$grub_cv_asm_prefix_requirement" = xyes; then
|
||||||
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
|
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
|
||||||
else
|
else
|
||||||
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
|
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
||||||
grub_cv_i386_asm_addr32=yes
|
grub_cv_asm_addr32=yes
|
||||||
else
|
else
|
||||||
grub_cv_i386_asm_addr32=no
|
grub_cv_asm_addr32=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
AC_MSG_RESULT([$grub_cv_asm_addr32])])
|
||||||
|
|
||||||
dnl check if our compiler is apple cc
|
|
||||||
dnl because it requires numerous workarounds
|
|
||||||
AC_DEFUN([grub_apple_cc],
|
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_MSG_CHECKING([whether our compiler is apple cc])
|
|
||||||
AC_CACHE_VAL(grub_cv_apple_cc,
|
|
||||||
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
||||||
grub_cv_apple_cc=yes
|
|
||||||
else
|
|
||||||
grub_cv_apple_cc=no
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_apple_cc])])
|
|
||||||
|
|
||||||
dnl check if our target compiler is apple cc
|
|
||||||
dnl because it requires numerous workarounds
|
|
||||||
AC_DEFUN([grub_apple_target_cc],
|
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
|
||||||
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
|
||||||
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
||||||
grub_cv_apple_target_cc=yes
|
|
||||||
else
|
|
||||||
grub_cv_apple_target_cc=no
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_apple_target_cc])])
|
|
||||||
|
|
||||||
|
|
||||||
|
dnl
|
||||||
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
||||||
dnl appear in the same lines as the instructions they modify, while
|
dnl appear in the same lines as the instructions they modify, while
|
||||||
dnl earlier versions requires that they appear in separate lines.
|
dnl earlier versions requires that they appear in separate lines.
|
||||||
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
|
AC_DEFUN([grub_ASM_PREFIX_REQUIREMENT],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING(dnl
|
AC_MSG_CHECKING(dnl
|
||||||
[whether addr32 must be in the same line as the instruction])
|
[whether addr32 must be in the same line as the instruction])
|
||||||
AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
|
AC_CACHE_VAL(grub_cv_asm_prefix_requirement,
|
||||||
[cat > conftest.s <<\EOF
|
[cat > conftest.s <<\EOF
|
||||||
.code16
|
.code16
|
||||||
l1: addr32 movb %al, l1
|
l1: addr32 movb %al, l1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
||||||
grub_cv_i386_asm_prefix_requirement=yes
|
grub_cv_asm_prefix_requirement=yes
|
||||||
else
|
else
|
||||||
grub_cv_i386_asm_prefix_requirement=no
|
grub_cv_asm_prefix_requirement=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
|
|
||||||
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
|
if test "x$grub_cv_asm_prefix_requirement" = xyes; then
|
||||||
grub_tmp_addr32="addr32"
|
grub_tmp_addr32="addr32"
|
||||||
grub_tmp_data32="data32"
|
grub_tmp_data32="data32"
|
||||||
else
|
else
|
||||||
@@ -241,16 +149,16 @@ AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32,
|
|||||||
AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32,
|
AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32,
|
||||||
[Define it to \"data32\" or \"data32;\" to make GAS happy])
|
[Define it to \"data32\" or \"data32;\" to make GAS happy])
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
AC_MSG_RESULT([$grub_cv_asm_prefix_requirement])])
|
||||||
|
|
||||||
|
|
||||||
|
dnl
|
||||||
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
||||||
dnl not prefixed with `*', while later versions warn if not prefixed.
|
dnl not prefixed with `*', while later versions warn if not prefixed.
|
||||||
AC_DEFUN([grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK],
|
AC_DEFUN([grub_ASM_ABSOLUTE_WITHOUT_ASTERISK],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING(dnl
|
AC_MSG_CHECKING(dnl
|
||||||
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
||||||
AC_CACHE_VAL(grub_cv_i386_asm_absolute_without_asterisk,
|
AC_CACHE_VAL(grub_cv_asm_absolute_without_asterisk,
|
||||||
[cat > conftest.s <<\EOF
|
[cat > conftest.s <<\EOF
|
||||||
lcall *(offset)
|
lcall *(offset)
|
||||||
offset:
|
offset:
|
||||||
@@ -259,202 +167,200 @@ offset:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
||||||
grub_cv_i386_asm_absolute_without_asterisk=no
|
grub_cv_asm_absolute_without_asterisk=no
|
||||||
else
|
else
|
||||||
grub_cv_i386_asm_absolute_without_asterisk=yes
|
grub_cv_asm_absolute_without_asterisk=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
|
|
||||||
if test "x$grub_cv_i386_asm_absolute_without_asterisk" = xyes; then
|
if test "x$grub_cv_asm_absolute_without_asterisk" = xyes; then
|
||||||
AC_DEFINE([ABSOLUTE_WITHOUT_ASTERISK], 1,
|
AC_DEFINE(ABSOLUTE_WITHOUT_ASTERISK, 1, [Define if an absolute indirect call/jump must NOT be prefixed with `*'])
|
||||||
[Define it if GAS requires that absolute indirect calls/jumps are not prefixed with an asterisk])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])])
|
AC_MSG_RESULT([$grub_cv_asm_absolute_without_asterisk])])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl grub_CHECK_START_SYMBOL checks if start is automatically defined by
|
||||||
|
dnl the compiler.
|
||||||
|
dnl Written by OKUJI Yoshinori
|
||||||
|
AC_DEFUN([grub_CHECK_START_SYMBOL],
|
||||||
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_MSG_CHECKING([if start is defined by the compiler])
|
||||||
|
AC_CACHE_VAL(grub_cv_check_start_symbol,
|
||||||
|
[AC_TRY_LINK([], [asm ("incl start")],
|
||||||
|
grub_cv_check_start_symbol=yes,
|
||||||
|
grub_cv_check_start_symbol=no)])
|
||||||
|
|
||||||
dnl Check what symbol is defined as a bss start symbol.
|
if test "x$grub_cv_check_start_symbol" = xyes; then
|
||||||
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
AC_DEFINE(HAVE_START_SYMBOL, 1, [Define if start is defined])
|
||||||
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_start_symbol])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl grub_CHECK_USCORE_START_SYMBOL checks if _start is automatically
|
||||||
|
dnl defined by the compiler.
|
||||||
|
dnl Written by OKUJI Yoshinori
|
||||||
|
AC_DEFUN([grub_CHECK_USCORE_START_SYMBOL],
|
||||||
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_MSG_CHECKING([if _start is defined by the compiler])
|
||||||
|
AC_CACHE_VAL(grub_cv_check_uscore_start_symbol,
|
||||||
|
[AC_TRY_LINK([], [asm ("incl _start")],
|
||||||
|
grub_cv_check_uscore_start_symbol=yes,
|
||||||
|
grub_cv_check_uscore_start_symbol=no)])
|
||||||
|
|
||||||
|
if test "x$grub_cv_check_uscore_start_symbol" = xyes; then
|
||||||
|
AC_DEFINE(HAVE_USCORE_START_SYMBOL, 1, [Define if _start is defined])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_uscore_start_symbol])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL checks if __bss_start is
|
||||||
|
dnl automatically defined by the compiler.
|
||||||
|
dnl Written by Michael Hohmoth.
|
||||||
|
AC_DEFUN([grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
||||||
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
[AC_TRY_LINK([], [asm ("incl __bss_start")],
|
||||||
[[asm ("incl __bss_start")]])],
|
grub_cv_check_uscore_uscore_bss_start_symbol=yes,
|
||||||
[grub_cv_check_uscore_uscore_bss_start_symbol=yes],
|
grub_cv_check_uscore_uscore_bss_start_symbol=no)])
|
||||||
[grub_cv_check_uscore_uscore_bss_start_symbol=no])])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if edata is defined by the compiler])
|
|
||||||
AC_CACHE_VAL(grub_cv_check_edata_symbol,
|
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
||||||
[[asm ("incl edata")]])],
|
|
||||||
[grub_cv_check_edata_symbol=yes],
|
|
||||||
[grub_cv_check_edata_symbol=no])])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_edata_symbol])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if _edata is defined by the compiler])
|
|
||||||
AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol,
|
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
||||||
[[asm ("incl _edata")]])],
|
|
||||||
[grub_cv_check_uscore_edata_symbol=yes],
|
|
||||||
[grub_cv_check_uscore_edata_symbol=no])])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol])
|
|
||||||
|
|
||||||
AH_TEMPLATE([BSS_START_SYMBOL], [Define it to one of __bss_start, edata and _edata])
|
|
||||||
|
|
||||||
if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then
|
if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [__bss_start])
|
AC_DEFINE(HAVE_USCORE_USCORE_BSS_START_SYMBOL, 1, [Define if __bss_start is defined])
|
||||||
elif test "x$grub_cv_check_edata_symbol" = xyes; then
|
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [edata])
|
|
||||||
elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then
|
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [_edata])
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([none of __bss_start, edata or _edata is defined])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check what symbol is defined as an end symbol.
|
dnl
|
||||||
dnl Written by Yoshinori K. Okuji.
|
dnl grub_CHECK_EDATA_SYMBOL checks if edata is automatically defined by the
|
||||||
|
dnl compiler.
|
||||||
|
dnl Written by Michael Hohmuth.
|
||||||
|
AC_DEFUN([grub_CHECK_EDATA_SYMBOL],
|
||||||
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_MSG_CHECKING([if edata is defined by the compiler])
|
||||||
|
AC_CACHE_VAL(grub_cv_check_edata_symbol,
|
||||||
|
[AC_TRY_LINK([], [asm ("incl edata")],
|
||||||
|
grub_cv_check_edata_symbol=yes,
|
||||||
|
grub_cv_check_edata_symbol=no)])
|
||||||
|
|
||||||
|
if test "x$grub_cv_check_edata_symbol" = xyes; then
|
||||||
|
AC_DEFINE(HAVE_EDATA_SYMBOL, 1, [Define if edata is defined])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_edata_symbol])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl grub_CHECK_USCORE_EDATA_SYMBOL checks if _edata is automatically
|
||||||
|
dnl defined by the compiler.
|
||||||
|
dnl Written by Michael Hohmuth.
|
||||||
|
AC_DEFUN([grub_CHECK_USCORE_EDATA_SYMBOL],
|
||||||
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_MSG_CHECKING([if _edata is defined by the compiler])
|
||||||
|
AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol,
|
||||||
|
[AC_TRY_LINK([], [asm ("incl _edata")],
|
||||||
|
grub_cv_check_uscore_edata_symbol=yes,
|
||||||
|
grub_cv_check_uscore_edata_symbol=no)])
|
||||||
|
|
||||||
|
if test "x$grub_cv_check_uscore_edata_symbol" = xyes; then
|
||||||
|
AC_DEFINE(HAVE_USCORE_EDATA_SYMBOL, 1, [Define if _edata is defined])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl grub_CHECK_END_SYMBOL checks if end is automatically defined by the
|
||||||
|
dnl compiler.
|
||||||
|
dnl Written by OKUJI Yoshinori
|
||||||
AC_DEFUN([grub_CHECK_END_SYMBOL],
|
AC_DEFUN([grub_CHECK_END_SYMBOL],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if end is defined by the compiler])
|
AC_MSG_CHECKING([if end is defined by the compiler])
|
||||||
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
[AC_TRY_LINK([], [asm ("incl end")],
|
||||||
[[asm ("incl end")]])],
|
grub_cv_check_end_symbol=yes,
|
||||||
[grub_cv_check_end_symbol=yes],
|
grub_cv_check_end_symbol=no)])
|
||||||
[grub_cv_check_end_symbol=no])])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_end_symbol])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if _end is defined by the compiler])
|
|
||||||
AC_CACHE_VAL(grub_cv_check_uscore_end_symbol,
|
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
||||||
[[asm ("incl _end")]])],
|
|
||||||
[grub_cv_check_uscore_end_symbol=yes],
|
|
||||||
[grub_cv_check_uscore_end_symbol=no])])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
|
|
||||||
|
|
||||||
AH_TEMPLATE([END_SYMBOL], [Define it to either end or _end])
|
|
||||||
|
|
||||||
if test "x$grub_cv_check_end_symbol" = xyes; then
|
if test "x$grub_cv_check_end_symbol" = xyes; then
|
||||||
AC_DEFINE([END_SYMBOL], [end])
|
AC_DEFINE(HAVE_END_SYMBOL, 1, [Define if end is defined])
|
||||||
elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then
|
|
||||||
AC_DEFINE([END_SYMBOL], [_end])
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([neither end nor _end is defined])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_end_symbol])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
dnl
|
||||||
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
dnl grub_CHECK_USCORE_END_SYMBOL checks if _end is automatically defined
|
||||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
dnl by the compiler.
|
||||||
AC_LANG_CONFTEST([[
|
dnl Written by OKUJI Yoshinori
|
||||||
void f (int (*p) (void));
|
AC_DEFUN([grub_CHECK_USCORE_END_SYMBOL],
|
||||||
void g (int i)
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_MSG_CHECKING([if _end is defined by the compiler])
|
||||||
|
AC_CACHE_VAL(grub_cv_check_uscore_end_symbol,
|
||||||
|
[AC_TRY_LINK([], [asm ("incl _end")],
|
||||||
|
grub_cv_check_uscore_end_symbol=yes,
|
||||||
|
grub_cv_check_uscore_end_symbol=no)])
|
||||||
|
|
||||||
|
if test "x$grub_cv_check_uscore_end_symbol" = xyes; then
|
||||||
|
AC_DEFINE(HAVE_USCORE_END_SYMBOL, 1, [Define if end is defined])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl grub_DEFINE_FILE(MACRO_NAME, FILE_NAME, DESCRIPTION)
|
||||||
|
dnl grub_DEFINE_FILE defines a macro as the contents of a file safely.
|
||||||
|
dnl Replace some escape sequences, because autoconf doesn't handle them
|
||||||
|
dnl gracefully.
|
||||||
|
dnl Written by OKUJI Yoshinori.
|
||||||
|
AC_DEFUN([grub_DEFINE_FILE],
|
||||||
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
|
# Because early versions of GNU sed 3.x are too buggy, use a C program
|
||||||
|
# instead of shell commands. *sigh*
|
||||||
|
cat >conftest.c <<\EOF
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
{
|
{
|
||||||
int nestedfunc (void) { return i; }
|
int c;
|
||||||
f (nestedfunc);
|
|
||||||
|
while ((c = getchar ()) != EOF)
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '\n':
|
||||||
|
fputs ("\\n", stdout);
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
fputs ("\\r", stdout);
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
fputs ("\\\\", stdout);
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
fputs ("\\\"", stdout);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
putchar (c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]])
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
|
|
||||||
true
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
|
|
||||||
fi
|
|
||||||
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then
|
|
||||||
AC_DEFINE([NEED_ENABLE_EXECUTE_STACK], 1,
|
|
||||||
[Define to 1 if GCC generates calls to __enable_execute_stack()])
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
|
||||||
rm -f conftest*
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-fstack-protector'.
|
|
||||||
AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
|
||||||
[# Smashing stack protector.
|
|
||||||
ssp_possible=yes]
|
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
|
||||||
# Is this a reliable test case?
|
|
||||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
|
||||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
|
||||||
# `ac_compile' like this correct, after all?
|
|
||||||
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
|
||||||
rm -f conftest.s
|
|
||||||
else
|
|
||||||
ssp_possible=no]
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
[fi]
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin).
|
|
||||||
AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
|
||||||
[# Smashing stack arg probe.
|
|
||||||
sap_possible=yes]
|
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
|
||||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
|
||||||
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
|
||||||
rm -f conftest.s
|
|
||||||
else
|
|
||||||
sap_possible=no]
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
[fi]
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Check if ln can handle directories properly (mingw).
|
|
||||||
AC_DEFUN([grub_CHECK_LINK_DIR],[
|
|
||||||
AC_MSG_CHECKING([whether ln can handle directories properly])
|
|
||||||
[mkdir testdir 2>/dev/null
|
|
||||||
case $srcdir in
|
|
||||||
[\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;;
|
|
||||||
*) reldir=../$srcdir/include/grub/util ;;
|
|
||||||
esac
|
|
||||||
if ln -s $reldir testdir/util 2>/dev/null ; then]
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
[link_dir=yes
|
|
||||||
else
|
|
||||||
link_dir=no]
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
[fi
|
|
||||||
rm -rf testdir]
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-fPIE'.
|
|
||||||
AC_DEFUN([grub_CHECK_PIE],[
|
|
||||||
[# Position independent executable.
|
|
||||||
pie_possible=yes]
|
|
||||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
|
||||||
# Is this a reliable test case?
|
|
||||||
AC_LANG_CONFTEST([[
|
|
||||||
#ifdef __PIE__
|
|
||||||
int main() {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
EOF
|
||||||
#error NO __PIE__ DEFINED
|
|
||||||
#endif
|
|
||||||
]])
|
|
||||||
|
|
||||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} conftest.c -o conftest]) && test -s conftest; then
|
||||||
# `ac_compile' like this correct, after all?
|
grub_tmp_value=`./conftest < "[$2]"`
|
||||||
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
|
||||||
rm -f conftest.s
|
|
||||||
else
|
else
|
||||||
pie_possible=no]
|
AC_MSG_ERROR([${CC-cc} failed to produce an executable file])
|
||||||
AC_MSG_RESULT([no])
|
fi
|
||||||
[fi]
|
|
||||||
|
AC_DEFINE_UNQUOTED([$1], "$grub_tmp_value", [$3])
|
||||||
|
rm -f conftest*
|
||||||
])
|
])
|
||||||
+2
-16
@@ -1,23 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -ex
|
||||||
set -e
|
|
||||||
|
|
||||||
aclocal
|
aclocal
|
||||||
autoconf
|
autoconf
|
||||||
autoheader
|
autoheader
|
||||||
|
automake -a -c -f
|
||||||
# FIXME: automake doesn't like that there's no Makefile.am
|
|
||||||
automake -a -c -f || true
|
|
||||||
|
|
||||||
echo timestamp > stamp-h.in
|
|
||||||
|
|
||||||
python util/import_gcry.py lib/libgcrypt/ .
|
|
||||||
|
|
||||||
for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do
|
|
||||||
if test -e $rmk ; then
|
|
||||||
ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
sh gendistlist.sh > DISTLIST
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
/* -*-Asm-*- */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#include <multiboot.h>
|
|
||||||
|
|
||||||
.file "cdboot.S"
|
|
||||||
|
|
||||||
#define CODE_ADDR 0x6000
|
|
||||||
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
|
|
||||||
|
|
||||||
#define CDSEC_SHIFT 11
|
|
||||||
#define CDBLK_LENG 16
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.code16
|
|
||||||
|
|
||||||
.globl start, _start
|
|
||||||
|
|
||||||
start:
|
|
||||||
_start:
|
|
||||||
call LOCAL(next)
|
|
||||||
|
|
||||||
LOCAL(next):
|
|
||||||
jmp 1f
|
|
||||||
|
|
||||||
. = start + 8
|
|
||||||
|
|
||||||
bi_pvd:
|
|
||||||
.long 0 /* LBA of primary volume descriptor. */
|
|
||||||
bi_file:
|
|
||||||
.long 0 /* LBA of boot file. */
|
|
||||||
bi_length:
|
|
||||||
.long 0 /* Length of boot file. */
|
|
||||||
bi_csum:
|
|
||||||
.long 0 /* Checksum of boot file */
|
|
||||||
bi_reserved:
|
|
||||||
.space (10*4) /* Reserved */
|
|
||||||
|
|
||||||
1:
|
|
||||||
popw %bx
|
|
||||||
|
|
||||||
/* Boot from CDROM. */
|
|
||||||
|
|
||||||
xorw %ax, %ax
|
|
||||||
movw %ax, %ss
|
|
||||||
movw $(CODE_ADDR), %sp
|
|
||||||
movw %ax, %ds
|
|
||||||
movw %ax, %es
|
|
||||||
|
|
||||||
movw $(0x7C00 + err_noboot_msg - start), %si
|
|
||||||
movl %cs: bi_length - LOCAL(next)(%bx), %ecx
|
|
||||||
orl %ecx, %ecx
|
|
||||||
jz LOCAL(fail)
|
|
||||||
|
|
||||||
addl $((1 << CDSEC_SHIFT) - 1), %ecx
|
|
||||||
shrl $CDSEC_SHIFT, %ecx
|
|
||||||
|
|
||||||
movl %cs: bi_file - LOCAL(next)(%bx), %esi
|
|
||||||
|
|
||||||
call LOCAL(read_cdrom)
|
|
||||||
|
|
||||||
ljmp $(DATA_ADDR >> 4), $0
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parameters:
|
|
||||||
* esi: start sector
|
|
||||||
* ecx: number of sectors
|
|
||||||
*/
|
|
||||||
LOCAL(read_cdrom):
|
|
||||||
xorl %eax, %eax
|
|
||||||
|
|
||||||
/* Number of blocks to read. */
|
|
||||||
pushw $CDBLK_LENG
|
|
||||||
|
|
||||||
/* Block number. */
|
|
||||||
pushl %eax
|
|
||||||
pushl %esi
|
|
||||||
|
|
||||||
/* Buffer address. */
|
|
||||||
pushw $((DATA_ADDR - 0x400)>> 4)
|
|
||||||
pushl %eax
|
|
||||||
pushw $0x10
|
|
||||||
|
|
||||||
xorl %edi, %edi
|
|
||||||
movw %sp, %si
|
|
||||||
|
|
||||||
1:
|
|
||||||
movw 0x10(%si), %di
|
|
||||||
cmpl %ecx, %edi
|
|
||||||
jbe 2f
|
|
||||||
movl %ecx, %edi
|
|
||||||
|
|
||||||
2:
|
|
||||||
mov %di, 2(%si)
|
|
||||||
|
|
||||||
pushl %ecx
|
|
||||||
|
|
||||||
movb $0x42, %ah
|
|
||||||
int $0x13
|
|
||||||
|
|
||||||
jnc 3f
|
|
||||||
|
|
||||||
movb $0x42, %ah /* Try again. */
|
|
||||||
int $0x13
|
|
||||||
|
|
||||||
jnc 3f
|
|
||||||
|
|
||||||
2:
|
|
||||||
shrw $1, %di /* Reduce transfer size. */
|
|
||||||
jz LOCAL(cdrom_fail)
|
|
||||||
movw %di, 0x10(%si)
|
|
||||||
movw %di, 2(%si)
|
|
||||||
movb $0x42, %ah
|
|
||||||
int $0x13
|
|
||||||
jc 2b
|
|
||||||
|
|
||||||
3:
|
|
||||||
|
|
||||||
movw %di, %ax
|
|
||||||
shlw $(CDSEC_SHIFT - 4), %ax
|
|
||||||
addw %ax, 6(%si)
|
|
||||||
addl %edi, 8(%si)
|
|
||||||
|
|
||||||
popl %ecx
|
|
||||||
subl %edi, %ecx
|
|
||||||
jnz 1b
|
|
||||||
|
|
||||||
addw $0x12, %sp
|
|
||||||
ret
|
|
||||||
|
|
||||||
LOCAL(cdrom_fail):
|
|
||||||
movw $(0x7C00 + err_cdfail_msg - start), %si
|
|
||||||
|
|
||||||
LOCAL(fail):
|
|
||||||
movb $0x0e, %ah
|
|
||||||
xorw %bx, %bx
|
|
||||||
1:
|
|
||||||
lodsb (%si), %al
|
|
||||||
int $0x10
|
|
||||||
cmpb $0, %al
|
|
||||||
jne 1b
|
|
||||||
1: jmp 1b
|
|
||||||
|
|
||||||
err_noboot_msg:
|
|
||||||
.ascii "no boot info\0"
|
|
||||||
|
|
||||||
err_cdfail_msg:
|
|
||||||
.ascii "cdrom read fails\0"
|
|
||||||
|
|
||||||
. = start + 0x1FF
|
|
||||||
|
|
||||||
.byte 0
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
/* -*-Asm-*- */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#include <multiboot.h>
|
|
||||||
|
|
||||||
.file "lnxboot.S"
|
|
||||||
|
|
||||||
#define CODE_ADDR 0x6000
|
|
||||||
#define CODE_SECTORS 1
|
|
||||||
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
|
|
||||||
|
|
||||||
#define BLCK_LENG 0x4000
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.code16
|
|
||||||
|
|
||||||
.globl start, _start
|
|
||||||
|
|
||||||
data_start:
|
|
||||||
xorl %ebp, %ebp
|
|
||||||
jmp LOCAL(linux_next)
|
|
||||||
|
|
||||||
. = data_start + 0x1F1
|
|
||||||
|
|
||||||
setup_sects:
|
|
||||||
.byte CODE_SECTORS
|
|
||||||
root_flags:
|
|
||||||
.word 0
|
|
||||||
syssize:
|
|
||||||
.word 0
|
|
||||||
swap_dev:
|
|
||||||
.word 0
|
|
||||||
ram_size:
|
|
||||||
.word 0
|
|
||||||
vid_mode:
|
|
||||||
.word 0
|
|
||||||
root_dev:
|
|
||||||
.word 0
|
|
||||||
boot_flag:
|
|
||||||
.word 0xAA55
|
|
||||||
|
|
||||||
start:
|
|
||||||
_start:
|
|
||||||
|
|
||||||
jmp LOCAL(linux_init)
|
|
||||||
|
|
||||||
.ascii "HdrS" /* Header signature. */
|
|
||||||
.word 0x0203 /* Header version number. */
|
|
||||||
|
|
||||||
realmode_swtch:
|
|
||||||
.word 0, 0 /* default_switch, SETUPSEG. */
|
|
||||||
start_sys_seg:
|
|
||||||
.word 0x1000 /* Obsolete. */
|
|
||||||
version_ptr:
|
|
||||||
.word 0 /* Version string ptr. */
|
|
||||||
type_of_loader:
|
|
||||||
.byte 0 /* Filled in by boot loader. */
|
|
||||||
loadflags:
|
|
||||||
.byte 1 /* Please load high. */
|
|
||||||
setup_move_size:
|
|
||||||
.word 0 /* Unused. */
|
|
||||||
code32_start:
|
|
||||||
.long 0x100000 /* 32-bit start address. */
|
|
||||||
ramdisk_image:
|
|
||||||
.long 0 /* Loaded ramdisk image address. */
|
|
||||||
ramdisk_size:
|
|
||||||
.long 0 /* Size of loaded ramdisk. */
|
|
||||||
bootsect_kludge:
|
|
||||||
.word 0, 0
|
|
||||||
heap_end_ptr:
|
|
||||||
.word 0
|
|
||||||
pad1:
|
|
||||||
.word 0
|
|
||||||
cmd_line_ptr:
|
|
||||||
.long 0 /* Command line. */
|
|
||||||
ramdisk_max:
|
|
||||||
.long 0xffffffff /* Highest allowed ramdisk address. */
|
|
||||||
|
|
||||||
gdt:
|
|
||||||
.long 0, 0, 0, 0 /* Must be zero. */
|
|
||||||
.word 0xffff /* 64 K segment size. */
|
|
||||||
gdt_src1:
|
|
||||||
.byte 0, 0 ,0 /* Low 24 bits of source address. */
|
|
||||||
.byte 0x93 /* Access rights. */
|
|
||||||
.byte 0 /* Extended access rights. */
|
|
||||||
gdt_src2:
|
|
||||||
.byte 0 /* High 8 bits of source address. */
|
|
||||||
.word 0xffff /* 64 K segment size. */
|
|
||||||
gdt_dst1:
|
|
||||||
.byte 0, 0, 0 /* Low 24 bits of target address. */
|
|
||||||
.byte 0x93 /* Access rights. */
|
|
||||||
.byte 0 /* Extended access rights. */
|
|
||||||
gdt_dst2:
|
|
||||||
.byte 0 /* High 8 bits of source address. */
|
|
||||||
.long 0, 0, 0, 0 /* More space for the BIOS. */
|
|
||||||
|
|
||||||
reg_edx:
|
|
||||||
.byte 0x80, 0, 0xFF, 0xFF
|
|
||||||
|
|
||||||
data_leng:
|
|
||||||
.long 0
|
|
||||||
|
|
||||||
LOCAL(linux_init):
|
|
||||||
movw %cs:(reg_edx - start), %dx
|
|
||||||
movl %cs:(code32_start - start), %ebp
|
|
||||||
|
|
||||||
LOCAL(linux_next):
|
|
||||||
|
|
||||||
call LOCAL(normalize)
|
|
||||||
|
|
||||||
LOCAL(normalize):
|
|
||||||
popw %bx
|
|
||||||
subw $(LOCAL(normalize) - start), %bx
|
|
||||||
shrw $4, %bx
|
|
||||||
movw %cs, %ax
|
|
||||||
addw %bx, %ax
|
|
||||||
pushw %ax
|
|
||||||
pushw $(real_code - start)
|
|
||||||
lret /* Jump to real_code. */
|
|
||||||
|
|
||||||
real_code:
|
|
||||||
subw $0x20, %ax
|
|
||||||
movw %ax, %ds
|
|
||||||
movw (setup_sects - data_start), %cx
|
|
||||||
shlw $7, %cx
|
|
||||||
|
|
||||||
/* Setup stack. */
|
|
||||||
|
|
||||||
xorw %si, %si
|
|
||||||
movw %si, %ss
|
|
||||||
movw $(CODE_ADDR), %sp
|
|
||||||
|
|
||||||
/* Move itself to 0:CODE_ADDR. */
|
|
||||||
|
|
||||||
cld
|
|
||||||
movw %cs, %ax
|
|
||||||
movw %ax, %ds
|
|
||||||
movw $(CODE_ADDR >> 4), %ax
|
|
||||||
movw %ax, %es
|
|
||||||
movw %si, %di
|
|
||||||
|
|
||||||
rep
|
|
||||||
movsl
|
|
||||||
ljmp $(CODE_ADDR >> 4), $(real_code_2 - start)
|
|
||||||
|
|
||||||
real_code_2:
|
|
||||||
|
|
||||||
xchgl %ebp, %esi
|
|
||||||
orl %esi, %esi
|
|
||||||
jnz 1f
|
|
||||||
movw %ds, %si
|
|
||||||
shll $4, %esi
|
|
||||||
addl %ebp, %esi
|
|
||||||
1:
|
|
||||||
|
|
||||||
pushw %es
|
|
||||||
popw %ds
|
|
||||||
|
|
||||||
movl $0x200, %ecx
|
|
||||||
addl %ecx, %esi
|
|
||||||
movl $DATA_ADDR, %edi
|
|
||||||
|
|
||||||
call LOCAL(move_memory)
|
|
||||||
|
|
||||||
/* Check for multiboot signature. */
|
|
||||||
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
|
||||||
jz 1f
|
|
||||||
|
|
||||||
movl (ramdisk_image - start), %esi
|
|
||||||
movl (ramdisk_size - start), %ecx
|
|
||||||
movl $(DATA_ADDR - 0x200), %edi
|
|
||||||
jmp 2f
|
|
||||||
|
|
||||||
1:
|
|
||||||
|
|
||||||
movl %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE), %ecx
|
|
||||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
|
||||||
|
|
||||||
2:
|
|
||||||
call LOCAL(move_memory)
|
|
||||||
|
|
||||||
movsbl %dh, %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
|
||||||
movsbl (reg_edx + 2 - start), %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
|
||||||
|
|
||||||
movb $0xFF, %dh
|
|
||||||
|
|
||||||
ljmp $(DATA_ADDR >> 4), $0
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parameters:
|
|
||||||
* esi: source address
|
|
||||||
* edi: target address
|
|
||||||
* ecx: number of bytes
|
|
||||||
*/
|
|
||||||
|
|
||||||
LOCAL(move_memory):
|
|
||||||
incl %ecx
|
|
||||||
andb $0xFE, %cl
|
|
||||||
pushw %dx
|
|
||||||
1:
|
|
||||||
pushl %esi
|
|
||||||
pushl %edi
|
|
||||||
pushl %ecx
|
|
||||||
cmpl $BLCK_LENG, %ecx
|
|
||||||
jbe 2f
|
|
||||||
movl $BLCK_LENG, %ecx
|
|
||||||
2:
|
|
||||||
pushl %ecx
|
|
||||||
|
|
||||||
movl %esi, %eax
|
|
||||||
movw %si, (gdt_src1 - start)
|
|
||||||
shrl $16, %eax
|
|
||||||
movb %al, (gdt_src1 + 2 - start)
|
|
||||||
movb %ah, (gdt_src2 - start)
|
|
||||||
|
|
||||||
movl %edi, %eax
|
|
||||||
movw %di, (gdt_dst1 - start)
|
|
||||||
shrl $16, %eax
|
|
||||||
movb %al, (gdt_dst1 + 2 - start)
|
|
||||||
movb %ah, (gdt_dst2 - start)
|
|
||||||
|
|
||||||
movw $(gdt - start), %si
|
|
||||||
movb $0x87, %ah
|
|
||||||
shrw $1, %cx
|
|
||||||
|
|
||||||
int $0x15
|
|
||||||
|
|
||||||
popl %eax
|
|
||||||
popl %ecx
|
|
||||||
popl %edi
|
|
||||||
popl %esi
|
|
||||||
|
|
||||||
jnc 2f
|
|
||||||
movw $(err_int15_msg - start), %si
|
|
||||||
jmp LOCAL(fail)
|
|
||||||
|
|
||||||
2:
|
|
||||||
|
|
||||||
addl %eax, %esi
|
|
||||||
addl %eax, %edi
|
|
||||||
subl %eax, %ecx
|
|
||||||
jnz 1b
|
|
||||||
|
|
||||||
|
|
||||||
popw %dx
|
|
||||||
ret
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parameters:
|
|
||||||
* si: message
|
|
||||||
*/
|
|
||||||
|
|
||||||
LOCAL(fail):
|
|
||||||
movb $0x0e, %ah
|
|
||||||
xorw %bx, %bx
|
|
||||||
1:
|
|
||||||
lodsb (%si), %al
|
|
||||||
int $0x10
|
|
||||||
cmpb $0, %al
|
|
||||||
jne 1b
|
|
||||||
1: jmp 1b
|
|
||||||
|
|
||||||
err_int15_msg:
|
|
||||||
.ascii "move memory fails\0"
|
|
||||||
|
|
||||||
. = _start + CODE_SECTORS * 512
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#include <grub/machine/boot.h>
|
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
|
|
||||||
.text
|
|
||||||
.code16
|
|
||||||
.globl _start
|
|
||||||
_start:
|
|
||||||
/* Disable interrupts. */
|
|
||||||
cli
|
|
||||||
|
|
||||||
jmp 1f
|
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR
|
|
||||||
VARIABLE(grub_core_entry_addr)
|
|
||||||
.long 0
|
|
||||||
1:
|
|
||||||
|
|
||||||
/* Process VGA rom. */
|
|
||||||
call $0xc000, $0x3
|
|
||||||
|
|
||||||
/* Set up %ds, %ss, and %es. */
|
|
||||||
xorw %ax, %ax
|
|
||||||
movw %ax, %ds
|
|
||||||
movw %ax, %ss
|
|
||||||
movw %ax, %es
|
|
||||||
|
|
||||||
/* Set up the real mode stack. */
|
|
||||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %esp
|
|
||||||
|
|
||||||
/* Transition to protected mode. We use pushl to force generation
|
|
||||||
of a flat return address. */
|
|
||||||
pushl $1f
|
|
||||||
DATA32 jmp real_to_prot
|
|
||||||
.code32
|
|
||||||
1:
|
|
||||||
movl grub_core_entry_addr, %edx
|
|
||||||
jmp *%edx
|
|
||||||
|
|
||||||
#include "../../../kern/i386/realmode.S"
|
|
||||||
|
|
||||||
/* Intel, in its infinite wisdom, decided to put the i8086 entry point
|
|
||||||
*right here* and this is why we need this kludge. */
|
|
||||||
|
|
||||||
. = GRUB_BOOT_MACHINE_SIZE - 16
|
|
||||||
jmp _start
|
|
||||||
. = GRUB_BOOT_MACHINE_SIZE
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
/* -*-Asm-*- */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl _start
|
|
||||||
_start:
|
|
||||||
/* OF CIF entry point arrives in %o4 */
|
|
||||||
pic_base:
|
|
||||||
call boot_continue
|
|
||||||
mov %o4, CIF_REG
|
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_VER_MAJ
|
|
||||||
boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
|
||||||
|
|
||||||
/* The offsets to these locations are defined by the
|
|
||||||
* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
|
|
||||||
* and grub-setup uses this to patch these next three values as needed.
|
|
||||||
*
|
|
||||||
* The boot_path will be the OF device path of the partition where the
|
|
||||||
* rest of the GRUB kernel image resides. kernel_sector will be set to
|
|
||||||
* the location of the first block of the GRUB kernel, and
|
|
||||||
* kernel_address is the location where we should load that first block.
|
|
||||||
*
|
|
||||||
* After loading in that block we will execute it by jumping to the
|
|
||||||
* load address plus the size of the prepended A.OUT header (32 bytes).
|
|
||||||
*/
|
|
||||||
boot_path:
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
|
|
||||||
kernel_sector: .xword 2
|
|
||||||
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
|
||||||
|
|
||||||
prom_finddev_name: .asciz "finddevice"
|
|
||||||
prom_chosen_path: .asciz "/chosen"
|
|
||||||
prom_getprop_name: .asciz "getprop"
|
|
||||||
prom_stdout_name: .asciz "stdout"
|
|
||||||
prom_write_name: .asciz "write"
|
|
||||||
prom_bootpath_name: .asciz "bootpath"
|
|
||||||
prom_open_name: .asciz "open"
|
|
||||||
prom_seek_name: .asciz "seek"
|
|
||||||
prom_read_name: .asciz "read"
|
|
||||||
prom_exit_name: .asciz "exit"
|
|
||||||
grub_name: .asciz "GRUB "
|
|
||||||
#define GRUB_NAME_LEN 5
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
prom_open_error:
|
|
||||||
GET_ABS(prom_open_name, %o2)
|
|
||||||
call console_write
|
|
||||||
mov 4, %o3
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
prom_error:
|
|
||||||
GET_ABS(prom_exit_name, %o0)
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
/* %o0: OF call name
|
|
||||||
* %o1: input arg 1
|
|
||||||
*/
|
|
||||||
prom_call_1_1:
|
|
||||||
mov 1, %g1
|
|
||||||
ba prom_call
|
|
||||||
mov 1, %o5
|
|
||||||
|
|
||||||
/* %o2: message string
|
|
||||||
* %o3: message length
|
|
||||||
*/
|
|
||||||
console_write:
|
|
||||||
GET_ABS(prom_write_name, %o0)
|
|
||||||
mov STDOUT_NODE_REG, %o1
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
/* %o0: OF call name
|
|
||||||
* %o1: input arg 1
|
|
||||||
* %o2: input arg 2
|
|
||||||
* %o3: input arg 3
|
|
||||||
*/
|
|
||||||
prom_call_3_1:
|
|
||||||
mov 3, %g1
|
|
||||||
mov 1, %o5
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
/* %o0: OF call name
|
|
||||||
* %g1: num inputs
|
|
||||||
* %o5: num outputs
|
|
||||||
* %o1-%o4: inputs
|
|
||||||
*/
|
|
||||||
prom_call:
|
|
||||||
stx %o0, [%l1 + 0x00]
|
|
||||||
stx %g1, [%l1 + 0x08]
|
|
||||||
stx %o5, [%l1 + 0x10]
|
|
||||||
stx %o1, [%l1 + 0x18]
|
|
||||||
stx %o2, [%l1 + 0x20]
|
|
||||||
stx %o3, [%l1 + 0x28]
|
|
||||||
stx %o4, [%l1 + 0x30]
|
|
||||||
jmpl CIF_REG, %g0
|
|
||||||
mov %l1, %o0
|
|
||||||
|
|
||||||
boot_continue:
|
|
||||||
mov %o7, PIC_REG /* PIC base */
|
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
|
||||||
|
|
||||||
/* Find the /chosen node so we can fetch the stdout handle,
|
|
||||||
* and thus perform console output.
|
|
||||||
*
|
|
||||||
* chosen_node = prom_finddevice("/chosen")
|
|
||||||
*/
|
|
||||||
GET_ABS(prom_finddev_name, %o0)
|
|
||||||
GET_ABS(prom_chosen_path, %o1)
|
|
||||||
call prom_call_1_1
|
|
||||||
clr %o2
|
|
||||||
|
|
||||||
ldx [%l1 + 0x20], CHOSEN_NODE_REG
|
|
||||||
brz CHOSEN_NODE_REG, prom_error
|
|
||||||
|
|
||||||
/* getprop(chosen_node, "stdout", &buffer, buffer_size) */
|
|
||||||
GET_ABS(prom_getprop_name, %o0)
|
|
||||||
mov 4, %g1
|
|
||||||
mov 1, %o5
|
|
||||||
mov CHOSEN_NODE_REG, %o1
|
|
||||||
GET_ABS(prom_stdout_name, %o2)
|
|
||||||
add %l1, 256, %o3
|
|
||||||
mov 1024, %o4
|
|
||||||
call prom_call
|
|
||||||
stx %g1, [%l1 + 256]
|
|
||||||
|
|
||||||
lduw [%l1 + 256], STDOUT_NODE_REG
|
|
||||||
brz,pn STDOUT_NODE_REG, prom_error
|
|
||||||
|
|
||||||
/* write(stdout_node, "GRUB ", strlen("GRUB ")) */
|
|
||||||
GET_ABS(grub_name, %o2)
|
|
||||||
call console_write
|
|
||||||
mov GRUB_NAME_LEN, %o3
|
|
||||||
|
|
||||||
/* Open up the boot_path, and use that handle to read the
|
|
||||||
* first block of the GRUB kernel image.
|
|
||||||
*
|
|
||||||
* bootdev_handle = open(boot_path)
|
|
||||||
*/
|
|
||||||
GET_ABS(prom_open_name, %o0)
|
|
||||||
GET_ABS(boot_path, %o1)
|
|
||||||
call prom_call_1_1
|
|
||||||
clr %o2
|
|
||||||
|
|
||||||
ldx [%l1 + 0x20], BOOTDEV_REG
|
|
||||||
brz,pn BOOTDEV_REG, prom_open_error
|
|
||||||
|
|
||||||
/* Since we have 64-bit cells, the high cell of the seek offset
|
|
||||||
* is zero and the low cell is the entire value.
|
|
||||||
*
|
|
||||||
* seek(bootdev, 0, *kernel_sector << 9)
|
|
||||||
*/
|
|
||||||
GET_ABS(prom_seek_name, %o0)
|
|
||||||
mov BOOTDEV_REG, %o1
|
|
||||||
clr %o2
|
|
||||||
LDX_ABS(kernel_sector, 0x00, %o3)
|
|
||||||
call prom_call_3_1
|
|
||||||
sllx %o3, 9, %o3
|
|
||||||
|
|
||||||
/* read(bootdev, *kernel_address, 512) */
|
|
||||||
GET_ABS(prom_read_name, %o0)
|
|
||||||
mov BOOTDEV_REG, %o1
|
|
||||||
LDUW_ABS(kernel_address, 0x00, %o2)
|
|
||||||
call prom_call_3_1
|
|
||||||
mov 512, %o3
|
|
||||||
|
|
||||||
LDUW_ABS(kernel_address, 0x00, %o2)
|
|
||||||
jmpl %o2, %o7
|
|
||||||
nop
|
|
||||||
|
|
||||||
1: ba,a 1b
|
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_CODE_END
|
|
||||||
|
|
||||||
/* the last 4 bytes in the sector 0 contain the signature */
|
|
||||||
.word GRUB_BOOT_MACHINE_SIGNATURE
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
/* -*-Asm-*- */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
.globl _start
|
|
||||||
_start:
|
|
||||||
/* First stage boot block jumps to us here. */
|
|
||||||
pic_base:
|
|
||||||
call after_info_block
|
|
||||||
mov %o7, PIC_REG
|
|
||||||
|
|
||||||
prom_write_name: .asciz "write"
|
|
||||||
prom_seek_name: .asciz "seek"
|
|
||||||
prom_read_name: .asciz "read"
|
|
||||||
prom_close_name: .asciz "close"
|
|
||||||
|
|
||||||
notification_string: .asciz "Loading kernel"
|
|
||||||
#define NOTIFICATION_STRING_LEN 14
|
|
||||||
|
|
||||||
notification_step: .asciz "."
|
|
||||||
#define NOTIFICATION_STEP_LEN 1
|
|
||||||
|
|
||||||
notification_done: .asciz "\r\n"
|
|
||||||
#define NOTIFICATION_DONE_LEN 2
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
/* %o2: message string
|
|
||||||
* %o3: message length
|
|
||||||
*/
|
|
||||||
console_write:
|
|
||||||
GET_ABS(prom_write_name, %o0)
|
|
||||||
mov STDOUT_NODE_REG, %o1
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
/* %o0: OF call name
|
|
||||||
* %o1: input arg 1
|
|
||||||
* %o2: input arg 2
|
|
||||||
* %o3: input arg 3
|
|
||||||
*/
|
|
||||||
prom_call_3_1:
|
|
||||||
mov 3, %g1
|
|
||||||
mov 1, %o5
|
|
||||||
/* fallthru */
|
|
||||||
|
|
||||||
/* %o0: OF call name
|
|
||||||
* %g1: num inputs
|
|
||||||
* %o5: num outputs
|
|
||||||
* %o1-%o4: inputs
|
|
||||||
*/
|
|
||||||
prom_call:
|
|
||||||
stx %o0, [%l1 + 0x00]
|
|
||||||
stx %g1, [%l1 + 0x08]
|
|
||||||
stx %o5, [%l1 + 0x10]
|
|
||||||
stx %o1, [%l1 + 0x18]
|
|
||||||
stx %o2, [%l1 + 0x20]
|
|
||||||
stx %o3, [%l1 + 0x28]
|
|
||||||
stx %o4, [%l1 + 0x30]
|
|
||||||
jmpl CIF_REG, %g0
|
|
||||||
mov %l1, %o0
|
|
||||||
|
|
||||||
|
|
||||||
after_info_block:
|
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
|
||||||
|
|
||||||
GET_ABS(notification_string, %o2)
|
|
||||||
call console_write
|
|
||||||
mov NOTIFICATION_STRING_LEN, %o3
|
|
||||||
|
|
||||||
GET_ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE, %l2)
|
|
||||||
set GRUB_BOOT_MACHINE_IMAGE_ADDRESS, %l3
|
|
||||||
bootloop:
|
|
||||||
lduw [%l2 + 0x08], %o0
|
|
||||||
brz %o0, bootit
|
|
||||||
lduw [%l2 + 0x00], %o3
|
|
||||||
sllx %o3, 32, %o3
|
|
||||||
lduw [%l2 + 0x04], %o4
|
|
||||||
or %o3, %o4, %o3
|
|
||||||
GET_ABS(prom_seek_name, %o0)
|
|
||||||
mov BOOTDEV_REG, %o1
|
|
||||||
clr %o2
|
|
||||||
call prom_call_3_1
|
|
||||||
sllx %o3, 9, %o3
|
|
||||||
|
|
||||||
GET_ABS(prom_read_name, %o0)
|
|
||||||
mov BOOTDEV_REG, %o1
|
|
||||||
lduw [%l2 + 0x08], %o3
|
|
||||||
sllx %o3, 9, %o3
|
|
||||||
mov %l3, %o2
|
|
||||||
call prom_call_3_1
|
|
||||||
add %l3, %o3, %l3
|
|
||||||
|
|
||||||
GET_ABS(notification_step, %o2)
|
|
||||||
call console_write
|
|
||||||
mov NOTIFICATION_STEP_LEN, %o3
|
|
||||||
|
|
||||||
ba bootloop
|
|
||||||
sub %l2, GRUB_BOOT_MACHINE_LIST_SIZE, %l2
|
|
||||||
|
|
||||||
bootit:
|
|
||||||
GET_ABS(prom_close_name, %o0)
|
|
||||||
mov 1, %g1
|
|
||||||
mov 0, %o5
|
|
||||||
call prom_call
|
|
||||||
mov BOOTDEV_REG, %o1
|
|
||||||
|
|
||||||
GET_ABS(notification_done, %o2)
|
|
||||||
call console_write
|
|
||||||
mov NOTIFICATION_DONE_LEN, %o3
|
|
||||||
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
|
||||||
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
|
||||||
mov CIF_REG, %o0
|
|
||||||
1: ba,a 1b
|
|
||||||
|
|
||||||
lastlist:
|
|
||||||
.word 0
|
|
||||||
.word 0
|
|
||||||
|
|
||||||
. = _start + (0x200 - GRUB_BOOT_MACHINE_LIST_SIZE)
|
|
||||||
blocklist_default_start:
|
|
||||||
.word 0
|
|
||||||
.word 2
|
|
||||||
blocklist_default_len:
|
|
||||||
.word 0
|
|
||||||
firstlist:
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/* bonito.c - PCI bonito interface. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN];
|
|
||||||
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
|
||||||
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE,
|
|
||||||
GRUB_MACHINE_PCI_WIN_SIZE};
|
|
||||||
/* Usage counters. */
|
|
||||||
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN];
|
|
||||||
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
|
||||||
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR,
|
|
||||||
GRUB_MACHINE_PCI_WIN3_ADDR};
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
write_bases (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_uint32_t reg = 0;
|
|
||||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
|
||||||
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
|
||||||
& GRUB_MACHINE_PCI_WIN_MASK)
|
|
||||||
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
|
||||||
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
volatile void *
|
|
||||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
|
||||||
grub_addr_t base, grub_size_t size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_addr_t newbase;
|
|
||||||
|
|
||||||
/* First try already used registers. */
|
|
||||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
|
||||||
if (usage_win[i] && base_win[i] <= base
|
|
||||||
&& base_win[i] + sizes_win[i] > base + size)
|
|
||||||
{
|
|
||||||
usage_win[i]++;
|
|
||||||
return (void *)
|
|
||||||
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
|
||||||
}
|
|
||||||
/* Map new register. */
|
|
||||||
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK;
|
|
||||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
|
||||||
if (!usage_win[i] && newbase <= base
|
|
||||||
&& newbase + sizes_win[i] > base + size)
|
|
||||||
{
|
|
||||||
usage_win[i]++;
|
|
||||||
base_win[i] = newbase;
|
|
||||||
write_bases ();
|
|
||||||
return (void *)
|
|
||||||
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
|
||||||
}
|
|
||||||
grub_fatal ("Out of PCI windows.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
|
||||||
volatile void *mem __attribute__ ((unused)),
|
|
||||||
grub_size_t size __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
|
||||||
if (usage_win[i] && addr_win[i]
|
|
||||||
== (((grub_addr_t) mem) & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
|
||||||
{
|
|
||||||
usage_win[i]--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
grub_fatal ("Tried to unmap not mapped region");
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
/* pci.c - Generic PCI interfaces. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
|
|
||||||
grub_pci_address_t
|
|
||||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
|
||||||
{
|
|
||||||
return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
|
|
||||||
| (dev.function << 8) | reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
|
||||||
{
|
|
||||||
grub_pci_device_t dev;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
grub_pci_id_t id;
|
|
||||||
grub_uint32_t hdr;
|
|
||||||
|
|
||||||
for (dev.bus = 0; dev.bus < GRUB_PCI_NUM_BUS; dev.bus++)
|
|
||||||
{
|
|
||||||
for (dev.device = 0; dev.device < GRUB_PCI_NUM_DEVICES; dev.device++)
|
|
||||||
{
|
|
||||||
for (dev.function = 0; dev.function < 8; dev.function++)
|
|
||||||
{
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_PCI_ID);
|
|
||||||
id = grub_pci_read (addr);
|
|
||||||
|
|
||||||
/* Check if there is a device present. */
|
|
||||||
if (id >> 16 == 0xFFFF)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (hook (dev, id))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Probe only func = 0 if the device if not multifunction */
|
|
||||||
if (dev.function == 0)
|
|
||||||
{
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE);
|
|
||||||
hdr = grub_pci_read (addr);
|
|
||||||
if (!(hdr & 0x800000))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-611
@@ -1,611 +0,0 @@
|
|||||||
/* ohci.c - OHCI Support. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/usbtrans.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/cpu/pci.h>
|
|
||||||
#include <grub/i386/io.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
|
|
||||||
struct grub_ohci_hcca
|
|
||||||
{
|
|
||||||
/* Pointers to Interrupt Endpoint Descriptors. Not used by
|
|
||||||
GRUB. */
|
|
||||||
grub_uint32_t inttable[32];
|
|
||||||
|
|
||||||
/* Current frame number. */
|
|
||||||
grub_uint16_t framenumber;
|
|
||||||
|
|
||||||
grub_uint16_t pad;
|
|
||||||
|
|
||||||
/* List of completed TDs. */
|
|
||||||
grub_uint32_t donehead;
|
|
||||||
|
|
||||||
grub_uint8_t reserved[116];
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
/* OHCI Endpoint Descriptor. */
|
|
||||||
struct grub_ohci_ed
|
|
||||||
{
|
|
||||||
grub_uint32_t target;
|
|
||||||
grub_uint32_t td_tail;
|
|
||||||
grub_uint32_t td_head;
|
|
||||||
grub_uint32_t next_ed;
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
struct grub_ohci_td
|
|
||||||
{
|
|
||||||
/* Information used to construct the TOKEN packet. */
|
|
||||||
grub_uint32_t token;
|
|
||||||
|
|
||||||
grub_uint32_t buffer;
|
|
||||||
grub_uint32_t next_td;
|
|
||||||
grub_uint32_t buffer_end;
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
typedef struct grub_ohci_td *grub_ohci_td_t;
|
|
||||||
typedef struct grub_ohci_ed *grub_ohci_ed_t;
|
|
||||||
|
|
||||||
struct grub_ohci
|
|
||||||
{
|
|
||||||
volatile grub_uint32_t *iobase;
|
|
||||||
volatile struct grub_ohci_hcca *hcca;
|
|
||||||
struct grub_ohci *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct grub_ohci *ohci;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GRUB_OHCI_REG_REVISION = 0x00,
|
|
||||||
GRUB_OHCI_REG_CONTROL,
|
|
||||||
GRUB_OHCI_REG_CMDSTATUS,
|
|
||||||
GRUB_OHCI_REG_INTSTATUS,
|
|
||||||
GRUB_OHCI_REG_INTENA,
|
|
||||||
GRUB_OHCI_REG_INTDIS,
|
|
||||||
GRUB_OHCI_REG_HCCA,
|
|
||||||
GRUB_OHCI_REG_PERIODIC,
|
|
||||||
GRUB_OHCI_REG_CONTROLHEAD,
|
|
||||||
GRUB_OHCI_REG_CONTROLCURR,
|
|
||||||
GRUB_OHCI_REG_BULKHEAD,
|
|
||||||
GRUB_OHCI_REG_BULKCURR,
|
|
||||||
GRUB_OHCI_REG_DONEHEAD,
|
|
||||||
GRUB_OHCI_REG_FRAME_INTERVAL,
|
|
||||||
GRUB_OHCI_REG_RHUBA = 18,
|
|
||||||
GRUB_OHCI_REG_RHUBPORT = 21
|
|
||||||
} grub_ohci_reg_t;
|
|
||||||
|
|
||||||
static grub_uint32_t
|
|
||||||
grub_ohci_readreg32 (struct grub_ohci *o, grub_ohci_reg_t reg)
|
|
||||||
{
|
|
||||||
return grub_le_to_cpu32 (*(o->iobase + reg));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_ohci_writereg32 (struct grub_ohci *o,
|
|
||||||
grub_ohci_reg_t reg, grub_uint32_t val)
|
|
||||||
{
|
|
||||||
*(o->iobase + reg) = grub_cpu_to_le32 (val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over all PCI devices. Determine if a device is an OHCI
|
|
||||||
controller. If this is the case, initialize it. */
|
|
||||||
static int NESTED_FUNC_ATTR
|
|
||||||
grub_ohci_pci_iter (grub_pci_device_t dev,
|
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
|
||||||
{
|
|
||||||
grub_uint32_t class_code;
|
|
||||||
grub_uint32_t class;
|
|
||||||
grub_uint32_t subclass;
|
|
||||||
grub_uint32_t interf;
|
|
||||||
grub_uint32_t base;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
struct grub_ohci *o;
|
|
||||||
grub_uint32_t revision;
|
|
||||||
grub_uint32_t frame_interval;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
|
||||||
subclass = (class_code >> 8) & 0xFF;
|
|
||||||
class = class_code >> 16;
|
|
||||||
|
|
||||||
/* If this is not an OHCI controller, just return. */
|
|
||||||
if (class != 0x0c || subclass != 0x03 || interf != 0x10)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Determine IO base address. */
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
|
||||||
base = grub_pci_read (addr);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Stop if there is no IO space base address defined. */
|
|
||||||
if (! (base & 1))
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Allocate memory for the controller and register it. */
|
|
||||||
o = grub_malloc (sizeof (*o));
|
|
||||||
if (! o)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
o->iobase = (grub_uint32_t *) base;
|
|
||||||
|
|
||||||
/* Reserve memory for the HCCA. */
|
|
||||||
o->hcca = (struct grub_ohci_hcca *) grub_memalign (256, 256);
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "class=0x%02x 0x%02x interface 0x%02x base=%p\n",
|
|
||||||
class, subclass, interf, o->iobase);
|
|
||||||
|
|
||||||
/* Check if the OHCI revision is actually 1.0 as supported. */
|
|
||||||
revision = grub_ohci_readreg32 (o, GRUB_OHCI_REG_REVISION);
|
|
||||||
grub_dprintf ("ohci", "OHCI revision=0x%02x\n", revision & 0xFF);
|
|
||||||
if ((revision & 0xFF) != 0x10)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* Backup the frame interval register. */
|
|
||||||
frame_interval = grub_ohci_readreg32 (o, GRUB_OHCI_REG_FRAME_INTERVAL);
|
|
||||||
|
|
||||||
/* Suspend the OHCI by issuing a reset. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, 1); /* XXX: Magic. */
|
|
||||||
grub_millisleep (1);
|
|
||||||
grub_dprintf ("ohci", "OHCI reset\n");
|
|
||||||
|
|
||||||
/* Restore the frame interval register. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_FRAME_INTERVAL, frame_interval);
|
|
||||||
|
|
||||||
/* Setup the HCCA. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_HCCA, (grub_uint32_t) o->hcca);
|
|
||||||
grub_dprintf ("ohci", "OHCI HCCA\n");
|
|
||||||
|
|
||||||
/* Enable the OHCI. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL,
|
|
||||||
(2 << 6));
|
|
||||||
grub_dprintf ("ohci", "OHCI enable: 0x%02x\n",
|
|
||||||
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) >> 6) & 3);
|
|
||||||
|
|
||||||
/* Link to ohci now that initialisation is successful. */
|
|
||||||
o->next = ohci;
|
|
||||||
ohci = o;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (o)
|
|
||||||
grub_free ((void *) o->hcca);
|
|
||||||
grub_free (o);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_ohci_inithw (void)
|
|
||||||
{
|
|
||||||
grub_pci_iterate (grub_ohci_pci_iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_ohci_iterate (int (*hook) (grub_usb_controller_t dev))
|
|
||||||
{
|
|
||||||
struct grub_ohci *o;
|
|
||||||
struct grub_usb_controller dev;
|
|
||||||
|
|
||||||
for (o = ohci; o; o = o->next)
|
|
||||||
{
|
|
||||||
dev.data = o;
|
|
||||||
if (hook (&dev))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_ohci_transaction (grub_ohci_td_t td,
|
|
||||||
grub_transfer_type_t type, unsigned int toggle,
|
|
||||||
grub_size_t size, char *data)
|
|
||||||
{
|
|
||||||
grub_uint32_t token;
|
|
||||||
grub_uint32_t buffer;
|
|
||||||
grub_uint32_t buffer_end;
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "OHCI transaction td=%p type=%d, toggle=%d, size=%d\n",
|
|
||||||
td, type, toggle, size);
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case GRUB_USB_TRANSFER_TYPE_SETUP:
|
|
||||||
token = 0 << 19;
|
|
||||||
break;
|
|
||||||
case GRUB_USB_TRANSFER_TYPE_IN:
|
|
||||||
token = 2 << 19;
|
|
||||||
break;
|
|
||||||
case GRUB_USB_TRANSFER_TYPE_OUT:
|
|
||||||
token = 1 << 19;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
token = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate no interrupts. */
|
|
||||||
token |= 7 << 21;
|
|
||||||
|
|
||||||
/* Set the token. */
|
|
||||||
token |= toggle << 24;
|
|
||||||
token |= 1 << 25;
|
|
||||||
|
|
||||||
buffer = (grub_uint32_t) data;
|
|
||||||
buffer_end = buffer + size - 1;
|
|
||||||
|
|
||||||
td->token = grub_cpu_to_le32 (token);
|
|
||||||
td->buffer = grub_cpu_to_le32 (buffer);
|
|
||||||
td->next_td = 0;
|
|
||||||
td->buffer_end = grub_cpu_to_le32 (buffer_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_usb_err_t
|
|
||||||
grub_ohci_transfer (grub_usb_controller_t dev,
|
|
||||||
grub_usb_transfer_t transfer)
|
|
||||||
{
|
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
|
||||||
grub_ohci_ed_t ed;
|
|
||||||
grub_ohci_td_t td_list;
|
|
||||||
grub_uint32_t target;
|
|
||||||
grub_uint32_t td_tail;
|
|
||||||
grub_uint32_t td_head;
|
|
||||||
grub_uint32_t status;
|
|
||||||
grub_uint32_t control;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Allocate an Endpoint Descriptor. */
|
|
||||||
ed = grub_memalign (16, sizeof (*ed));
|
|
||||||
if (! ed)
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
|
|
||||||
td_list = grub_memalign (16, sizeof (*td_list) * (transfer->transcnt + 1));
|
|
||||||
if (! td_list)
|
|
||||||
{
|
|
||||||
grub_free ((void *) ed);
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "alloc=%p\n", td_list);
|
|
||||||
|
|
||||||
/* Setup all Transfer Descriptors. */
|
|
||||||
for (i = 0; i < transfer->transcnt; i++)
|
|
||||||
{
|
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
|
||||||
|
|
||||||
grub_ohci_transaction (&td_list[i], tr->pid, tr->toggle,
|
|
||||||
tr->size, tr->data);
|
|
||||||
|
|
||||||
td_list[i].next_td = grub_cpu_to_le32 (&td_list[i + 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup the Endpoint Descriptor. */
|
|
||||||
|
|
||||||
/* Set the device address. */
|
|
||||||
target = transfer->devaddr;
|
|
||||||
|
|
||||||
/* Set the endpoint. */
|
|
||||||
target |= transfer->endpoint << 7;
|
|
||||||
|
|
||||||
/* Set the device speed. */
|
|
||||||
target |= (transfer->dev->speed == GRUB_USB_SPEED_LOW) << 13;
|
|
||||||
|
|
||||||
/* Set the maximum packet size. */
|
|
||||||
target |= transfer->max << 16;
|
|
||||||
|
|
||||||
td_head = (grub_uint32_t) td_list;
|
|
||||||
|
|
||||||
td_tail = (grub_uint32_t) &td_list[transfer->transcnt];
|
|
||||||
|
|
||||||
ed->target = grub_cpu_to_le32 (target);
|
|
||||||
ed->td_head = grub_cpu_to_le32 (td_head);
|
|
||||||
ed->td_tail = grub_cpu_to_le32 (td_tail);
|
|
||||||
ed->next_ed = grub_cpu_to_le32 (0);
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "program OHCI\n");
|
|
||||||
|
|
||||||
/* Program the OHCI to actually transfer. */
|
|
||||||
switch (transfer->type)
|
|
||||||
{
|
|
||||||
case GRUB_USB_TRANSACTION_TYPE_BULK:
|
|
||||||
{
|
|
||||||
grub_dprintf ("ohci", "add to bulk list\n");
|
|
||||||
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
|
||||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
|
||||||
|
|
||||||
/* Disable the Control and Bulk lists. */
|
|
||||||
control &= ~(3 << 4);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Clear BulkListFilled. */
|
|
||||||
status &= ~(1 << 2);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, (grub_uint32_t) ed);
|
|
||||||
|
|
||||||
/* Enable the Bulk list. */
|
|
||||||
control |= 1 << 5;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Set BulkListFilled. */
|
|
||||||
status |= 1 << 2;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GRUB_USB_TRANSACTION_TYPE_CONTROL:
|
|
||||||
{
|
|
||||||
grub_dprintf ("ohci", "add to control list\n");
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
|
||||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
|
||||||
|
|
||||||
/* Disable the Control and Bulk lists. */
|
|
||||||
control &= ~(3 << 4);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Clear ControlListFilled. */
|
|
||||||
status &= ~(1 << 1);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD,
|
|
||||||
(grub_uint32_t) ed);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD+1,
|
|
||||||
(grub_uint32_t) ed);
|
|
||||||
|
|
||||||
/* Enable the Control list. */
|
|
||||||
control |= 1 << 4;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Set ControlListFilled. */
|
|
||||||
status |= 1 << 1;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "wait for completion\n");
|
|
||||||
grub_dprintf ("ohci", "control=0x%02x status=0x%02x\n",
|
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL),
|
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS));
|
|
||||||
|
|
||||||
/* Wait until the transfer is completed or STALLs. */
|
|
||||||
while ((ed->td_head & ~0xf) != (ed->td_tail & ~0xf))
|
|
||||||
{
|
|
||||||
grub_cpu_idle ();
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "head=0x%02x tail=0x%02x\n", ed->td_head, ed->td_tail);
|
|
||||||
|
|
||||||
/* Detected a STALL. */
|
|
||||||
if (ed->td_head & 1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "complete\n");
|
|
||||||
|
|
||||||
/* if (ed->td_head & 1) */
|
|
||||||
/* err = GRUB_USB_ERR_STALL; */
|
|
||||||
/* else if (ed->td */
|
|
||||||
|
|
||||||
|
|
||||||
if (ed->td_head & 1)
|
|
||||||
{
|
|
||||||
grub_uint8_t errcode;
|
|
||||||
grub_ohci_td_t tderr;
|
|
||||||
|
|
||||||
tderr = (grub_ohci_td_t) grub_ohci_readreg32 (o,
|
|
||||||
GRUB_OHCI_REG_DONEHEAD);
|
|
||||||
errcode = tderr->token >> 28;
|
|
||||||
|
|
||||||
switch (errcode)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
/* XXX: Should not happen! */
|
|
||||||
grub_error (GRUB_ERR_IO, "OHCI without reporting the reason");
|
|
||||||
err = GRUB_USB_ERR_INTERNAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
/* XXX: CRC error. */
|
|
||||||
err = GRUB_USB_ERR_TIMEOUT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
err = GRUB_USB_ERR_BITSTUFF;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
/* XXX: Data Toggle error. */
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
err = GRUB_USB_ERR_STALL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
/* XXX: Not responding. */
|
|
||||||
err = GRUB_USB_ERR_TIMEOUT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
/* XXX: PID Check bits failed. */
|
|
||||||
err = GRUB_USB_ERR_BABBLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
/* XXX: PID unexpected failed. */
|
|
||||||
err = GRUB_USB_ERR_BABBLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
/* XXX: Data overrun error. */
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
/* XXX: Data underrun error. */
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
/* XXX: Reserved. */
|
|
||||||
err = GRUB_USB_ERR_NAK;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 11:
|
|
||||||
/* XXX: Reserved. */
|
|
||||||
err = GRUB_USB_ERR_NAK;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 12:
|
|
||||||
/* XXX: Buffer overrun. */
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 13:
|
|
||||||
/* XXX: Buffer underrun. */
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
err = GRUB_USB_ERR_NAK;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
err = GRUB_USB_ERR_NONE;
|
|
||||||
|
|
||||||
/* Disable the Control and Bulk lists. */
|
|
||||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
|
||||||
control &= ~(3 << 4);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Clear BulkListFilled and ControlListFilled. */
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
|
||||||
status &= ~((1 << 2) | (1 << 3));
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
/* XXX */
|
|
||||||
grub_free (td_list);
|
|
||||||
grub_free (ed);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_ohci_portstatus (grub_usb_controller_t dev,
|
|
||||||
unsigned int port, unsigned int enable)
|
|
||||||
{
|
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
|
||||||
grub_uint32_t status;
|
|
||||||
|
|
||||||
/* Reset the port. */
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
|
||||||
status |= (1 << 4); /* XXX: Magic. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
|
||||||
grub_millisleep (100);
|
|
||||||
|
|
||||||
/* End the reset signaling. */
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
|
||||||
status |= (1 << 20); /* XXX: Magic. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
|
||||||
grub_millisleep (10);
|
|
||||||
|
|
||||||
/* Enable the port. */
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
|
||||||
status |= (enable << 1); /* XXX: Magic. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
|
||||||
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
|
||||||
grub_dprintf ("ohci", "portstatus=0x%02x\n", status);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_usb_speed_t
|
|
||||||
grub_ohci_detect_dev (grub_usb_controller_t dev, int port)
|
|
||||||
{
|
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
|
||||||
grub_uint32_t status;
|
|
||||||
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "detect_dev status=0x%02x\n", status);
|
|
||||||
|
|
||||||
if (! (status & 1))
|
|
||||||
return GRUB_USB_SPEED_NONE;
|
|
||||||
else if (status & (1 << 9))
|
|
||||||
return GRUB_USB_SPEED_LOW;
|
|
||||||
else
|
|
||||||
return GRUB_USB_SPEED_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_ohci_hubports (grub_usb_controller_t dev)
|
|
||||||
{
|
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
|
||||||
grub_uint32_t portinfo;
|
|
||||||
|
|
||||||
portinfo = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBA);
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "root hub ports=%d\n", portinfo & 0xFF);
|
|
||||||
|
|
||||||
/* The root hub has exactly two ports. */
|
|
||||||
return portinfo & 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct grub_usb_controller_dev usb_controller =
|
|
||||||
{
|
|
||||||
.name = "ohci",
|
|
||||||
.iterate = grub_ohci_iterate,
|
|
||||||
.transfer = grub_ohci_transfer,
|
|
||||||
.hubports = grub_ohci_hubports,
|
|
||||||
.portstatus = grub_ohci_portstatus,
|
|
||||||
.detect_dev = grub_ohci_detect_dev
|
|
||||||
};
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(ohci)
|
|
||||||
{
|
|
||||||
grub_ohci_inithw ();
|
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(ohci)
|
|
||||||
{
|
|
||||||
grub_usb_controller_dev_unregister (&usb_controller);
|
|
||||||
}
|
|
||||||
-689
@@ -1,689 +0,0 @@
|
|||||||
/* uhci.c - UHCI Support. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/usbtrans.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/i386/io.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
|
|
||||||
#define GRUB_UHCI_IOMASK (0x7FF << 5)
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GRUB_UHCI_REG_USBCMD = 0x00,
|
|
||||||
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
|
||||||
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
|
||||||
GRUB_UHCI_REG_PORTSC2 = 0x12
|
|
||||||
} grub_uhci_reg_t;
|
|
||||||
|
|
||||||
#define GRUB_UHCI_LINK_TERMINATE 1
|
|
||||||
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
|
||||||
|
|
||||||
|
|
||||||
/* UHCI Queue Head. */
|
|
||||||
struct grub_uhci_qh
|
|
||||||
{
|
|
||||||
/* Queue head link pointer which points to the next queue head. */
|
|
||||||
grub_uint32_t linkptr;
|
|
||||||
|
|
||||||
/* Queue element link pointer which points to the first data object
|
|
||||||
within the queue. */
|
|
||||||
grub_uint32_t elinkptr;
|
|
||||||
|
|
||||||
/* Queue heads are aligned on 16 bytes, pad so a queue head is 16
|
|
||||||
bytes so we can store many in a 4K page. */
|
|
||||||
grub_uint8_t pad[8];
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* UHCI Transfer Descriptor. */
|
|
||||||
struct grub_uhci_td
|
|
||||||
{
|
|
||||||
/* Pointer to the next TD in the list. */
|
|
||||||
grub_uint32_t linkptr;
|
|
||||||
|
|
||||||
/* Control and status bits. */
|
|
||||||
grub_uint32_t ctrl_status;
|
|
||||||
|
|
||||||
/* All information required to transfer the Token packet. */
|
|
||||||
grub_uint32_t token;
|
|
||||||
|
|
||||||
/* A pointer to the data buffer, UHCI requires this pointer to be 32
|
|
||||||
bits. */
|
|
||||||
grub_uint32_t buffer;
|
|
||||||
|
|
||||||
/* Another linkptr that is not overwritten by the Host Controller.
|
|
||||||
This is GRUB specific. */
|
|
||||||
grub_uint32_t linkptr2;
|
|
||||||
|
|
||||||
/* 3 additional 32 bits words reserved for the Host Controller Driver. */
|
|
||||||
grub_uint32_t data[3];
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
typedef volatile struct grub_uhci_td *grub_uhci_td_t;
|
|
||||||
typedef volatile struct grub_uhci_qh *grub_uhci_qh_t;
|
|
||||||
|
|
||||||
struct grub_uhci
|
|
||||||
{
|
|
||||||
int iobase;
|
|
||||||
grub_uint32_t *framelist;
|
|
||||||
|
|
||||||
/* 256 Queue Heads. */
|
|
||||||
grub_uhci_qh_t qh;
|
|
||||||
|
|
||||||
/* 256 Transfer Descriptors. */
|
|
||||||
grub_uhci_td_t td;
|
|
||||||
|
|
||||||
/* Free Transfer Descriptors. */
|
|
||||||
grub_uhci_td_t tdfree;
|
|
||||||
|
|
||||||
struct grub_uhci *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct grub_uhci *uhci;
|
|
||||||
|
|
||||||
static grub_uint16_t
|
|
||||||
grub_uhci_readreg16 (struct grub_uhci *u, grub_uhci_reg_t reg)
|
|
||||||
{
|
|
||||||
return grub_inw (u->iobase + reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static grub_uint32_t
|
|
||||||
grub_uhci_readreg32 (struct grub_uhci *u, grub_uhci_reg_t reg)
|
|
||||||
{
|
|
||||||
return grub_inl (u->iobase + reg);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_uhci_writereg16 (struct grub_uhci *u,
|
|
||||||
grub_uhci_reg_t reg, grub_uint16_t val)
|
|
||||||
{
|
|
||||||
grub_outw (val, u->iobase + reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_uhci_writereg32 (struct grub_uhci *u,
|
|
||||||
grub_uhci_reg_t reg, grub_uint32_t val)
|
|
||||||
{
|
|
||||||
grub_outl (val, u->iobase + reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
|
||||||
unsigned int port, unsigned int enable);
|
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
|
||||||
controller. If this is the case, initialize it. */
|
|
||||||
static int NESTED_FUNC_ATTR
|
|
||||||
grub_uhci_pci_iter (grub_pci_device_t dev,
|
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
|
||||||
{
|
|
||||||
grub_uint32_t class_code;
|
|
||||||
grub_uint32_t class;
|
|
||||||
grub_uint32_t subclass;
|
|
||||||
grub_uint32_t interf;
|
|
||||||
grub_uint32_t base;
|
|
||||||
grub_uint32_t fp;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
struct grub_uhci *u;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
|
||||||
subclass = (class_code >> 8) & 0xFF;
|
|
||||||
class = class_code >> 16;
|
|
||||||
|
|
||||||
/* If this is not an UHCI controller, just return. */
|
|
||||||
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Determine IO base address. */
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
|
||||||
base = grub_pci_read (addr);
|
|
||||||
/* Stop if there is no IO space base address defined. */
|
|
||||||
if (! (base & 1))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Allocate memory for the controller and register it. */
|
|
||||||
u = grub_zalloc (sizeof (*u));
|
|
||||||
if (! u)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
|
||||||
grub_dprintf ("uhci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x\n",
|
|
||||||
class, subclass, interf, u->iobase);
|
|
||||||
|
|
||||||
/* Reserve a page for the frame list. */
|
|
||||||
u->framelist = grub_memalign (4096, 4096);
|
|
||||||
if (! u->framelist)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* The framelist pointer of UHCI is only 32 bits, make sure this
|
|
||||||
code works on on 64 bits architectures. */
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
|
||||||
if ((grub_uint64_t) u->framelist >> 32)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"allocated frame list memory not <4GB");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The QH pointer of UHCI is only 32 bits, make sure this
|
|
||||||
code works on on 64 bits architectures. */
|
|
||||||
u->qh = (grub_uhci_qh_t) grub_memalign (4096, 4096);
|
|
||||||
if (! u->qh)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
|
||||||
if ((grub_uint64_t) u->qh >> 32)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "allocated QH memory not <4GB");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The TD pointer of UHCI is only 32 bits, make sure this
|
|
||||||
code works on on 64 bits architectures. */
|
|
||||||
u->td = (grub_uhci_td_t) grub_memalign (4096, 4096*2);
|
|
||||||
if (! u->td)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
|
||||||
if ((grub_uint64_t) u->td >> 32)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "allocated TD memory not <4GB");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Link all Transfer Descriptors in a list of available Transfer
|
|
||||||
Descriptors. */
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
u->td[i].linkptr = (grub_uint32_t) &u->td[i + 1];
|
|
||||||
u->td[255 - 1].linkptr = 0;
|
|
||||||
u->tdfree = u->td;
|
|
||||||
|
|
||||||
/* Make sure UHCI is disabled! */
|
|
||||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
|
||||||
|
|
||||||
/* Setup the frame list pointers. Since no isochronous transfers
|
|
||||||
are and will be supported, they all point to the (same!) queue
|
|
||||||
head. */
|
|
||||||
fp = (grub_uint32_t) u->qh & (~15);
|
|
||||||
/* Mark this as a queue head. */
|
|
||||||
fp |= 2;
|
|
||||||
for (i = 0; i < 1024; i++)
|
|
||||||
u->framelist[i] = fp;
|
|
||||||
/* Program the framelist address into the UHCI controller. */
|
|
||||||
grub_uhci_writereg32 (u, GRUB_UHCI_REG_FLBASEADD,
|
|
||||||
(grub_uint32_t) u->framelist);
|
|
||||||
|
|
||||||
/* Make the Queue Heads point to each other. */
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
/* Point to the next QH. */
|
|
||||||
u->qh[i].linkptr = (grub_uint32_t) (&u->qh[i + 1]) & (~15);
|
|
||||||
|
|
||||||
/* This is a QH. */
|
|
||||||
u->qh[i].linkptr |= GRUB_UHCI_LINK_QUEUE_HEAD;
|
|
||||||
|
|
||||||
/* For the moment, do not point to a Transfer Descriptor. These
|
|
||||||
are set at transfer time, so just terminate it. */
|
|
||||||
u->qh[i].elinkptr = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The last Queue Head should terminate. 256 are too many QHs so
|
|
||||||
just use 50. */
|
|
||||||
u->qh[50 - 1].linkptr = 1;
|
|
||||||
|
|
||||||
/* Enable UHCI again. */
|
|
||||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
|
|
||||||
|
|
||||||
/* UHCI is initialized and ready for transfers. */
|
|
||||||
grub_dprintf ("uhci", "UHCI initialized\n");
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
grub_uint16_t frnum;
|
|
||||||
|
|
||||||
frnum = grub_uhci_readreg16 (u, 6);
|
|
||||||
grub_dprintf ("uhci", "Framenum=%d\n", frnum);
|
|
||||||
grub_millisleep (100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Link to uhci now that initialisation is successful. */
|
|
||||||
u->next = uhci;
|
|
||||||
uhci = u;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (u)
|
|
||||||
{
|
|
||||||
grub_free ((void *) u->qh);
|
|
||||||
grub_free (u->framelist);
|
|
||||||
}
|
|
||||||
grub_free (u);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_uhci_inithw (void)
|
|
||||||
{
|
|
||||||
grub_pci_iterate (grub_uhci_pci_iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_uhci_td_t
|
|
||||||
grub_alloc_td (struct grub_uhci *u)
|
|
||||||
{
|
|
||||||
grub_uhci_td_t ret;
|
|
||||||
|
|
||||||
/* Check if there is a Transfer Descriptor available. */
|
|
||||||
if (! u->tdfree)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
ret = u->tdfree;
|
|
||||||
u->tdfree = (grub_uhci_td_t) u->tdfree->linkptr;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
|
|
||||||
{
|
|
||||||
td->linkptr = (grub_uint32_t) u->tdfree;
|
|
||||||
u->tdfree = td;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td)
|
|
||||||
{
|
|
||||||
/* Free the TDs in this queue. */
|
|
||||||
while (td)
|
|
||||||
{
|
|
||||||
grub_uhci_td_t tdprev;
|
|
||||||
|
|
||||||
/* Unlink the queue. */
|
|
||||||
tdprev = td;
|
|
||||||
td = (grub_uhci_td_t) td->linkptr2;
|
|
||||||
|
|
||||||
/* Free the TD. */
|
|
||||||
grub_free_td (u, tdprev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_uhci_qh_t
|
|
||||||
grub_alloc_qh (struct grub_uhci *u,
|
|
||||||
grub_transaction_type_t tr __attribute__((unused)))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_uhci_qh_t qh;
|
|
||||||
|
|
||||||
/* Look for a Queue Head for this transfer. Skip the first QH if
|
|
||||||
this is a Interrupt Transfer. */
|
|
||||||
#if 0
|
|
||||||
if (tr == GRUB_USB_TRANSACTION_TYPE_INTERRUPT)
|
|
||||||
i = 0;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
i = 1;
|
|
||||||
|
|
||||||
for (; i < 255; i++)
|
|
||||||
{
|
|
||||||
if (u->qh[i].elinkptr & 1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
qh = &u->qh[i];
|
|
||||||
if (! (qh->elinkptr & 1))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"no free queue heads available");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return qh;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_uhci_td_t
|
|
||||||
grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
|
||||||
grub_transfer_type_t type, unsigned int addr,
|
|
||||||
unsigned int toggle, grub_size_t size,
|
|
||||||
char *data)
|
|
||||||
{
|
|
||||||
grub_uhci_td_t td;
|
|
||||||
static const unsigned int tf[] = { 0x69, 0xE1, 0x2D };
|
|
||||||
|
|
||||||
/* XXX: Check if data is <4GB. If it isn't, just copy stuff around.
|
|
||||||
This is only relevant for 64 bits architectures. */
|
|
||||||
|
|
||||||
/* Grab a free Transfer Descriptor and initialize it. */
|
|
||||||
td = grub_alloc_td (u);
|
|
||||||
if (! td)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"no transfer descriptors available for UHCI transfer");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("uhci",
|
|
||||||
"transaction: endp=%d, type=%d, addr=%d, toggle=%d, size=%d data=%p td=%p\n",
|
|
||||||
endp, type, addr, toggle, size, data, td);
|
|
||||||
|
|
||||||
/* Don't point to any TD, just terminate. */
|
|
||||||
td->linkptr = 1;
|
|
||||||
|
|
||||||
/* Active! Only retry a transfer 3 times. */
|
|
||||||
td->ctrl_status = (1 << 23) | (3 << 27);
|
|
||||||
|
|
||||||
/* If zero bytes are transmitted, size is 0x7FF. Otherwise size is
|
|
||||||
size-1. */
|
|
||||||
if (size == 0)
|
|
||||||
size = 0x7FF;
|
|
||||||
else
|
|
||||||
size = size - 1;
|
|
||||||
|
|
||||||
/* Setup whatever is required for the token packet. */
|
|
||||||
td->token = ((size << 21) | (toggle << 19) | (endp << 15)
|
|
||||||
| (addr << 8) | tf[type]);
|
|
||||||
|
|
||||||
td->buffer = (grub_uint32_t) data;
|
|
||||||
|
|
||||||
return td;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_usb_err_t
|
|
||||||
grub_uhci_transfer (grub_usb_controller_t dev,
|
|
||||||
grub_usb_transfer_t transfer)
|
|
||||||
{
|
|
||||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
|
||||||
grub_uhci_qh_t qh;
|
|
||||||
grub_uhci_td_t td;
|
|
||||||
grub_uhci_td_t td_first = NULL;
|
|
||||||
grub_uhci_td_t td_prev = NULL;
|
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
|
||||||
int i;
|
|
||||||
grub_uint64_t endtime;
|
|
||||||
|
|
||||||
/* Allocate a queue head for the transfer queue. */
|
|
||||||
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
|
||||||
if (! qh)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
for (i = 0; i < transfer->transcnt; i++)
|
|
||||||
{
|
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
|
||||||
|
|
||||||
td = grub_uhci_transaction (u, transfer->endpoint, tr->pid,
|
|
||||||
transfer->devaddr, tr->toggle,
|
|
||||||
tr->size, tr->data);
|
|
||||||
if (! td)
|
|
||||||
{
|
|
||||||
/* Terminate and free. */
|
|
||||||
td_prev->linkptr2 = 0;
|
|
||||||
td_prev->linkptr = 1;
|
|
||||||
|
|
||||||
if (td_first)
|
|
||||||
grub_free_queue (u, td_first);
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! td_first)
|
|
||||||
td_first = td;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
td_prev->linkptr2 = (grub_uint32_t) td;
|
|
||||||
td_prev->linkptr = (grub_uint32_t) td;
|
|
||||||
td_prev->linkptr |= 4;
|
|
||||||
}
|
|
||||||
td_prev = td;
|
|
||||||
}
|
|
||||||
td_prev->linkptr2 = 0;
|
|
||||||
td_prev->linkptr = 1;
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "setup transaction %d\n", transfer->type);
|
|
||||||
|
|
||||||
/* Link it into the queue and terminate. Now the transaction can
|
|
||||||
take place. */
|
|
||||||
qh->elinkptr = (grub_uint32_t) td_first;
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "initiate transaction\n");
|
|
||||||
|
|
||||||
/* Wait until either the transaction completed or an error
|
|
||||||
occurred. */
|
|
||||||
endtime = grub_get_time_ms () + 1000;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
grub_uhci_td_t errtd;
|
|
||||||
|
|
||||||
errtd = (grub_uhci_td_t) (qh->elinkptr & ~0x0f);
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p\n",
|
|
||||||
errtd->ctrl_status, errtd->buffer & (~15), errtd);
|
|
||||||
|
|
||||||
/* Check if the transaction completed. */
|
|
||||||
if (qh->elinkptr & 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status);
|
|
||||||
|
|
||||||
/* Check if the TD is not longer active. */
|
|
||||||
if (! (errtd->ctrl_status & (1 << 23)))
|
|
||||||
{
|
|
||||||
grub_dprintf ("uhci", ">>t status=0x%02x\n", errtd->ctrl_status);
|
|
||||||
|
|
||||||
/* Check if the endpoint is stalled. */
|
|
||||||
if (errtd->ctrl_status & (1 << 22))
|
|
||||||
err = GRUB_USB_ERR_STALL;
|
|
||||||
|
|
||||||
/* Check if an error related to the data buffer occurred. */
|
|
||||||
if (errtd->ctrl_status & (1 << 21))
|
|
||||||
err = GRUB_USB_ERR_DATA;
|
|
||||||
|
|
||||||
/* Check if a babble error occurred. */
|
|
||||||
if (errtd->ctrl_status & (1 << 20))
|
|
||||||
err = GRUB_USB_ERR_BABBLE;
|
|
||||||
|
|
||||||
/* Check if a NAK occurred. */
|
|
||||||
if (errtd->ctrl_status & (1 << 19))
|
|
||||||
err = GRUB_USB_ERR_NAK;
|
|
||||||
|
|
||||||
/* Check if a timeout occurred. */
|
|
||||||
if (errtd->ctrl_status & (1 << 18))
|
|
||||||
err = GRUB_USB_ERR_TIMEOUT;
|
|
||||||
|
|
||||||
/* Check if a bitstuff error occurred. */
|
|
||||||
if (errtd->ctrl_status & (1 << 17))
|
|
||||||
err = GRUB_USB_ERR_BITSTUFF;
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* Fall through, no errors occurred, so the QH might be
|
|
||||||
updated. */
|
|
||||||
grub_dprintf ("uhci", "transaction fallthrough\n");
|
|
||||||
}
|
|
||||||
if (grub_get_time_ms () > endtime)
|
|
||||||
{
|
|
||||||
err = GRUB_USB_ERR_STALL;
|
|
||||||
grub_dprintf ("uhci", "transaction timed out\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
grub_cpu_idle ();
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transaction complete\n");
|
|
||||||
|
|
||||||
fail:
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transaction failed\n");
|
|
||||||
|
|
||||||
/* Place the QH back in the free list and deallocate the associated
|
|
||||||
TDs. */
|
|
||||||
qh->elinkptr = 1;
|
|
||||||
grub_free_queue (u, td_first);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_uhci_iterate (int (*hook) (grub_usb_controller_t dev))
|
|
||||||
{
|
|
||||||
struct grub_uhci *u;
|
|
||||||
struct grub_usb_controller dev;
|
|
||||||
|
|
||||||
for (u = uhci; u; u = u->next)
|
|
||||||
{
|
|
||||||
dev.data = u;
|
|
||||||
if (hook (&dev))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
|
||||||
unsigned int port, unsigned int enable)
|
|
||||||
{
|
|
||||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
|
||||||
int reg;
|
|
||||||
unsigned int status;
|
|
||||||
grub_uint64_t endtime;
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
|
||||||
|
|
||||||
if (port == 0)
|
|
||||||
reg = GRUB_UHCI_REG_PORTSC1;
|
|
||||||
else if (port == 1)
|
|
||||||
reg = GRUB_UHCI_REG_PORTSC2;
|
|
||||||
else
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
|
||||||
"UHCI Root Hub port does not exist");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
|
||||||
grub_dprintf ("uhci", "detect=0x%02x\n", status);
|
|
||||||
|
|
||||||
/* Reset the port. */
|
|
||||||
grub_uhci_writereg16 (u, reg, enable << 9);
|
|
||||||
|
|
||||||
/* Wait for the reset to complete. XXX: How long exactly? */
|
|
||||||
grub_millisleep (10);
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
|
||||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
|
||||||
grub_dprintf ("uhci", "reset completed\n");
|
|
||||||
grub_millisleep (10);
|
|
||||||
|
|
||||||
/* Enable the port. */
|
|
||||||
grub_uhci_writereg16 (u, reg, enable << 2);
|
|
||||||
grub_millisleep (10);
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
|
|
||||||
|
|
||||||
endtime = grub_get_time_ms () + 1000;
|
|
||||||
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
|
||||||
if (grub_get_time_ms () > endtime)
|
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
|
||||||
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_usb_speed_t
|
|
||||||
grub_uhci_detect_dev (grub_usb_controller_t dev, int port)
|
|
||||||
{
|
|
||||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
|
||||||
int reg;
|
|
||||||
unsigned int status;
|
|
||||||
|
|
||||||
if (port == 0)
|
|
||||||
reg = GRUB_UHCI_REG_PORTSC1;
|
|
||||||
else if (port == 1)
|
|
||||||
reg = GRUB_UHCI_REG_PORTSC2;
|
|
||||||
else
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
|
||||||
"UHCI Root Hub port does not exist");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "detect=0x%02x port=%d\n", status, port);
|
|
||||||
|
|
||||||
if (! (status & 1))
|
|
||||||
return GRUB_USB_SPEED_NONE;
|
|
||||||
else if (status & (1 << 8))
|
|
||||||
return GRUB_USB_SPEED_LOW;
|
|
||||||
else
|
|
||||||
return GRUB_USB_SPEED_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_uhci_hubports (grub_usb_controller_t dev __attribute__((unused)))
|
|
||||||
{
|
|
||||||
/* The root hub has exactly two ports. */
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct grub_usb_controller_dev usb_controller =
|
|
||||||
{
|
|
||||||
.name = "uhci",
|
|
||||||
.iterate = grub_uhci_iterate,
|
|
||||||
.transfer = grub_uhci_transfer,
|
|
||||||
.hubports = grub_uhci_hubports,
|
|
||||||
.portstatus = grub_uhci_portstatus,
|
|
||||||
.detect_dev = grub_uhci_detect_dev
|
|
||||||
};
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(uhci)
|
|
||||||
{
|
|
||||||
grub_uhci_inithw ();
|
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
|
||||||
grub_dprintf ("uhci", "registered\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(uhci)
|
|
||||||
{
|
|
||||||
struct grub_uhci *u;
|
|
||||||
|
|
||||||
/* Disable all UHCI controllers. */
|
|
||||||
for (u = uhci; u; u = u->next)
|
|
||||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
|
||||||
|
|
||||||
/* Unregister the controller. */
|
|
||||||
grub_usb_controller_dev_unregister (&usb_controller);
|
|
||||||
}
|
|
||||||
-227
@@ -1,227 +0,0 @@
|
|||||||
/* usb.c - Generic USB interfaces. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
static grub_usb_controller_dev_t grub_usb_list;
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
|
||||||
{
|
|
||||||
auto int iterate_hook (grub_usb_controller_t dev);
|
|
||||||
|
|
||||||
/* Iterate over all controllers found by the driver. */
|
|
||||||
int iterate_hook (grub_usb_controller_t dev)
|
|
||||||
{
|
|
||||||
dev->dev = usb;
|
|
||||||
|
|
||||||
/* Enable the ports of the USB Root Hub. */
|
|
||||||
grub_usb_root_hub (dev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb->next = grub_usb_list;
|
|
||||||
grub_usb_list = usb;
|
|
||||||
|
|
||||||
if (usb->iterate)
|
|
||||||
usb->iterate (iterate_hook);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb)
|
|
||||||
{
|
|
||||||
grub_usb_controller_dev_t *p, q;
|
|
||||||
|
|
||||||
for (p = &grub_usb_list, q = *p; q; p = &(q->next), q = q->next)
|
|
||||||
if (q == usb)
|
|
||||||
{
|
|
||||||
*p = q->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
int
|
|
||||||
grub_usb_controller_iterate (int (*hook) (grub_usb_controller_t dev))
|
|
||||||
{
|
|
||||||
grub_usb_controller_dev_t p;
|
|
||||||
|
|
||||||
auto int iterate_hook (grub_usb_controller_t dev);
|
|
||||||
|
|
||||||
int iterate_hook (grub_usb_controller_t dev)
|
|
||||||
{
|
|
||||||
dev->dev = p;
|
|
||||||
if (hook (dev))
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Iterate over all controller drivers. */
|
|
||||||
for (p = grub_usb_list; p; p = p->next)
|
|
||||||
{
|
|
||||||
/* Iterate over the busses of the controllers. XXX: Actually, a
|
|
||||||
hub driver should do this. */
|
|
||||||
if (p->iterate (iterate_hook))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
|
||||||
{
|
|
||||||
dev->toggle[endpoint] = 0;
|
|
||||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
|
||||||
| GRUB_USB_REQTYPE_STANDARD
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_ENDP),
|
|
||||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
|
||||||
GRUB_USB_FEATURE_ENDP_HALT,
|
|
||||||
endpoint, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_set_configuration (grub_usb_device_t dev, int configuration)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
dev->toggle[i] = 0;
|
|
||||||
|
|
||||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
|
||||||
| GRUB_USB_REQTYPE_STANDARD
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
|
||||||
GRUB_USB_REQ_SET_CONFIGURATION, configuration,
|
|
||||||
0, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_get_descriptor (grub_usb_device_t dev,
|
|
||||||
grub_uint8_t type, grub_uint8_t index,
|
|
||||||
grub_size_t size, char *data)
|
|
||||||
{
|
|
||||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
|
||||||
| GRUB_USB_REQTYPE_STANDARD
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
|
||||||
GRUB_USB_REQ_GET_DESCRIPTOR,
|
|
||||||
(type << 8) | index,
|
|
||||||
0, size, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_usb_desc_endp *
|
|
||||||
grub_usb_get_endpdescriptor (grub_usb_device_t usbdev, int addr)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < usbdev->config[0].descconf->numif; i++)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_if *interf;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
interf = usbdev->config[0].interf[i].descif;
|
|
||||||
|
|
||||||
for (j = 0; j < interf->endpointcnt; j++)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_endp *endp;
|
|
||||||
endp = &usbdev->config[0].interf[i].descendp[j];
|
|
||||||
|
|
||||||
if (endp->endp_addr == addr)
|
|
||||||
return endp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_device_initialize (grub_usb_device_t dev)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_device *descdev;
|
|
||||||
struct grub_usb_desc_config config;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
|
||||||
0, sizeof (struct grub_usb_desc_device),
|
|
||||||
(char *) &dev->descdev);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
descdev = &dev->descdev;
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
dev->config[i].descconf = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < descdev->configcnt; i++)
|
|
||||||
{
|
|
||||||
int pos;
|
|
||||||
int currif;
|
|
||||||
char *data;
|
|
||||||
|
|
||||||
/* First just read the first 4 bytes of the configuration
|
|
||||||
descriptor, after that it is known how many bytes really have
|
|
||||||
to be read. */
|
|
||||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_CONFIG, i, 4,
|
|
||||||
(char *) &config);
|
|
||||||
|
|
||||||
data = grub_malloc (config.totallen);
|
|
||||||
if (! data)
|
|
||||||
{
|
|
||||||
err = GRUB_USB_ERR_INTERNAL;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->config[i].descconf = (struct grub_usb_desc_config *) data;
|
|
||||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_CONFIG, i,
|
|
||||||
config.totallen, data);
|
|
||||||
if (err)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* Skip the configuration descriptor. */
|
|
||||||
pos = sizeof (struct grub_usb_desc_config);
|
|
||||||
|
|
||||||
/* Read all interfaces. */
|
|
||||||
for (currif = 0; currif < dev->config[i].descconf->numif; currif++)
|
|
||||||
{
|
|
||||||
dev->config[i].interf[currif].descif
|
|
||||||
= (struct grub_usb_desc_if *) &data[pos];
|
|
||||||
pos += sizeof (struct grub_usb_desc_if);
|
|
||||||
|
|
||||||
/* Point to the first endpoint. */
|
|
||||||
dev->config[i].interf[currif].descendp
|
|
||||||
= (struct grub_usb_desc_endp *) &data[pos];
|
|
||||||
pos += (sizeof (struct grub_usb_desc_endp)
|
|
||||||
* dev->config[i].interf[currif].descif->endpointcnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
grub_free (dev->config[i].descconf);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
/* usb.c - USB Hub Support. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
/* USB Supports 127 devices, with device 0 as special case. */
|
|
||||||
static struct grub_usb_device *grub_usb_devs[128];
|
|
||||||
|
|
||||||
/* Add a device that currently has device number 0 and resides on
|
|
||||||
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
|
||||||
static grub_usb_device_t
|
|
||||||
grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
|
||||||
{
|
|
||||||
grub_usb_device_t dev;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dev = grub_zalloc (sizeof (struct grub_usb_device));
|
|
||||||
if (! dev)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dev->controller = *controller;
|
|
||||||
dev->speed = speed;
|
|
||||||
|
|
||||||
grub_usb_device_initialize (dev);
|
|
||||||
|
|
||||||
/* Assign a new address to the device. */
|
|
||||||
for (i = 1; i < 128; i++)
|
|
||||||
{
|
|
||||||
if (! grub_usb_devs[i])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == 128)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_IO, "can't assign address to USB device");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_control_msg (dev,
|
|
||||||
(GRUB_USB_REQTYPE_OUT
|
|
||||||
| GRUB_USB_REQTYPE_STANDARD
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
|
||||||
GRUB_USB_REQ_SET_ADDRESS,
|
|
||||||
i, 0, 0, NULL);
|
|
||||||
|
|
||||||
dev->addr = i;
|
|
||||||
dev->initialized = 1;
|
|
||||||
grub_usb_devs[i] = dev;
|
|
||||||
|
|
||||||
return dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_usb_add_hub (grub_usb_device_t dev)
|
|
||||||
{
|
|
||||||
struct grub_usb_usb_hubdesc hubdesc;
|
|
||||||
grub_err_t err;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
|
||||||
GRUB_USB_REQ_GET_DESCRIPTOR,
|
|
||||||
(GRUB_USB_DESCRIPTOR_HUB << 8) | 0,
|
|
||||||
0, sizeof (hubdesc), (char *) &hubdesc);
|
|
||||||
|
|
||||||
/* Iterate over the Hub ports. */
|
|
||||||
for (i = 1; i <= hubdesc.portcnt; i++)
|
|
||||||
{
|
|
||||||
grub_uint32_t status;
|
|
||||||
|
|
||||||
/* Get the port status. */
|
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
|
||||||
GRUB_USB_REQ_HUB_GET_PORT_STATUS,
|
|
||||||
0, i, sizeof (status), (char *) &status);
|
|
||||||
|
|
||||||
/* Just ignore the device if the Hub does not report the
|
|
||||||
status. */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If connected, reset and enable the port. */
|
|
||||||
if (status & GRUB_USB_HUB_STATUS_CONNECTED)
|
|
||||||
{
|
|
||||||
grub_usb_speed_t speed;
|
|
||||||
|
|
||||||
/* Determine the device speed. */
|
|
||||||
if (status & GRUB_USB_HUB_STATUS_LOWSPEED)
|
|
||||||
speed = GRUB_USB_SPEED_LOW;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (status & GRUB_USB_HUB_STATUS_HIGHSPEED)
|
|
||||||
speed = GRUB_USB_SPEED_HIGH;
|
|
||||||
else
|
|
||||||
speed = GRUB_USB_SPEED_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A device is actually connected to this port, not enable
|
|
||||||
the port. XXX: Why 0x03? According to some docs it
|
|
||||||
should be 0x0. Check the specification! */
|
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
|
||||||
0x3, 0x4, i, 0, 0);
|
|
||||||
|
|
||||||
/* If the Hub does not cooperate for this port, just skip
|
|
||||||
the port. */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Add the device and assign a device address to it. */
|
|
||||||
grub_usb_hub_add_dev (&dev->controller, speed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_root_hub (grub_usb_controller_t controller)
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
int ports;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Query the number of ports the root Hub has. */
|
|
||||||
ports = controller->dev->hubports (controller);
|
|
||||||
|
|
||||||
for (i = 0; i < ports; i++)
|
|
||||||
{
|
|
||||||
grub_usb_speed_t speed = controller->dev->detect_dev (controller, i);
|
|
||||||
|
|
||||||
if (speed != GRUB_USB_SPEED_NONE)
|
|
||||||
{
|
|
||||||
grub_usb_device_t dev;
|
|
||||||
|
|
||||||
/* Enable the port. */
|
|
||||||
err = controller->dev->portstatus (controller, i, 1);
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Enable the port and create a device. */
|
|
||||||
dev = grub_usb_hub_add_dev (controller, speed);
|
|
||||||
if (! dev)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If the device is a Hub, scan it for more devices. */
|
|
||||||
if (dev->descdev.class == 0x09)
|
|
||||||
grub_usb_add_hub (dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_usb_iterate (int (*hook) (grub_usb_device_t dev))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
{
|
|
||||||
if (grub_usb_devs[i])
|
|
||||||
{
|
|
||||||
if (hook (grub_usb_devs[i]))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
/* usbtrans.c - USB Transfers and Transactions. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/usbtrans.h>
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_control_msg (grub_usb_device_t dev,
|
|
||||||
grub_uint8_t reqtype,
|
|
||||||
grub_uint8_t request,
|
|
||||||
grub_uint16_t value,
|
|
||||||
grub_uint16_t index,
|
|
||||||
grub_size_t size, char *data)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_usb_transfer_t transfer;
|
|
||||||
int datablocks;
|
|
||||||
struct grub_usb_packet_setup setupdata;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
unsigned int max;
|
|
||||||
|
|
||||||
grub_dprintf ("usb",
|
|
||||||
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%d\n",
|
|
||||||
reqtype, request, value, index, size);
|
|
||||||
|
|
||||||
/* Create a transfer. */
|
|
||||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
|
||||||
if (! transfer)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
/* Determine the maximum packet size. */
|
|
||||||
if (dev->initialized)
|
|
||||||
max = dev->descdev.maxsize0;
|
|
||||||
else
|
|
||||||
max = 64;
|
|
||||||
|
|
||||||
datablocks = (size + max - 1) / max;
|
|
||||||
|
|
||||||
/* XXX: Discriminate between different types of control
|
|
||||||
messages. */
|
|
||||||
transfer->transcnt = datablocks + 2;
|
|
||||||
transfer->size = size; /* XXX ? */
|
|
||||||
transfer->endpoint = 0;
|
|
||||||
transfer->devaddr = dev->addr;
|
|
||||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_CONTROL;
|
|
||||||
transfer->max = max;
|
|
||||||
transfer->dev = dev;
|
|
||||||
|
|
||||||
/* Allocate an array of transfer data structures. */
|
|
||||||
transfer->transactions = grub_malloc (transfer->transcnt
|
|
||||||
* sizeof (struct grub_usb_transfer));
|
|
||||||
if (! transfer->transactions)
|
|
||||||
{
|
|
||||||
grub_free (transfer);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build a Setup packet. XXX: Endianness. */
|
|
||||||
setupdata.reqtype = reqtype;
|
|
||||||
setupdata.request = request;
|
|
||||||
setupdata.value = value;
|
|
||||||
setupdata.index = index;
|
|
||||||
setupdata.length = size;
|
|
||||||
transfer->transactions[0].size = sizeof (setupdata);
|
|
||||||
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
|
||||||
transfer->transactions[0].data = (char *) &setupdata;
|
|
||||||
transfer->transactions[0].toggle = 0;
|
|
||||||
|
|
||||||
/* Now the data... XXX: Is this the right way to transfer control
|
|
||||||
transfers? */
|
|
||||||
for (i = 0; i < datablocks; i++)
|
|
||||||
{
|
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i + 1];
|
|
||||||
|
|
||||||
tr->size = (size > max) ? max : size;
|
|
||||||
/* Use the right most bit as the data toggle. Simple and
|
|
||||||
effective. */
|
|
||||||
tr->toggle = !(i & 1);
|
|
||||||
if (reqtype & 128)
|
|
||||||
tr->pid = GRUB_USB_TRANSFER_TYPE_IN;
|
|
||||||
else
|
|
||||||
tr->pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
|
||||||
tr->data = &data[i * max];
|
|
||||||
size -= max;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End with an empty OUT transaction. */
|
|
||||||
transfer->transactions[datablocks + 1].size = 0;
|
|
||||||
transfer->transactions[datablocks + 1].data = NULL;
|
|
||||||
if (reqtype & 128)
|
|
||||||
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
|
||||||
else
|
|
||||||
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_IN;
|
|
||||||
|
|
||||||
transfer->transactions[datablocks + 1].toggle = 1;
|
|
||||||
|
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
|
||||||
grub_free (transfer);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_usb_err_t
|
|
||||||
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
|
||||||
int endpoint, grub_size_t size, char *data,
|
|
||||||
grub_transfer_type_t type)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_usb_transfer_t transfer;
|
|
||||||
int datablocks;
|
|
||||||
unsigned int max;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
int toggle = dev->toggle[endpoint];
|
|
||||||
|
|
||||||
/* Use the maximum packet size given in the endpoint descriptor. */
|
|
||||||
if (dev->initialized)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_endp *endpdesc;
|
|
||||||
endpdesc = grub_usb_get_endpdescriptor (dev, 0);
|
|
||||||
|
|
||||||
if (endpdesc)
|
|
||||||
max = endpdesc->maxpacket;
|
|
||||||
else
|
|
||||||
max = 64;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
max = 64;
|
|
||||||
|
|
||||||
/* Create a transfer. */
|
|
||||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
|
||||||
if (! transfer)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
datablocks = ((size + max - 1) / max);
|
|
||||||
transfer->transcnt = datablocks;
|
|
||||||
transfer->size = size - 1;
|
|
||||||
transfer->endpoint = endpoint;
|
|
||||||
transfer->devaddr = dev->addr;
|
|
||||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
|
||||||
transfer->max = max;
|
|
||||||
transfer->dev = dev;
|
|
||||||
|
|
||||||
/* Allocate an array of transfer data structures. */
|
|
||||||
transfer->transactions = grub_malloc (transfer->transcnt
|
|
||||||
* sizeof (struct grub_usb_transfer));
|
|
||||||
if (! transfer->transactions)
|
|
||||||
{
|
|
||||||
grub_free (transfer);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up all transfers. */
|
|
||||||
for (i = 0; i < datablocks; i++)
|
|
||||||
{
|
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
|
||||||
|
|
||||||
tr->size = (size > max) ? max : size;
|
|
||||||
/* XXX: Use the right most bit as the data toggle. Simple and
|
|
||||||
effective. */
|
|
||||||
tr->toggle = toggle;
|
|
||||||
toggle = toggle ? 0 : 1;
|
|
||||||
tr->pid = type;
|
|
||||||
tr->data = &data[i * max];
|
|
||||||
size -= tr->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
|
||||||
grub_dprintf ("usb", "toggle=%d\n", toggle);
|
|
||||||
dev->toggle[endpoint] = toggle;
|
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
|
||||||
grub_free (transfer);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_bulk_write (grub_usb_device_t dev,
|
|
||||||
int endpoint, grub_size_t size, char *data)
|
|
||||||
{
|
|
||||||
return grub_usb_bulk_readwrite (dev, endpoint, size, data,
|
|
||||||
GRUB_USB_TRANSFER_TYPE_OUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_usb_err_t
|
|
||||||
grub_usb_bulk_read (grub_usb_device_t dev,
|
|
||||||
int endpoint, grub_size_t size, char *data)
|
|
||||||
{
|
|
||||||
return grub_usb_bulk_readwrite (dev, endpoint, size, data,
|
|
||||||
GRUB_USB_TRANSFER_TYPE_IN);
|
|
||||||
}
|
|
||||||
-774
@@ -1,774 +0,0 @@
|
|||||||
/* acpi.c - modify acpi tables. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/gzio.h>
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#include <grub/memory.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/efi/api.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
|
||||||
{"exclude", 'x', 0,
|
|
||||||
N_("Don't load host tables specified by comma-separated list."),
|
|
||||||
0, ARG_TYPE_STRING},
|
|
||||||
{"load-only", 'n', 0,
|
|
||||||
N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING},
|
|
||||||
{"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE},
|
|
||||||
{"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE},
|
|
||||||
{"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
|
||||||
{"oemtable", 't', 0,
|
|
||||||
N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
|
||||||
{"oemtablerev", 'r', 0,
|
|
||||||
N_("Set OEMTABLE revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
|
|
||||||
{"oemtablecreator", 'c', 0,
|
|
||||||
N_("Set creator field of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
|
||||||
{"oemtablecreatorrev", 'd', 0,
|
|
||||||
N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
|
|
||||||
{"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some."
|
|
||||||
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."),
|
|
||||||
0, ARG_TYPE_NONE},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */
|
|
||||||
grub_uint8_t
|
|
||||||
grub_byte_checksum (void *base, grub_size_t size)
|
|
||||||
{
|
|
||||||
grub_uint8_t *ptr;
|
|
||||||
grub_uint8_t ret = 0;
|
|
||||||
for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size;
|
|
||||||
ptr++)
|
|
||||||
ret += *ptr;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rev1 is 1 if ACPIv1 is to be generated, 0 otherwise.
|
|
||||||
rev2 contains the revision of ACPIv2+ to generate or 0 if none. */
|
|
||||||
static int rev1, rev2;
|
|
||||||
/* OEMID of RSDP, RSDT and XSDT. */
|
|
||||||
static char root_oemid[6];
|
|
||||||
/* OEMTABLE of the same tables. */
|
|
||||||
static char root_oemtable[8];
|
|
||||||
/* OEMREVISION of the same tables. */
|
|
||||||
static grub_uint32_t root_oemrev;
|
|
||||||
/* CreatorID of the same tables. */
|
|
||||||
static char root_creator_id[4];
|
|
||||||
/* CreatorRevision of the same tables. */
|
|
||||||
static grub_uint32_t root_creator_rev;
|
|
||||||
static struct grub_acpi_rsdp_v10 *rsdpv1_new = 0;
|
|
||||||
static struct grub_acpi_rsdp_v20 *rsdpv2_new = 0;
|
|
||||||
static char *playground = 0, *playground_ptr = 0;
|
|
||||||
static int playground_size = 0;
|
|
||||||
|
|
||||||
/* Linked list of ACPI tables. */
|
|
||||||
struct efiemu_acpi_table
|
|
||||||
{
|
|
||||||
void *addr;
|
|
||||||
grub_size_t size;
|
|
||||||
struct efiemu_acpi_table *next;
|
|
||||||
};
|
|
||||||
static struct efiemu_acpi_table *acpi_tables = 0;
|
|
||||||
|
|
||||||
/* DSDT isn't in RSDT. So treat it specially. */
|
|
||||||
static void *table_dsdt = 0;
|
|
||||||
/* Pointer to recreated RSDT. */
|
|
||||||
static void *rsdt_addr = 0;
|
|
||||||
|
|
||||||
/* Allocation handles for different tables. */
|
|
||||||
static grub_size_t dsdt_size = 0;
|
|
||||||
|
|
||||||
/* Address of original FACS. */
|
|
||||||
static grub_uint32_t facs_addr = 0;
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v20 *
|
|
||||||
grub_acpi_get_rsdpv2 (void)
|
|
||||||
{
|
|
||||||
if (rsdpv2_new)
|
|
||||||
return rsdpv2_new;
|
|
||||||
if (rsdpv1_new)
|
|
||||||
return 0;
|
|
||||||
return grub_machine_acpi_get_rsdpv2 ();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v10 *
|
|
||||||
grub_acpi_get_rsdpv1 (void)
|
|
||||||
{
|
|
||||||
if (rsdpv1_new)
|
|
||||||
return rsdpv1_new;
|
|
||||||
if (rsdpv2_new)
|
|
||||||
return 0;
|
|
||||||
return grub_machine_acpi_get_rsdpv1 ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
iszero (grub_uint8_t *reg, int size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
if (reg[i])
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_acpi_create_ebda (void)
|
|
||||||
{
|
|
||||||
int ebda_kb_len;
|
|
||||||
int ebda_len;
|
|
||||||
int mmapregion = 0;
|
|
||||||
grub_uint8_t *ebda, *v1inebda = 0, *v2inebda = 0;
|
|
||||||
grub_uint64_t highestlow = 0;
|
|
||||||
grub_uint8_t *targetebda, *target;
|
|
||||||
struct grub_acpi_rsdp_v10 *v1;
|
|
||||||
struct grub_acpi_rsdp_v20 *v2;
|
|
||||||
auto int NESTED_FUNC_ATTR find_hook (grub_uint64_t, grub_uint64_t,
|
|
||||||
grub_uint32_t);
|
|
||||||
int NESTED_FUNC_ATTR find_hook (grub_uint64_t start, grub_uint64_t size,
|
|
||||||
grub_uint32_t type)
|
|
||||||
{
|
|
||||||
grub_uint64_t end = start + size;
|
|
||||||
if (type != GRUB_MACHINE_MEMORY_AVAILABLE)
|
|
||||||
return 0;
|
|
||||||
if (end > 0x100000)
|
|
||||||
end = 0x100000;
|
|
||||||
if (end > start + ebda_len
|
|
||||||
&& highestlow < ((end - ebda_len) & (~0xf)) )
|
|
||||||
highestlow = (end - ebda_len) & (~0xf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ebda = (grub_uint8_t *) UINT_TO_PTR ((*((grub_uint16_t *)0x40e)) << 4);
|
|
||||||
ebda_kb_len = *(grub_uint16_t *) ebda;
|
|
||||||
if (! ebda || ebda_kb_len > 16)
|
|
||||||
ebda_kb_len = 0;
|
|
||||||
ebda_len = (ebda_kb_len + 1) << 10;
|
|
||||||
|
|
||||||
/* FIXME: use low-memory mm allocation once it's available. */
|
|
||||||
grub_mmap_iterate (find_hook);
|
|
||||||
targetebda = (grub_uint8_t *) UINT_TO_PTR (highestlow);
|
|
||||||
grub_dprintf ("acpi", "creating ebda @%llx\n",
|
|
||||||
(unsigned long long) highestlow);
|
|
||||||
if (! highestlow)
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't find space for the new EBDA");
|
|
||||||
|
|
||||||
mmapregion = grub_mmap_register (PTR_TO_UINT64 (targetebda), ebda_len,
|
|
||||||
GRUB_MACHINE_MEMORY_RESERVED);
|
|
||||||
if (! mmapregion)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
/* XXX: EBDA is unstandardized, so this implementation is heuristical. */
|
|
||||||
if (ebda_kb_len)
|
|
||||||
grub_memcpy (targetebda, ebda, 0x400);
|
|
||||||
else
|
|
||||||
grub_memset (targetebda, 0, 0x400);
|
|
||||||
*((grub_uint16_t *) targetebda) = ebda_kb_len + 1;
|
|
||||||
target = targetebda;
|
|
||||||
|
|
||||||
v1 = grub_acpi_get_rsdpv1 ();
|
|
||||||
v2 = grub_acpi_get_rsdpv2 ();
|
|
||||||
if (v2 && v2->length > 40)
|
|
||||||
v2 = 0;
|
|
||||||
|
|
||||||
/* First try to replace already existing rsdp. */
|
|
||||||
if (v2)
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Scanning EBDA for old rsdpv2\n");
|
|
||||||
for (; target < targetebda + 0x400 - v2->length; target += 0x10)
|
|
||||||
if (grub_memcmp (target, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (target,
|
|
||||||
sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v10 *) target)->revision != 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v20 *) target)->length <= v2->length)
|
|
||||||
{
|
|
||||||
grub_memcpy (target, v2, v2->length);
|
|
||||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
|
||||||
v2inebda = target;
|
|
||||||
target += v2->length;
|
|
||||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
|
||||||
v2 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v1)
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n");
|
|
||||||
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
target += 0x10)
|
|
||||||
if (grub_memcmp (target, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (target,
|
|
||||||
sizeof (struct grub_acpi_rsdp_v10)) == 0)
|
|
||||||
{
|
|
||||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
|
||||||
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
|
||||||
v1inebda = target;
|
|
||||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
|
||||||
v1 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target = targetebda + 0x100;
|
|
||||||
|
|
||||||
/* Try contiguous zeros. */
|
|
||||||
if (v2)
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
|
|
||||||
for (; target < targetebda + 0x400 - v2->length; target += 0x10)
|
|
||||||
if (iszero (target, v2->length))
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
|
||||||
grub_memcpy (target, v2, v2->length);
|
|
||||||
v2inebda = target;
|
|
||||||
target += v2->length;
|
|
||||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
|
||||||
v2 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v1)
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
|
|
||||||
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
target += 0x10)
|
|
||||||
if (iszero (target, sizeof (struct grub_acpi_rsdp_v10)))
|
|
||||||
{
|
|
||||||
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
|
||||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
|
||||||
v1inebda = target;
|
|
||||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
|
||||||
v1 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v1 || v2)
|
|
||||||
{
|
|
||||||
grub_mmap_unregister (mmapregion);
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't find suitable spot in EBDA");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove any other RSDT. */
|
|
||||||
for (target = targetebda;
|
|
||||||
target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
target += 0x10)
|
|
||||||
if (grub_memcmp (target, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (target,
|
|
||||||
sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& target != v1inebda && target != v2inebda)
|
|
||||||
*target = 0;
|
|
||||||
|
|
||||||
grub_dprintf ("acpi", "Switching EBDA\n");
|
|
||||||
(*((grub_uint16_t *) 0x40e)) = ((long)targetebda) >> 4;
|
|
||||||
grub_dprintf ("acpi", "EBDA switched\n");
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create tables common to ACPIv1 and ACPIv2+ */
|
|
||||||
static void
|
|
||||||
setup_common_tables (void)
|
|
||||||
{
|
|
||||||
struct efiemu_acpi_table *cur;
|
|
||||||
struct grub_acpi_table_header *rsdt;
|
|
||||||
grub_uint32_t *rsdt_entry;
|
|
||||||
int numoftables;
|
|
||||||
|
|
||||||
/* Treat DSDT. */
|
|
||||||
grub_memcpy (playground_ptr, table_dsdt, dsdt_size);
|
|
||||||
grub_free (table_dsdt);
|
|
||||||
table_dsdt = playground_ptr;
|
|
||||||
playground_ptr += dsdt_size;
|
|
||||||
|
|
||||||
/* Treat other tables. */
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
{
|
|
||||||
struct grub_acpi_fadt *fadt;
|
|
||||||
|
|
||||||
grub_memcpy (playground_ptr, cur->addr, cur->size);
|
|
||||||
grub_free (cur->addr);
|
|
||||||
cur->addr = playground_ptr;
|
|
||||||
playground_ptr += cur->size;
|
|
||||||
|
|
||||||
/* If it's FADT correct DSDT and FACS addresses. */
|
|
||||||
fadt = (struct grub_acpi_fadt *) cur->addr;
|
|
||||||
if (grub_memcmp (fadt->hdr.signature, "FACP", 4) == 0)
|
|
||||||
{
|
|
||||||
fadt->dsdt_addr = PTR_TO_UINT32 (table_dsdt);
|
|
||||||
fadt->facs_addr = facs_addr;
|
|
||||||
|
|
||||||
/* Does a revision 2 exist at all? */
|
|
||||||
if (fadt->hdr.revision >= 3)
|
|
||||||
{
|
|
||||||
fadt->dsdt_xaddr = PTR_TO_UINT64 (table_dsdt);
|
|
||||||
fadt->facs_xaddr = facs_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Recompute checksum. */
|
|
||||||
fadt->hdr.checksum = 0;
|
|
||||||
fadt->hdr.checksum = 1 + ~grub_byte_checksum (fadt, fadt->hdr.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill RSDT entries. */
|
|
||||||
numoftables = 0;
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
numoftables++;
|
|
||||||
|
|
||||||
rsdt_addr = rsdt = (struct grub_acpi_table_header *) playground_ptr;
|
|
||||||
playground_ptr += sizeof (struct grub_acpi_table_header) + 4 * numoftables;
|
|
||||||
|
|
||||||
rsdt_entry = (grub_uint32_t *)(rsdt + 1);
|
|
||||||
|
|
||||||
/* Fill RSDT header. */
|
|
||||||
grub_memcpy (&(rsdt->signature), "RSDT", 4);
|
|
||||||
rsdt->length = sizeof (struct grub_acpi_table_header) + 4 * numoftables;
|
|
||||||
rsdt->revision = 1;
|
|
||||||
grub_memcpy (&(rsdt->oemid), root_oemid, 6);
|
|
||||||
grub_memcpy (&(rsdt->oemtable), root_oemtable, 4);
|
|
||||||
rsdt->oemrev = root_oemrev;
|
|
||||||
grub_memcpy (&(rsdt->creator_id), root_creator_id, 6);
|
|
||||||
rsdt->creator_rev = root_creator_rev;
|
|
||||||
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
*(rsdt_entry++) = PTR_TO_UINT32 (cur->addr);
|
|
||||||
|
|
||||||
/* Recompute checksum. */
|
|
||||||
rsdt->checksum = 0;
|
|
||||||
rsdt->checksum = 1 + ~grub_byte_checksum (rsdt, rsdt->length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Regenerate ACPIv1 RSDP */
|
|
||||||
static void
|
|
||||||
setv1table (void)
|
|
||||||
{
|
|
||||||
/* Create RSDP. */
|
|
||||||
rsdpv1_new = (struct grub_acpi_rsdp_v10 *) playground_ptr;
|
|
||||||
playground_ptr += sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
grub_memcpy (&(rsdpv1_new->signature), "RSD PTR ", 8);
|
|
||||||
grub_memcpy (&(rsdpv1_new->oemid), root_oemid, sizeof (rsdpv1_new->oemid));
|
|
||||||
rsdpv1_new->revision = 0;
|
|
||||||
rsdpv1_new->rsdt_addr = PTR_TO_UINT32 (rsdt_addr);
|
|
||||||
rsdpv1_new->checksum = 0;
|
|
||||||
rsdpv1_new->checksum = 1 + ~grub_byte_checksum (rsdpv1_new,
|
|
||||||
sizeof (*rsdpv1_new));
|
|
||||||
grub_dprintf ("acpi", "Generated ACPIv1 tables\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
setv2table (void)
|
|
||||||
{
|
|
||||||
struct grub_acpi_table_header *xsdt;
|
|
||||||
struct efiemu_acpi_table *cur;
|
|
||||||
grub_uint64_t *xsdt_entry;
|
|
||||||
int numoftables;
|
|
||||||
|
|
||||||
numoftables = 0;
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
numoftables++;
|
|
||||||
|
|
||||||
/* Create XSDT. */
|
|
||||||
xsdt = (struct grub_acpi_table_header *) playground_ptr;
|
|
||||||
playground_ptr += sizeof (struct grub_acpi_table_header) + 8 * numoftables;
|
|
||||||
|
|
||||||
xsdt_entry = (grub_uint64_t *)(xsdt + 1);
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
*(xsdt_entry++) = PTR_TO_UINT64 (cur->addr);
|
|
||||||
grub_memcpy (&(xsdt->signature), "XSDT", 4);
|
|
||||||
xsdt->length = sizeof (struct grub_acpi_table_header) + 8 * numoftables;
|
|
||||||
xsdt->revision = 1;
|
|
||||||
grub_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid));
|
|
||||||
grub_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable));
|
|
||||||
xsdt->oemrev = root_oemrev;
|
|
||||||
grub_memcpy (&(xsdt->creator_id), root_creator_id, sizeof (xsdt->creator_id));
|
|
||||||
xsdt->creator_rev = root_creator_rev;
|
|
||||||
xsdt->checksum = 0;
|
|
||||||
xsdt->checksum = 1 + ~grub_byte_checksum (xsdt, xsdt->length);
|
|
||||||
|
|
||||||
/* Create RSDPv2. */
|
|
||||||
rsdpv2_new = (struct grub_acpi_rsdp_v20 *) playground_ptr;
|
|
||||||
playground_ptr += sizeof (struct grub_acpi_rsdp_v20);
|
|
||||||
grub_memcpy (&(rsdpv2_new->rsdpv1.signature), "RSD PTR ",
|
|
||||||
sizeof (rsdpv2_new->rsdpv1.signature));
|
|
||||||
grub_memcpy (&(rsdpv2_new->rsdpv1.oemid), root_oemid,
|
|
||||||
sizeof (rsdpv2_new->rsdpv1.oemid));
|
|
||||||
rsdpv2_new->rsdpv1.revision = rev2;
|
|
||||||
rsdpv2_new->rsdpv1.rsdt_addr = PTR_TO_UINT32 (rsdt_addr);
|
|
||||||
rsdpv2_new->rsdpv1.checksum = 0;
|
|
||||||
rsdpv2_new->rsdpv1.checksum = 1 + ~grub_byte_checksum
|
|
||||||
(&(rsdpv2_new->rsdpv1), sizeof (rsdpv2_new->rsdpv1));
|
|
||||||
rsdpv2_new->length = sizeof (*rsdpv2_new);
|
|
||||||
rsdpv2_new->xsdt_addr = PTR_TO_UINT64 (xsdt);
|
|
||||||
rsdpv2_new->checksum = 0;
|
|
||||||
rsdpv2_new->checksum = 1 + ~grub_byte_checksum (rsdpv2_new,
|
|
||||||
rsdpv2_new->length);
|
|
||||||
grub_dprintf ("acpi", "Generated ACPIv2 tables\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
free_tables (void)
|
|
||||||
{
|
|
||||||
struct efiemu_acpi_table *cur, *t;
|
|
||||||
if (table_dsdt)
|
|
||||||
grub_free (table_dsdt);
|
|
||||||
for (cur = acpi_tables; cur;)
|
|
||||||
{
|
|
||||||
t = cur;
|
|
||||||
grub_free (cur->addr);
|
|
||||||
cur = cur->next;
|
|
||||||
grub_free (t);
|
|
||||||
}
|
|
||||||
acpi_tables = 0;
|
|
||||||
table_dsdt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_acpi (struct grub_extcmd *cmd,
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
struct grub_acpi_rsdp_v10 *rsdp;
|
|
||||||
struct efiemu_acpi_table *cur, *t;
|
|
||||||
grub_err_t err;
|
|
||||||
int i, mmapregion;
|
|
||||||
int numoftables;
|
|
||||||
|
|
||||||
/* Default values if no RSDP is found. */
|
|
||||||
rev1 = 1;
|
|
||||||
rev2 = 3;
|
|
||||||
|
|
||||||
facs_addr = 0;
|
|
||||||
playground = playground_ptr = 0;
|
|
||||||
playground_size = 0;
|
|
||||||
|
|
||||||
rsdp = (struct grub_acpi_rsdp_v10 *) grub_machine_acpi_get_rsdpv2 ();
|
|
||||||
|
|
||||||
if (! rsdp)
|
|
||||||
rsdp = grub_machine_acpi_get_rsdpv1 ();
|
|
||||||
|
|
||||||
if (rsdp)
|
|
||||||
{
|
|
||||||
grub_uint32_t *entry_ptr;
|
|
||||||
char *exclude = 0;
|
|
||||||
char *load_only = 0;
|
|
||||||
char *ptr;
|
|
||||||
/* RSDT consists of header and an array of 32-bit pointers. */
|
|
||||||
struct grub_acpi_table_header *rsdt;
|
|
||||||
|
|
||||||
exclude = state[0].set ? grub_strdup (state[0].arg) : 0;
|
|
||||||
if (exclude)
|
|
||||||
{
|
|
||||||
for (ptr = exclude; *ptr; ptr++)
|
|
||||||
*ptr = grub_tolower (*ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
load_only = state[1].set ? grub_strdup (state[1].arg) : 0;
|
|
||||||
if (load_only)
|
|
||||||
{
|
|
||||||
for (ptr = load_only; *ptr; ptr++)
|
|
||||||
*ptr = grub_tolower (*ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set revision variables to replicate the same version as host. */
|
|
||||||
rev1 = ! rsdp->revision;
|
|
||||||
rev2 = rsdp->revision;
|
|
||||||
rsdt = (struct grub_acpi_table_header *) UINT_TO_PTR (rsdp->rsdt_addr);
|
|
||||||
/* Load host tables. */
|
|
||||||
for (entry_ptr = (grub_uint32_t *) (rsdt + 1);
|
|
||||||
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt)
|
|
||||||
+ rsdt->length);
|
|
||||||
entry_ptr++)
|
|
||||||
{
|
|
||||||
char signature[5];
|
|
||||||
struct efiemu_acpi_table *table;
|
|
||||||
struct grub_acpi_table_header *curtable
|
|
||||||
= (struct grub_acpi_table_header *) UINT_TO_PTR (*entry_ptr);
|
|
||||||
signature[4] = 0;
|
|
||||||
for (i = 0; i < 4;i++)
|
|
||||||
signature[i] = grub_tolower (curtable->signature[i]);
|
|
||||||
|
|
||||||
/* If it's FADT it contains addresses of DSDT and FACS. */
|
|
||||||
if (grub_strcmp (signature, "facp") == 0)
|
|
||||||
{
|
|
||||||
struct grub_acpi_table_header *dsdt;
|
|
||||||
struct grub_acpi_fadt *fadt = (struct grub_acpi_fadt *) curtable;
|
|
||||||
|
|
||||||
/* Set root header variables to the same values
|
|
||||||
as FACP by default. */
|
|
||||||
grub_memcpy (&root_oemid, &(fadt->hdr.oemid),
|
|
||||||
sizeof (root_oemid));
|
|
||||||
grub_memcpy (&root_oemtable, &(fadt->hdr.oemtable),
|
|
||||||
sizeof (root_oemtable));
|
|
||||||
root_oemrev = fadt->hdr.oemrev;
|
|
||||||
grub_memcpy (&root_creator_id, &(fadt->hdr.creator_id),
|
|
||||||
sizeof (root_creator_id));
|
|
||||||
root_creator_rev = fadt->hdr.creator_rev;
|
|
||||||
|
|
||||||
/* Load DSDT if not excluded. */
|
|
||||||
dsdt = (struct grub_acpi_table_header *)
|
|
||||||
UINT_TO_PTR (fadt->dsdt_addr);
|
|
||||||
if (dsdt && (! exclude || ! grub_strword (exclude, "dsdt"))
|
|
||||||
&& (! load_only || grub_strword (load_only, "dsdt"))
|
|
||||||
&& dsdt->length >= sizeof (*dsdt))
|
|
||||||
{
|
|
||||||
dsdt_size = dsdt->length;
|
|
||||||
table_dsdt = grub_malloc (dsdt->length);
|
|
||||||
if (! table_dsdt)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
grub_free (exclude);
|
|
||||||
grub_free (load_only);
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't allocate table");
|
|
||||||
}
|
|
||||||
grub_memcpy (table_dsdt, dsdt, dsdt->length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save FACS address. FACS shouldn't be overridden. */
|
|
||||||
facs_addr = fadt->facs_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip excluded tables. */
|
|
||||||
if (exclude && grub_strword (exclude, signature))
|
|
||||||
continue;
|
|
||||||
if (load_only && ! grub_strword (load_only, signature))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Sanity check. */
|
|
||||||
if (curtable->length < sizeof (*curtable))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
table = (struct efiemu_acpi_table *) grub_malloc
|
|
||||||
(sizeof (struct efiemu_acpi_table));
|
|
||||||
if (! table)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
grub_free (exclude);
|
|
||||||
grub_free (load_only);
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't allocate table structure");
|
|
||||||
}
|
|
||||||
table->size = curtable->length;
|
|
||||||
table->addr = grub_malloc (table->size);
|
|
||||||
playground_size += table->size;
|
|
||||||
if (! table->addr)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't allocate table");
|
|
||||||
}
|
|
||||||
table->next = acpi_tables;
|
|
||||||
acpi_tables = table;
|
|
||||||
grub_memcpy (table->addr, curtable, table->size);
|
|
||||||
}
|
|
||||||
grub_free (exclude);
|
|
||||||
grub_free (load_only);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Does user specify versions to generate? */
|
|
||||||
if (state[2].set || state[3].set)
|
|
||||||
{
|
|
||||||
rev1 = state[2].set;
|
|
||||||
if (state[3].set)
|
|
||||||
rev2 = rev2 ? : 2;
|
|
||||||
else
|
|
||||||
rev2 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Does user override root header information? */
|
|
||||||
if (state[4].set)
|
|
||||||
grub_strncpy (root_oemid, state[4].arg, sizeof (root_oemid));
|
|
||||||
if (state[5].set)
|
|
||||||
grub_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable));
|
|
||||||
if (state[6].set)
|
|
||||||
root_oemrev = grub_strtoul (state[6].arg, 0, 0);
|
|
||||||
if (state[7].set)
|
|
||||||
grub_strncpy (root_creator_id, state[7].arg, sizeof (root_creator_id));
|
|
||||||
if (state[8].set)
|
|
||||||
root_creator_rev = grub_strtoul (state[8].arg, 0, 0);
|
|
||||||
|
|
||||||
/* Load user tables */
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
grub_size_t size;
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
file = grub_gzfile_open (args[i], 1);
|
|
||||||
if (! file)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't open file %s", args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
size = grub_file_size (file);
|
|
||||||
if (size < sizeof (struct grub_acpi_table_header))
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "file %s is too small", args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = (char *) grub_malloc (size);
|
|
||||||
if (! buf)
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't read file %s", args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_file_read (file, buf, size) != (int) size)
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", args[i]);
|
|
||||||
}
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
if (grub_memcmp (((struct grub_acpi_table_header *) buf)->signature,
|
|
||||||
"DSDT", 4) == 0)
|
|
||||||
{
|
|
||||||
grub_free (table_dsdt);
|
|
||||||
table_dsdt = buf;
|
|
||||||
dsdt_size = size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct efiemu_acpi_table *table;
|
|
||||||
table = (struct efiemu_acpi_table *) grub_malloc
|
|
||||||
(sizeof (struct efiemu_acpi_table));
|
|
||||||
if (! table)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't allocate table structure");
|
|
||||||
}
|
|
||||||
|
|
||||||
table->size = size;
|
|
||||||
table->addr = buf;
|
|
||||||
playground_size += table->size;
|
|
||||||
|
|
||||||
table->next = acpi_tables;
|
|
||||||
acpi_tables = table;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
numoftables = 0;
|
|
||||||
for (cur = acpi_tables; cur; cur = cur->next)
|
|
||||||
numoftables++;
|
|
||||||
|
|
||||||
/* DSDT. */
|
|
||||||
playground_size += dsdt_size;
|
|
||||||
/* RSDT. */
|
|
||||||
playground_size += sizeof (struct grub_acpi_table_header) + 4 * numoftables;
|
|
||||||
/* RSDPv1. */
|
|
||||||
playground_size += sizeof (struct grub_acpi_rsdp_v10);
|
|
||||||
/* XSDT. */
|
|
||||||
playground_size += sizeof (struct grub_acpi_table_header) + 8 * numoftables;
|
|
||||||
/* RSDPv2. */
|
|
||||||
playground_size += sizeof (struct grub_acpi_rsdp_v20);
|
|
||||||
|
|
||||||
playground = playground_ptr
|
|
||||||
= grub_mmap_malign_and_register (1, playground_size, &mmapregion,
|
|
||||||
GRUB_MACHINE_MEMORY_ACPI, 0);
|
|
||||||
|
|
||||||
if (! playground)
|
|
||||||
{
|
|
||||||
free_tables ();
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"couldn't allocate space for ACPI tables");
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_common_tables ();
|
|
||||||
|
|
||||||
/* Request space for RSDPv1. */
|
|
||||||
if (rev1)
|
|
||||||
setv1table ();
|
|
||||||
|
|
||||||
/* Request space for RSDPv2+ and XSDT. */
|
|
||||||
if (rev2)
|
|
||||||
setv2table ();
|
|
||||||
|
|
||||||
for (cur = acpi_tables; cur;)
|
|
||||||
{
|
|
||||||
t = cur;
|
|
||||||
cur = cur->next;
|
|
||||||
grub_free (t);
|
|
||||||
}
|
|
||||||
acpi_tables = 0;
|
|
||||||
|
|
||||||
if (! state[9].set && (err = grub_acpi_create_ebda ()))
|
|
||||||
{
|
|
||||||
rsdpv1_new = 0;
|
|
||||||
rsdpv2_new = 0;
|
|
||||||
grub_mmap_free_and_unregister (mmapregion);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
|
||||||
{
|
|
||||||
struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
|
|
||||||
struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
|
|
||||||
|
|
||||||
grub_efi_system_table->boot_services->install_configuration_table
|
|
||||||
(&acpi20, grub_acpi_get_rsdpv2 ());
|
|
||||||
grub_efi_system_table->boot_services->install_configuration_table
|
|
||||||
(&acpi, grub_acpi_get_rsdpv1 ());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(acpi)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
|
||||||
"--load-only=table1,table2] FILE1"
|
|
||||||
" [FILE2] [...]"),
|
|
||||||
N_("Load host ACPI tables and tables "
|
|
||||||
"specified by arguments."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(acpi)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
/* blocklist.c - print the block list of a file */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
unsigned long start_sector = 0;
|
|
||||||
unsigned num_sectors = 0;
|
|
||||||
int num_entries = 0;
|
|
||||||
grub_disk_addr_t part_start = 0;
|
|
||||||
auto void NESTED_FUNC_ATTR read_blocklist (grub_disk_addr_t sector, unsigned offset,
|
|
||||||
unsigned length);
|
|
||||||
auto void NESTED_FUNC_ATTR print_blocklist (grub_disk_addr_t sector, unsigned num,
|
|
||||||
unsigned offset, unsigned length);
|
|
||||||
|
|
||||||
void NESTED_FUNC_ATTR read_blocklist (grub_disk_addr_t sector, unsigned offset,
|
|
||||||
unsigned length)
|
|
||||||
{
|
|
||||||
if (num_sectors > 0)
|
|
||||||
{
|
|
||||||
if (start_sector + num_sectors == sector
|
|
||||||
&& offset == 0 && length == GRUB_DISK_SECTOR_SIZE)
|
|
||||||
{
|
|
||||||
num_sectors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_blocklist (start_sector, num_sectors, 0, 0);
|
|
||||||
num_sectors = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (offset == 0 && length == GRUB_DISK_SECTOR_SIZE)
|
|
||||||
{
|
|
||||||
start_sector = sector;
|
|
||||||
num_sectors++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print_blocklist (sector, 0, offset, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NESTED_FUNC_ATTR print_blocklist (grub_disk_addr_t sector, unsigned num,
|
|
||||||
unsigned offset, unsigned length)
|
|
||||||
{
|
|
||||||
if (num_entries++)
|
|
||||||
grub_printf (",");
|
|
||||||
|
|
||||||
grub_printf ("%llu", (unsigned long long) (sector - part_start));
|
|
||||||
if (num > 0)
|
|
||||||
grub_printf ("+%u", num);
|
|
||||||
if (offset != 0 || length != 0)
|
|
||||||
grub_printf ("[%u-%u]", offset, offset + length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (! file->device->disk)
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
|
||||||
"this command is available only for disk devices");
|
|
||||||
|
|
||||||
if (file->device->disk->partition)
|
|
||||||
part_start = grub_partition_get_start (file->device->disk->partition);
|
|
||||||
|
|
||||||
file->read_hook = read_blocklist;
|
|
||||||
|
|
||||||
while (grub_file_read (file, buf, sizeof (buf)) > 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
if (num_sectors > 0)
|
|
||||||
print_blocklist (start_sector, num_sectors, 0, 0);
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(blocklist)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
|
|
||||||
N_("FILE"), N_("Print a block list."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(blocklist)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
-196
@@ -1,196 +0,0 @@
|
|||||||
/* boot.c - command to boot an operating system */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2002,2003,2004,2005,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/loader.h>
|
|
||||||
#include <grub/kernel.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t (*grub_loader_boot_func) (void);
|
|
||||||
static grub_err_t (*grub_loader_unload_func) (void);
|
|
||||||
static int grub_loader_noreturn;
|
|
||||||
|
|
||||||
struct grub_preboot_t
|
|
||||||
{
|
|
||||||
grub_err_t (*preboot_func) (int);
|
|
||||||
grub_err_t (*preboot_rest_func) (void);
|
|
||||||
grub_loader_preboot_hook_prio_t prio;
|
|
||||||
struct grub_preboot_t *next;
|
|
||||||
struct grub_preboot_t *prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int grub_loader_loaded;
|
|
||||||
static struct grub_preboot_t *preboots_head = 0,
|
|
||||||
*preboots_tail = 0;
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_loader_is_loaded (void)
|
|
||||||
{
|
|
||||||
return grub_loader_loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Register a preboot hook. */
|
|
||||||
void *
|
|
||||||
grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noreturn),
|
|
||||||
grub_err_t (*preboot_rest_func) (void),
|
|
||||||
grub_loader_preboot_hook_prio_t prio)
|
|
||||||
{
|
|
||||||
struct grub_preboot_t *cur, *new_preboot;
|
|
||||||
|
|
||||||
if (! preboot_func && ! preboot_rest_func)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
new_preboot = (struct grub_preboot_t *)
|
|
||||||
grub_malloc (sizeof (struct grub_preboot_t));
|
|
||||||
if (! new_preboot)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "hook not added");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_preboot->preboot_func = preboot_func;
|
|
||||||
new_preboot->preboot_rest_func = preboot_rest_func;
|
|
||||||
new_preboot->prio = prio;
|
|
||||||
|
|
||||||
for (cur = preboots_head; cur && cur->prio > prio; cur = cur->next);
|
|
||||||
|
|
||||||
if (cur)
|
|
||||||
{
|
|
||||||
new_preboot->next = cur;
|
|
||||||
new_preboot->prev = cur->prev;
|
|
||||||
cur->prev = new_preboot;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_preboot->next = 0;
|
|
||||||
new_preboot->prev = preboots_tail;
|
|
||||||
preboots_tail = new_preboot;
|
|
||||||
}
|
|
||||||
if (new_preboot->prev)
|
|
||||||
new_preboot->prev->next = new_preboot;
|
|
||||||
else
|
|
||||||
preboots_head = new_preboot;
|
|
||||||
|
|
||||||
return new_preboot;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_loader_unregister_preboot_hook (void *hnd)
|
|
||||||
{
|
|
||||||
struct grub_preboot_t *preb = hnd;
|
|
||||||
|
|
||||||
if (preb->next)
|
|
||||||
preb->next->prev = preb->prev;
|
|
||||||
else
|
|
||||||
preboots_tail = preb->prev;
|
|
||||||
if (preb->prev)
|
|
||||||
preb->prev->next = preb->next;
|
|
||||||
else
|
|
||||||
preboots_head = preb->next;
|
|
||||||
|
|
||||||
grub_free (preb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_loader_set (grub_err_t (*boot) (void),
|
|
||||||
grub_err_t (*unload) (void),
|
|
||||||
int noreturn)
|
|
||||||
{
|
|
||||||
if (grub_loader_loaded && grub_loader_unload_func)
|
|
||||||
grub_loader_unload_func ();
|
|
||||||
|
|
||||||
grub_loader_boot_func = boot;
|
|
||||||
grub_loader_unload_func = unload;
|
|
||||||
grub_loader_noreturn = noreturn;
|
|
||||||
|
|
||||||
grub_loader_loaded = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_loader_unset(void)
|
|
||||||
{
|
|
||||||
if (grub_loader_loaded && grub_loader_unload_func)
|
|
||||||
grub_loader_unload_func ();
|
|
||||||
|
|
||||||
grub_loader_boot_func = 0;
|
|
||||||
grub_loader_unload_func = 0;
|
|
||||||
|
|
||||||
grub_loader_loaded = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_loader_boot (void)
|
|
||||||
{
|
|
||||||
grub_err_t err = GRUB_ERR_NONE;
|
|
||||||
struct grub_preboot_t *cur;
|
|
||||||
|
|
||||||
if (! grub_loader_loaded)
|
|
||||||
return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");
|
|
||||||
|
|
||||||
if (grub_loader_noreturn)
|
|
||||||
grub_machine_fini ();
|
|
||||||
|
|
||||||
for (cur = preboots_head; cur; cur = cur->next)
|
|
||||||
{
|
|
||||||
err = cur->preboot_func (grub_loader_noreturn);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
for (cur = cur->prev; cur; cur = cur->prev)
|
|
||||||
cur->preboot_rest_func ();
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = (grub_loader_boot_func) ();
|
|
||||||
|
|
||||||
for (cur = preboots_tail; cur; cur = cur->prev)
|
|
||||||
if (! err)
|
|
||||||
err = cur->preboot_rest_func ();
|
|
||||||
else
|
|
||||||
cur->preboot_rest_func ();
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* boot */
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_boot (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return grub_loader_boot ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static grub_command_t cmd_boot;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(boot)
|
|
||||||
{
|
|
||||||
cmd_boot =
|
|
||||||
grub_register_command ("boot", grub_cmd_boot,
|
|
||||||
0, N_("Boot an operating system."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(boot)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_boot);
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/* cat.c - command to show the contents of a file */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/gzio.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
grub_ssize_t size;
|
|
||||||
int key = 0;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
|
||||||
|
|
||||||
file = grub_gzfile_open (args[0], 1);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0
|
|
||||||
&& key != GRUB_TERM_ESC)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
unsigned char c = buf[i];
|
|
||||||
|
|
||||||
if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
|
|
||||||
grub_putchar (c);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
|
||||||
grub_printf ("<%x>", (int) c);
|
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (grub_checkkey () >= 0 &&
|
|
||||||
(key = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != GRUB_TERM_ESC)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_putchar ('\n');
|
|
||||||
grub_refresh ();
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(cat)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
|
|
||||||
N_("FILE"), N_("Show the contents of a file."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(cat)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
-119
@@ -1,119 +0,0 @@
|
|||||||
/* cmd.c - command to cmp an operating system */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/gzio.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#define BUFFER_SIZE 512
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_ssize_t rd1, rd2;
|
|
||||||
grub_off_t pos;
|
|
||||||
grub_file_t file1 = 0;
|
|
||||||
grub_file_t file2 = 0;
|
|
||||||
char *buf1 = 0;
|
|
||||||
char *buf2 = 0;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
|
||||||
|
|
||||||
grub_printf ("Compare file `%s' with `%s':\n", args[0],
|
|
||||||
args[1]);
|
|
||||||
|
|
||||||
file1 = grub_gzfile_open (args[0], 1);
|
|
||||||
file2 = grub_gzfile_open (args[1], 1);
|
|
||||||
if (! file1 || ! file2)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (grub_file_size (file1) != grub_file_size (file2))
|
|
||||||
grub_printf ("Files differ in size: %llu [%s], %llu [%s]\n",
|
|
||||||
(unsigned long long) grub_file_size (file1), args[0],
|
|
||||||
(unsigned long long) grub_file_size (file2), args[1]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pos = 0;
|
|
||||||
|
|
||||||
buf1 = grub_malloc (BUFFER_SIZE);
|
|
||||||
buf2 = grub_malloc (BUFFER_SIZE);
|
|
||||||
|
|
||||||
if (! buf1 || ! buf2)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
rd1 = grub_file_read (file1, buf1, BUFFER_SIZE);
|
|
||||||
rd2 = grub_file_read (file2, buf2, BUFFER_SIZE);
|
|
||||||
|
|
||||||
if (rd1 != rd2)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < rd2; i++)
|
|
||||||
{
|
|
||||||
if (buf1[i] != buf2[i])
|
|
||||||
{
|
|
||||||
grub_printf ("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
|
|
||||||
(unsigned long long) (i + pos), buf1[i], args[0],
|
|
||||||
buf2[i], args[1]);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pos += BUFFER_SIZE;
|
|
||||||
|
|
||||||
}
|
|
||||||
while (rd2);
|
|
||||||
|
|
||||||
grub_printf ("The files are identical.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
|
|
||||||
if (buf1)
|
|
||||||
grub_free (buf1);
|
|
||||||
if (buf2)
|
|
||||||
grub_free (buf2);
|
|
||||||
if (file1)
|
|
||||||
grub_file_close (file1);
|
|
||||||
if (file2)
|
|
||||||
grub_file_close (file2);
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(cmp)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("cmp", grub_cmd_cmp,
|
|
||||||
N_("FILE1 FILE2"), N_("Compare two files."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(cmp)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/* configfile.c - command to manually load config file */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2006,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
int new_env;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
|
||||||
|
|
||||||
new_env = (cmd->name[0] == 'c');
|
|
||||||
|
|
||||||
if (new_env)
|
|
||||||
{
|
|
||||||
grub_cls ();
|
|
||||||
grub_env_context_open (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_normal_execute (args[0], 1, ! new_env);
|
|
||||||
|
|
||||||
if (new_env)
|
|
||||||
grub_env_context_close ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_configfile, cmd_source, cmd_dot;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(configfile)
|
|
||||||
{
|
|
||||||
cmd_configfile =
|
|
||||||
grub_register_command ("configfile", grub_cmd_source,
|
|
||||||
N_("FILE"), N_("Load another config file."));
|
|
||||||
cmd_source =
|
|
||||||
grub_register_command ("source", grub_cmd_source,
|
|
||||||
N_("FILE"),
|
|
||||||
N_("Load another config file without changing context.")
|
|
||||||
);
|
|
||||||
cmd_dot =
|
|
||||||
grub_register_command (".", grub_cmd_source,
|
|
||||||
N_("FILE"),
|
|
||||||
N_("Load another config file without changing context.")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(configfile)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_configfile);
|
|
||||||
grub_unregister_command (cmd_source);
|
|
||||||
grub_unregister_command (cmd_dot);
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/* crc.c - command to calculate the crc32 checksum of a file */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/lib/crc.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
grub_ssize_t size;
|
|
||||||
grub_uint32_t crc;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
|
||||||
if (! file)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
crc = 0;
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
|
||||||
crc = grub_getcrc32 (crc, buf, size);
|
|
||||||
|
|
||||||
if (grub_errno)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_printf ("%08x\n", crc);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_file_close (file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(crc)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("crc", grub_cmd_crc,
|
|
||||||
N_("FILE"),
|
|
||||||
N_("Calculate the crc32 checksum of a file."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(crc)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
-146
@@ -1,146 +0,0 @@
|
|||||||
/* date.c - command to display/set current datetime. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/datetime.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#define GRUB_DATETIME_SET_YEAR 1
|
|
||||||
#define GRUB_DATETIME_SET_MONTH 2
|
|
||||||
#define GRUB_DATETIME_SET_DAY 4
|
|
||||||
#define GRUB_DATETIME_SET_HOUR 8
|
|
||||||
#define GRUB_DATETIME_SET_MINUTE 16
|
|
||||||
#define GRUB_DATETIME_SET_SECOND 32
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_datetime datetime;
|
|
||||||
int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}};
|
|
||||||
int value[6], mask;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
if (grub_get_datetime (&datetime))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_printf ("%d-%02d-%02d %02d:%02d:%02d %s\n",
|
|
||||||
datetime.year, datetime.month, datetime.day,
|
|
||||||
datetime.hour, datetime.minute, datetime.second,
|
|
||||||
grub_get_weekday_name (&datetime));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_memset (&value, 0, sizeof (value));
|
|
||||||
mask = 0;
|
|
||||||
|
|
||||||
for (; argc; argc--, args++)
|
|
||||||
{
|
|
||||||
char *p, c;
|
|
||||||
int m1, ofs, n, cur_mask;
|
|
||||||
|
|
||||||
p = args[0];
|
|
||||||
m1 = grub_strtoul (p, &p, 10);
|
|
||||||
|
|
||||||
c = *p;
|
|
||||||
if (c == '-')
|
|
||||||
ofs = 0;
|
|
||||||
else if (c == ':')
|
|
||||||
ofs = 3;
|
|
||||||
else
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
value[ofs] = m1;
|
|
||||||
cur_mask = (1 << ofs);
|
|
||||||
mask &= ~(cur_mask * (1 + 2 + 4));
|
|
||||||
|
|
||||||
for (n = 1; (n < 3) && (*p); n++)
|
|
||||||
{
|
|
||||||
if (*p != c)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
value[ofs + n] = grub_strtoul (p + 1, &p, 10);
|
|
||||||
cur_mask |= (1 << (ofs + n));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*p)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if ((ofs == 0) && (n == 2))
|
|
||||||
{
|
|
||||||
value[ofs + 2] = value[ofs + 1];
|
|
||||||
value[ofs + 1] = value[ofs];
|
|
||||||
ofs++;
|
|
||||||
cur_mask <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; n; n--, ofs++)
|
|
||||||
if ((value [ofs] < limit[ofs][0]) ||
|
|
||||||
(value [ofs] > limit[ofs][1]))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
mask |= cur_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_get_datetime (&datetime))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_YEAR)
|
|
||||||
datetime.year = value[0];
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_MONTH)
|
|
||||||
datetime.month = value[1];
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_DAY)
|
|
||||||
datetime.day = value[2];
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_HOUR)
|
|
||||||
datetime.hour = value[3];
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_MINUTE)
|
|
||||||
datetime.minute = value[4];
|
|
||||||
|
|
||||||
if (mask & GRUB_DATETIME_SET_SECOND)
|
|
||||||
datetime.second = value[5];
|
|
||||||
|
|
||||||
return grub_set_datetime (&datetime);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid datetime");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(date)
|
|
||||||
{
|
|
||||||
cmd =
|
|
||||||
grub_register_command ("date", grub_cmd_date,
|
|
||||||
N_("[[year-]month-day] [hour:minute[:second]]"),
|
|
||||||
N_("Command to display/set current datetime."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(date)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
-124
@@ -1,124 +0,0 @@
|
|||||||
/* echo.c - Command to display a line of text */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 0},
|
|
||||||
{0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_echo (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
int newline = 1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Check if `-n' was used. */
|
|
||||||
if (state[0].set)
|
|
||||||
newline = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
char *arg = *args;
|
|
||||||
args++;
|
|
||||||
|
|
||||||
while (*arg)
|
|
||||||
{
|
|
||||||
/* In case `-e' is used, parse backslashes. */
|
|
||||||
if (*arg == '\\' && state[1].set)
|
|
||||||
{
|
|
||||||
arg++;
|
|
||||||
if (*arg == '\0')
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (*arg)
|
|
||||||
{
|
|
||||||
case '\\':
|
|
||||||
grub_printf ("\\");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'a':
|
|
||||||
grub_printf ("\a");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
|
||||||
newline = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f':
|
|
||||||
grub_printf ("\f");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'n':
|
|
||||||
grub_printf ("\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'r':
|
|
||||||
grub_printf ("\r");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't':
|
|
||||||
grub_printf ("\t");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
grub_printf ("\v");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
arg++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This was not an escaped character, or escaping is not
|
|
||||||
enabled. */
|
|
||||||
grub_printf ("%c", *arg);
|
|
||||||
arg++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If another argument follows, insert a space. */
|
|
||||||
if (i != argc - 1)
|
|
||||||
grub_printf (" " );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newline)
|
|
||||||
grub_printf ("\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(echo)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-e|-n] STRING"), N_("Display a line of text."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(echo)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/* acpi.c - get acpi tables. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/efi/api.h>
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v10 *
|
|
||||||
grub_machine_acpi_get_rsdpv1 (void)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
|
|
||||||
|
|
||||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
|
||||||
{
|
|
||||||
grub_efi_guid_t *guid =
|
|
||||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
|
||||||
|
|
||||||
if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
|
|
||||||
return (struct grub_acpi_rsdp_v10 *)
|
|
||||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v20 *
|
|
||||||
grub_machine_acpi_get_rsdpv2 (void)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
static grub_efi_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
|
||||||
|
|
||||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
|
||||||
{
|
|
||||||
grub_efi_guid_t *guid =
|
|
||||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
|
||||||
|
|
||||||
if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_guid_t)))
|
|
||||||
return (struct grub_acpi_rsdp_v20 *)
|
|
||||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
/* fixvideo.c - fix video problem in efi */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static struct grub_video_patch
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
grub_uint32_t pci_id;
|
|
||||||
grub_uint32_t mmio_bar;
|
|
||||||
grub_uint32_t mmio_reg;
|
|
||||||
grub_uint32_t mmio_old;
|
|
||||||
} video_patches[] =
|
|
||||||
{
|
|
||||||
{"Intel 945GM", 0x27a28086, 0, 0x71184, 0x1000000}, /* DSPBBASE */
|
|
||||||
{"Intel 965GM", 0x2a028086, 0, 0x7119C, 0x1000000}, /* DSPBSURF */
|
|
||||||
{0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
|
||||||
scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|
||||||
{
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
|
||||||
{
|
|
||||||
struct grub_video_patch *p = video_patches;
|
|
||||||
|
|
||||||
while (p->name)
|
|
||||||
{
|
|
||||||
if (p->pci_id == pciid)
|
|
||||||
{
|
|
||||||
grub_target_addr_t base;
|
|
||||||
|
|
||||||
grub_printf ("Found graphic card: %s\n", p->name);
|
|
||||||
addr += 8 + p->mmio_bar * 4;
|
|
||||||
base = grub_pci_read (addr);
|
|
||||||
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
|
|
||||||
(base & GRUB_PCI_ADDR_MEM_PREFETCH))
|
|
||||||
grub_printf ("Invalid MMIO bar %d\n", p->mmio_bar);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
base &= GRUB_PCI_ADDR_MEM_MASK;
|
|
||||||
base += p->mmio_reg;
|
|
||||||
|
|
||||||
if (*((volatile grub_uint32_t *) base) != p->mmio_old)
|
|
||||||
grub_printf ("Old value don't match\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*((volatile grub_uint32_t *) base) = 0;
|
|
||||||
if (*((volatile grub_uint32_t *) base))
|
|
||||||
grub_printf ("Set MMIO fails\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("Unknown graphic card: %x\n", pciid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_fixvideo (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_pci_iterate (scan_card);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_fixvideo;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(fixvideo)
|
|
||||||
{
|
|
||||||
cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo,
|
|
||||||
0, N_("Fix video problem."));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(fixvideo)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_fixvideo);
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/* loadbios.c - command to load a bios dump */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
|
|
||||||
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
|
||||||
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
|
|
||||||
|
|
||||||
#define EBDA_SEG_ADDR 0x40e
|
|
||||||
#define LOW_MEM_ADDR 0x413
|
|
||||||
#define FAKE_EBDA_SEG 0x9fc0
|
|
||||||
|
|
||||||
#define BLANK_MEM 0xffffffff
|
|
||||||
#define VBIOS_ADDR 0xc0000
|
|
||||||
#define SBIOS_ADDR 0xf0000
|
|
||||||
|
|
||||||
static int
|
|
||||||
enable_rom_area (void)
|
|
||||||
{
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
grub_uint32_t *rom_ptr;
|
|
||||||
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
|
||||||
|
|
||||||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
|
||||||
if (*rom_ptr != BLANK_MEM)
|
|
||||||
{
|
|
||||||
grub_printf ("ROM image is present.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: should be macroified. */
|
|
||||||
addr = grub_pci_make_address (dev, 144);
|
|
||||||
grub_pci_write_byte (addr++, 0x30);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
|
||||||
grub_pci_write_byte (addr, 0);
|
|
||||||
|
|
||||||
*rom_ptr = 0;
|
|
||||||
if (*rom_ptr != 0)
|
|
||||||
{
|
|
||||||
grub_printf ("Can\'t enable ROM area.\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
lock_rom_area (void)
|
|
||||||
{
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
|
||||||
|
|
||||||
/* FIXME: should be macroified. */
|
|
||||||
addr = grub_pci_make_address (dev, 144);
|
|
||||||
grub_pci_write_byte (addr++, 0x10);
|
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
|
||||||
grub_pci_write_byte (addr, 0x11);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
fake_bios_data (int use_rom)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
void *acpi, *smbios;
|
|
||||||
grub_uint16_t *ebda_seg_ptr, *low_mem_ptr;
|
|
||||||
|
|
||||||
ebda_seg_ptr = (grub_uint16_t *) EBDA_SEG_ADDR;
|
|
||||||
low_mem_ptr = (grub_uint16_t *) LOW_MEM_ADDR;
|
|
||||||
if ((*ebda_seg_ptr) || (*low_mem_ptr))
|
|
||||||
return;
|
|
||||||
|
|
||||||
acpi = 0;
|
|
||||||
smbios = 0;
|
|
||||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
|
||||||
{
|
|
||||||
grub_efi_guid_t *guid =
|
|
||||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
|
||||||
|
|
||||||
if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t)))
|
|
||||||
{
|
|
||||||
acpi = grub_efi_system_table->configuration_table[i].vendor_table;
|
|
||||||
grub_dprintf ("efi", "ACPI2: %p\n", acpi);
|
|
||||||
}
|
|
||||||
else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
|
|
||||||
{
|
|
||||||
void *t;
|
|
||||||
|
|
||||||
t = grub_efi_system_table->configuration_table[i].vendor_table;
|
|
||||||
if (! acpi)
|
|
||||||
acpi = t;
|
|
||||||
grub_dprintf ("efi", "ACPI: %p\n", t);
|
|
||||||
}
|
|
||||||
else if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_guid_t)))
|
|
||||||
{
|
|
||||||
smbios = grub_efi_system_table->configuration_table[i].vendor_table;
|
|
||||||
grub_dprintf ("efi", "SMBIOS: %p\n", smbios);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*ebda_seg_ptr = FAKE_EBDA_SEG;
|
|
||||||
*low_mem_ptr = (FAKE_EBDA_SEG >> 6);
|
|
||||||
|
|
||||||
*((grub_uint16_t *) (FAKE_EBDA_SEG << 4)) = 640 - *low_mem_ptr;
|
|
||||||
|
|
||||||
if (acpi)
|
|
||||||
grub_memcpy ((char *) ((FAKE_EBDA_SEG << 4) + 16), acpi, 1024 - 16);
|
|
||||||
|
|
||||||
if ((use_rom) && (smbios))
|
|
||||||
grub_memcpy ((char *) SBIOS_ADDR, (char *) smbios + 16, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_fakebios (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
if (enable_rom_area ())
|
|
||||||
{
|
|
||||||
fake_bios_data (1);
|
|
||||||
lock_rom_area ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fake_bios_data (0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
{
|
|
||||||
file = grub_file_open (argv[1]);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (file->size != 4)
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size");
|
|
||||||
else
|
|
||||||
grub_file_read (file, (void *) 0x40, 4);
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = grub_file_open (argv[0]);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
size = file->size;
|
|
||||||
if ((size < 0x10000) || (size > 0x40000))
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size");
|
|
||||||
else if (enable_rom_area ())
|
|
||||||
{
|
|
||||||
grub_file_read (file, (void *) VBIOS_ADDR, size);
|
|
||||||
fake_bios_data (size <= 0x40000);
|
|
||||||
lock_rom_area ();
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_fakebios, cmd_loadbios;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(loadbios)
|
|
||||||
{
|
|
||||||
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
|
||||||
0, N_("Fake BIOS."));
|
|
||||||
|
|
||||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
|
||||||
"BIOS_DUMP [INT10_DUMP]",
|
|
||||||
N_("Load BIOS dump."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(loadbios)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_fakebios);
|
|
||||||
grub_unregister_command (cmd_loadbios);
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/* extcmd.c - support extended command */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_extcmd_dispatcher (struct grub_command *cmd,
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
int new_argc;
|
|
||||||
char **new_args;
|
|
||||||
struct grub_arg_option *parser;
|
|
||||||
struct grub_arg_list *state;
|
|
||||||
int maxargs = 0;
|
|
||||||
grub_err_t ret;
|
|
||||||
grub_extcmd_t ext;
|
|
||||||
|
|
||||||
ext = cmd->data;
|
|
||||||
parser = (struct grub_arg_option *) ext->options;
|
|
||||||
while (parser && (parser++)->doc)
|
|
||||||
maxargs++;
|
|
||||||
|
|
||||||
/* Set up the option state. */
|
|
||||||
state = grub_zalloc (sizeof (struct grub_arg_list) * maxargs);
|
|
||||||
|
|
||||||
if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc))
|
|
||||||
{
|
|
||||||
ext->state = state;
|
|
||||||
ret = (ext->func) (ext, new_argc, new_args);
|
|
||||||
grub_free (new_args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ret = grub_errno;
|
|
||||||
|
|
||||||
grub_free (state);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_extcmd_t
|
|
||||||
grub_register_extcmd (const char *name, grub_extcmd_func_t func,
|
|
||||||
unsigned flags, const char *summary,
|
|
||||||
const char *description,
|
|
||||||
const struct grub_arg_option *parser)
|
|
||||||
{
|
|
||||||
grub_extcmd_t ext;
|
|
||||||
grub_command_t cmd;
|
|
||||||
|
|
||||||
ext = (grub_extcmd_t) grub_malloc (sizeof (*ext));
|
|
||||||
if (! ext)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
cmd = grub_register_command_prio (name, grub_extcmd_dispatcher,
|
|
||||||
summary, description, 1);
|
|
||||||
if (! cmd)
|
|
||||||
{
|
|
||||||
grub_free (ext);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd->flags = (flags | GRUB_COMMAND_FLAG_EXTCMD);
|
|
||||||
cmd->data = ext;
|
|
||||||
|
|
||||||
ext->cmd = cmd;
|
|
||||||
ext->func = func;
|
|
||||||
ext->options = parser;
|
|
||||||
ext->data = 0;
|
|
||||||
|
|
||||||
return ext;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_unregister_extcmd (grub_extcmd_t ext)
|
|
||||||
{
|
|
||||||
grub_unregister_command (ext->cmd);
|
|
||||||
grub_free (ext);
|
|
||||||
}
|
|
||||||
@@ -1,256 +0,0 @@
|
|||||||
/* gptsync.c - fill the mbr based on gpt entries */
|
|
||||||
/* XXX: I don't know what to do if sector size isn't 512 bytes */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/msdos_partition.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/fs.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
|
||||||
/* Taken from grub1. */
|
|
||||||
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
|
|
||||||
Is it a problem?
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
lba_to_chs (int lba, grub_uint8_t *cl, grub_uint8_t *ch,
|
|
||||||
grub_uint8_t *dh)
|
|
||||||
{
|
|
||||||
int cylinder, head, sector;
|
|
||||||
int sectors = 63, heads = 255, cylinders = 1024;
|
|
||||||
|
|
||||||
sector = lba % sectors + 1;
|
|
||||||
head = (lba / sectors) % heads;
|
|
||||||
cylinder = lba / (sectors * heads);
|
|
||||||
|
|
||||||
if (cylinder >= cylinders)
|
|
||||||
{
|
|
||||||
*cl = *ch = *dh = 0xff;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*cl = sector | ((cylinder & 0x300) >> 2);
|
|
||||||
*ch = cylinder & 0xFF;
|
|
||||||
*dh = head;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
struct grub_msdos_partition_mbr mbr;
|
|
||||||
struct grub_partition *partition;
|
|
||||||
grub_disk_addr_t first_sector;
|
|
||||||
int numactive = 0;
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
|
|
||||||
if (argc > 4)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only 3 partitions can be "
|
|
||||||
"in hybrid MBR");
|
|
||||||
|
|
||||||
if (args[0][0] == '(' && args[0][grub_strlen (args[0]) - 1] == ')')
|
|
||||||
{
|
|
||||||
args[0][grub_strlen (args[0]) - 1] = 0;
|
|
||||||
dev = grub_device_open (args[0] + 1);
|
|
||||||
args[0][grub_strlen (args[0])] = ')';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dev = grub_device_open (args[0]);
|
|
||||||
|
|
||||||
if (! dev)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (! dev->disk)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the protective MBR. */
|
|
||||||
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), &mbr))
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if it is valid. */
|
|
||||||
if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure the MBR is a protective MBR and not a normal MBR. */
|
|
||||||
if (mbr.entries[0].type != GRUB_PC_PARTITION_TYPE_GPT_DISK)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
|
||||||
first_sector = dev->disk->total_sectors;
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
char *separator, csep = 0;
|
|
||||||
grub_uint8_t type;
|
|
||||||
separator = grub_strchr (args[i], '+');
|
|
||||||
if (! separator)
|
|
||||||
separator = grub_strchr (args[i], '-');
|
|
||||||
if (separator)
|
|
||||||
{
|
|
||||||
csep = *separator;
|
|
||||||
*separator = 0;
|
|
||||||
}
|
|
||||||
partition = grub_partition_probe (dev->disk, args[i]);
|
|
||||||
if (separator)
|
|
||||||
*separator = csep;
|
|
||||||
if (! partition)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such partition");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (partition->start + partition->len > 0xffffffff)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
|
||||||
"only partitions resding in the first 2TB "
|
|
||||||
"can be presen in hybrid MBR");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (first_sector > partition->start)
|
|
||||||
first_sector = partition->start;
|
|
||||||
|
|
||||||
if (separator && *(separator + 1))
|
|
||||||
type = grub_strtoul (separator + 1, 0, 0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_fs_t fs = 0;
|
|
||||||
dev->disk->partition = partition;
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
|
|
||||||
/* Unknown filesystem isn't fatal. */
|
|
||||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
|
||||||
{
|
|
||||||
fs = 0;
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fs && grub_strcmp (fs->name, "ntfs") == 0)
|
|
||||||
type = GRUB_PC_PARTITION_TYPE_NTFS;
|
|
||||||
else if (fs && grub_strcmp (fs->name, "fat") == 0)
|
|
||||||
/* FIXME: detect FAT16. */
|
|
||||||
type = GRUB_PC_PARTITION_TYPE_FAT32_LBA;
|
|
||||||
else if (fs && (grub_strcmp (fs->name, "hfsplus") == 0
|
|
||||||
|| grub_strcmp (fs->name, "hfs") == 0))
|
|
||||||
type = GRUB_PC_PARTITION_TYPE_HFS;
|
|
||||||
else
|
|
||||||
/* FIXME: detect more types. */
|
|
||||||
type = GRUB_PC_PARTITION_TYPE_EXT2FS;
|
|
||||||
|
|
||||||
dev->disk->partition = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mbr.entries[i].flag = (csep == '+') ? 0x80 : 0;
|
|
||||||
if (csep == '+')
|
|
||||||
{
|
|
||||||
numactive++;
|
|
||||||
if (numactive == 2)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"only one partition can be active");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mbr.entries[i].type = type;
|
|
||||||
mbr.entries[i].start = grub_cpu_to_le32 (partition->start);
|
|
||||||
lba_to_chs (partition->start,
|
|
||||||
&(mbr.entries[i].start_sector),
|
|
||||||
&(mbr.entries[i].start_cylinder),
|
|
||||||
&(mbr.entries[i].start_head));
|
|
||||||
lba_to_chs (partition->start + partition->len - 1,
|
|
||||||
&(mbr.entries[i].end_sector),
|
|
||||||
&(mbr.entries[i].end_cylinder),
|
|
||||||
&(mbr.entries[i].end_head));
|
|
||||||
mbr.entries[i].length = grub_cpu_to_le32 (partition->len);
|
|
||||||
grub_free (partition);
|
|
||||||
}
|
|
||||||
for (; i < 4; i++)
|
|
||||||
grub_memset (&(mbr.entries[i]), 0, sizeof (mbr.entries[i]));
|
|
||||||
|
|
||||||
/* The protective partition. */
|
|
||||||
if (first_sector > 0xffffffff)
|
|
||||||
first_sector = 0xffffffff;
|
|
||||||
else
|
|
||||||
first_sector--;
|
|
||||||
mbr.entries[0].flag = 0;
|
|
||||||
mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
|
|
||||||
mbr.entries[0].start = grub_cpu_to_le32 (1);
|
|
||||||
lba_to_chs (1,
|
|
||||||
&(mbr.entries[0].start_sector),
|
|
||||||
&(mbr.entries[0].start_cylinder),
|
|
||||||
&(mbr.entries[0].start_head));
|
|
||||||
lba_to_chs (first_sector,
|
|
||||||
&(mbr.entries[0].end_sector),
|
|
||||||
&(mbr.entries[0].end_cylinder),
|
|
||||||
&(mbr.entries[0].end_head));
|
|
||||||
mbr.entries[0].length = grub_cpu_to_le32 (first_sector);
|
|
||||||
|
|
||||||
mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
|
|
||||||
|
|
||||||
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("New MBR is written to '%s'\n", args[0]);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(gptsync)
|
|
||||||
{
|
|
||||||
(void) mod; /* To stop warning. */
|
|
||||||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
|
||||||
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
|
||||||
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
|
||||||
"specified partitions will be a part "
|
|
||||||
"of hybrid mbr. Up to 3 partitions are "
|
|
||||||
"allowed. TYPE is an MBR type. "
|
|
||||||
"+ means that partition is active. "
|
|
||||||
"Only one partition can be active."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(gptsync)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/* halt.c - command to halt the computer. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_halt ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(halt)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("halt", grub_cmd_halt,
|
|
||||||
0, N_("Halts the computer. This command does"
|
|
||||||
" not work on all firmware implementations."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(halt)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
/* handler.c - commands to list or select handlers */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/handler.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
void *curr_item = 0;
|
|
||||||
grub_handler_class_t head;
|
|
||||||
|
|
||||||
auto int list_item (grub_named_list_t item);
|
|
||||||
int list_item (grub_named_list_t item)
|
|
||||||
{
|
|
||||||
if (item == curr_item)
|
|
||||||
grub_putchar ('*');
|
|
||||||
|
|
||||||
grub_printf ("%s\n", item->name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
head = grub_handler_class_list;
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *class_name;
|
|
||||||
grub_handler_class_t class;
|
|
||||||
|
|
||||||
class_name = args[0];
|
|
||||||
argc--;
|
|
||||||
args++;
|
|
||||||
|
|
||||||
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
|
|
||||||
if (! class)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "class not found");
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
curr_item = class->cur_handler;
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (class->handler_list),
|
|
||||||
(grub_list_hook_t) list_item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_handler_t handler;
|
|
||||||
|
|
||||||
handler =
|
|
||||||
grub_named_list_find (GRUB_AS_NAMED_LIST (class->handler_list),
|
|
||||||
args[0]);
|
|
||||||
|
|
||||||
if (! handler)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "handler not found");
|
|
||||||
|
|
||||||
grub_handler_set_current (class, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_handler;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(handler)
|
|
||||||
{
|
|
||||||
cmd_handler =
|
|
||||||
grub_register_command ("handler", grub_cmd_handler,
|
|
||||||
N_("[class [handler]]"),
|
|
||||||
N_("List or select a handler."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(handler)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_handler);
|
|
||||||
}
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/crypto.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
|
||||||
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
|
|
||||||
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
|
|
||||||
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
|
|
||||||
ARG_TYPE_STRING},
|
|
||||||
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct { const char *name; const char *hashname; } aliases[] =
|
|
||||||
{
|
|
||||||
{"sha256sum", "sha256"},
|
|
||||||
{"sha512sum", "sha512"},
|
|
||||||
{"md5sum", "md5"},
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hextoval (char c)
|
|
||||||
{
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
return c - '0';
|
|
||||||
if (c >= 'a' && c <= 'f')
|
|
||||||
return c - 'a' + 10;
|
|
||||||
if (c >= 'A' && c <= 'F')
|
|
||||||
return c - 'A' + 10;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
|
||||||
{
|
|
||||||
grub_uint8_t context[hash->contextsize];
|
|
||||||
grub_uint8_t readbuf[4096];
|
|
||||||
|
|
||||||
grub_memset (context, 0, sizeof (context));
|
|
||||||
hash->init (context);
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
grub_ssize_t r;
|
|
||||||
r = grub_file_read (file, readbuf, sizeof (readbuf));
|
|
||||||
if (r < 0)
|
|
||||||
return grub_errno;
|
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
hash->write (context, readbuf, r);
|
|
||||||
}
|
|
||||||
hash->final (context);
|
|
||||||
grub_memcpy (result, hash->read (context), hash->mdlen);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|
||||||
const char *prefix, int keep)
|
|
||||||
{
|
|
||||||
grub_file_t hashlist, file;
|
|
||||||
char *buf = NULL;
|
|
||||||
grub_uint8_t expected[hash->mdlen];
|
|
||||||
grub_uint8_t actual[hash->mdlen];
|
|
||||||
grub_err_t err;
|
|
||||||
unsigned i;
|
|
||||||
unsigned unread = 0, mismatch = 0;
|
|
||||||
|
|
||||||
hashlist = grub_file_open (hashfilename);
|
|
||||||
if (!hashlist)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
while (grub_free (buf), (buf = grub_file_getline (hashlist)))
|
|
||||||
{
|
|
||||||
const char *p = buf;
|
|
||||||
for (i = 0; i < hash->mdlen; i++)
|
|
||||||
{
|
|
||||||
int high, low;
|
|
||||||
high = hextoval (*p++);
|
|
||||||
low = hextoval (*p++);
|
|
||||||
if (high < 0 || low < 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
|
||||||
expected[i] = (high << 4) | low;
|
|
||||||
}
|
|
||||||
if (*p++ != ' ' || *p++ != ' ')
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
|
||||||
if (prefix)
|
|
||||||
{
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/%s", prefix, p);
|
|
||||||
if (!filename)
|
|
||||||
return grub_errno;
|
|
||||||
file = grub_file_open (filename);
|
|
||||||
grub_free (filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
file = grub_file_open (p);
|
|
||||||
if (!file)
|
|
||||||
{
|
|
||||||
grub_file_close (hashlist);
|
|
||||||
grub_free (buf);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
err = hash_file (file, hash, actual);
|
|
||||||
grub_file_close (file);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_printf ("%s: READ ERROR\n", p);
|
|
||||||
if (!keep)
|
|
||||||
{
|
|
||||||
grub_file_close (hashlist);
|
|
||||||
grub_free (buf);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
grub_print_error ();
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
unread++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
|
|
||||||
{
|
|
||||||
grub_printf ("%s: HASH MISMATCH\n", p);
|
|
||||||
if (!keep)
|
|
||||||
{
|
|
||||||
grub_file_close (hashlist);
|
|
||||||
grub_free (buf);
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE,
|
|
||||||
"hash of '%s' mismatches", p);
|
|
||||||
}
|
|
||||||
mismatch++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
grub_printf ("%s: OK\n", p);
|
|
||||||
}
|
|
||||||
if (mismatch || unread)
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE,
|
|
||||||
"%d files couldn't be read and hash "
|
|
||||||
"of %d files mismatches", unread, mismatch);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_hashsum (struct grub_extcmd *cmd,
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
const char *hashname = NULL;
|
|
||||||
const char *prefix = NULL;
|
|
||||||
const gcry_md_spec_t *hash;
|
|
||||||
unsigned i;
|
|
||||||
int keep = state[3].set;
|
|
||||||
unsigned unread = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (aliases); i++)
|
|
||||||
if (grub_strcmp (cmd->cmd->name, aliases[i].name) == 0)
|
|
||||||
hashname = aliases[i].hashname;
|
|
||||||
if (state[0].set)
|
|
||||||
hashname = state[0].arg;
|
|
||||||
|
|
||||||
if (!hashname)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no hash specified");
|
|
||||||
|
|
||||||
hash = grub_crypto_lookup_md_by_name (hashname);
|
|
||||||
if (!hash)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash");
|
|
||||||
|
|
||||||
if (state[2].set)
|
|
||||||
prefix = state[2].arg;
|
|
||||||
|
|
||||||
if (state[1].set)
|
|
||||||
{
|
|
||||||
if (argc != 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"--check is incompatible with file list");
|
|
||||||
return check_list (hash, state[1].arg, prefix, keep);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < (unsigned) argc; i++)
|
|
||||||
{
|
|
||||||
grub_uint8_t result[hash->mdlen];
|
|
||||||
grub_file_t file;
|
|
||||||
grub_err_t err;
|
|
||||||
unsigned j;
|
|
||||||
file = grub_file_open (args[i]);
|
|
||||||
if (!file)
|
|
||||||
{
|
|
||||||
if (!keep)
|
|
||||||
return grub_errno;
|
|
||||||
grub_print_error ();
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
unread++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
err = hash_file (file, hash, result);
|
|
||||||
grub_file_close (file);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
if (!keep)
|
|
||||||
return err;
|
|
||||||
grub_print_error ();
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
unread++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (j = 0; j < hash->mdlen; j++)
|
|
||||||
grub_printf ("%02x", result[j]);
|
|
||||||
grub_printf (" %s\n", args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unread)
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "%d files couldn't be read.",
|
|
||||||
unread);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd, cmd_md5, cmd_sha256, cmd_sha512;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(hashsum)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"hashsum -h HASH [-c FILE [-p PREFIX]] "
|
|
||||||
"[FILE1 [FILE2 ...]]",
|
|
||||||
"Compute or check hash checksum.",
|
|
||||||
options);
|
|
||||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"md5sum [-c FILE [-p PREFIX]] "
|
|
||||||
"[FILE1 [FILE2 ...]]",
|
|
||||||
"Compute or check hash checksum.",
|
|
||||||
options);
|
|
||||||
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"sha256sum [-c FILE [-p PREFIX]] "
|
|
||||||
"[FILE1 [FILE2 ...]]",
|
|
||||||
"Compute or check hash checksum.",
|
|
||||||
options);
|
|
||||||
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"sha512sum [-c FILE [-p PREFIX]] "
|
|
||||||
"[FILE1 [FILE2 ...]]",
|
|
||||||
"Compute or check hash checksum.",
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(hashsum)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
grub_unregister_extcmd (cmd_md5);
|
|
||||||
grub_unregister_extcmd (cmd_sha256);
|
|
||||||
grub_unregister_extcmd (cmd_sha512);
|
|
||||||
}
|
|
||||||
@@ -1,421 +0,0 @@
|
|||||||
/* hdparm.c - command to get/set ATA disk parameters. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/ata.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/lib/hexdump.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
|
||||||
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
|
|
||||||
"(1=low, ..., 254=high, 255=off)."),
|
|
||||||
0, ARG_TYPE_INT},
|
|
||||||
{"power", 'C', 0, N_("Check power mode."), 0, ARG_TYPE_NONE},
|
|
||||||
{"security-freeze", 'F', 0, N_("Freeze ATA security settings until reset."),
|
|
||||||
0, ARG_TYPE_NONE},
|
|
||||||
{"health", 'H', 0, N_("Check SMART health status."), 0, ARG_TYPE_NONE},
|
|
||||||
{"aam", 'M', 0, N_("Set Automatic Acoustic Management\n"
|
|
||||||
"(0=off, 128=quiet, ..., 254=fast)."),
|
|
||||||
0, ARG_TYPE_INT},
|
|
||||||
{"standby-timeout", 'S', 0, N_("Set standby timeout\n"
|
|
||||||
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)."),
|
|
||||||
0, ARG_TYPE_INT},
|
|
||||||
{"standby", 'y', 0, N_("Set drive to standby mode."), 0, ARG_TYPE_NONE},
|
|
||||||
{"sleep", 'Y', 0, N_("Set drive to sleep mode."), 0, ARG_TYPE_NONE},
|
|
||||||
{"identify", 'i', 0, N_("Print drive identity and settings."),
|
|
||||||
0, ARG_TYPE_NONE},
|
|
||||||
{"dumpid", 'I', 0, N_("Dump contents of ATA IDENTIFY sector."),
|
|
||||||
0, ARG_TYPE_NONE},
|
|
||||||
{"smart", -1, 0, N_("Disable/enable SMART (0/1)."), 0, ARG_TYPE_INT},
|
|
||||||
{"quiet", 'q', 0, N_("Do not print messages."), 0, ARG_TYPE_NONE},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum grub_ata_smart_commands
|
|
||||||
{
|
|
||||||
GRUB_ATA_FEAT_SMART_ENABLE = 0xd8,
|
|
||||||
GRUB_ATA_FEAT_SMART_DISABLE = 0xd9,
|
|
||||||
GRUB_ATA_FEAT_SMART_STATUS = 0xda,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int quiet = 0;
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_hdparm_do_ata_cmd (grub_disk_t disk, grub_uint8_t cmd,
|
|
||||||
grub_uint8_t features, grub_uint8_t sectors,
|
|
||||||
void * buffer, int size)
|
|
||||||
{
|
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = cmd;
|
|
||||||
apt.taskfile[GRUB_ATA_REG_FEATURES] = features;
|
|
||||||
apt.taskfile[GRUB_ATA_REG_SECTORS] = sectors;
|
|
||||||
apt.buffer = buffer;
|
|
||||||
apt.size = size;
|
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_hdparm_do_check_powermode_cmd (grub_disk_t disk)
|
|
||||||
{
|
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = GRUB_ATA_CMD_CHECK_POWER_MODE;
|
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return apt.taskfile[GRUB_ATA_REG_SECTORS];
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_hdparm_do_smart_cmd (grub_disk_t disk, grub_uint8_t features)
|
|
||||||
{
|
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = GRUB_ATA_CMD_SMART;
|
|
||||||
apt.taskfile[GRUB_ATA_REG_FEATURES] = features;
|
|
||||||
apt.taskfile[GRUB_ATA_REG_LBAMID] = 0x4f;
|
|
||||||
apt.taskfile[GRUB_ATA_REG_LBAHIGH] = 0xc2;
|
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (features == GRUB_ATA_FEAT_SMART_STATUS)
|
|
||||||
{
|
|
||||||
if ( apt.taskfile[GRUB_ATA_REG_LBAMID] == 0x4f
|
|
||||||
&& apt.taskfile[GRUB_ATA_REG_LBAHIGH] == 0xc2)
|
|
||||||
return 0; /* Good SMART status. */
|
|
||||||
else if ( apt.taskfile[GRUB_ATA_REG_LBAMID] == 0xf4
|
|
||||||
&& apt.taskfile[GRUB_ATA_REG_LBAHIGH] == 0x2c)
|
|
||||||
return 1; /* Bad SMART status. */
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_hdparm_simple_cmd (const char * msg,
|
|
||||||
grub_disk_t disk, grub_uint8_t cmd)
|
|
||||||
{
|
|
||||||
if (! quiet && msg)
|
|
||||||
grub_printf ("%s", msg);
|
|
||||||
|
|
||||||
grub_err_t err = grub_hdparm_do_ata_cmd (disk, cmd, 0, 0, NULL, 0);
|
|
||||||
|
|
||||||
if (! quiet && msg)
|
|
||||||
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_hdparm_set_val_cmd (const char * msg, int val,
|
|
||||||
grub_disk_t disk, grub_uint8_t cmd,
|
|
||||||
grub_uint8_t features, grub_uint8_t sectors)
|
|
||||||
{
|
|
||||||
if (! quiet && msg && *msg)
|
|
||||||
{
|
|
||||||
if (val >= 0)
|
|
||||||
grub_printf ("Set %s to %d", msg, val);
|
|
||||||
else
|
|
||||||
grub_printf ("Disable %s", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_err_t err = grub_hdparm_do_ata_cmd (disk, cmd, features, sectors,
|
|
||||||
NULL, 0);
|
|
||||||
|
|
||||||
if (! quiet && msg)
|
|
||||||
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
le16_to_char (char *dest, const grub_uint16_t * src16, unsigned bytes)
|
|
||||||
{
|
|
||||||
grub_uint16_t * dest16 = (grub_uint16_t *) dest;
|
|
||||||
unsigned i;
|
|
||||||
for (i = 0; i < bytes / 2; i++)
|
|
||||||
dest16[i] = grub_be_to_cpu16 (src16[i]);
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_hdparm_print_identify (const char * idbuf)
|
|
||||||
{
|
|
||||||
const grub_uint16_t * idw = (const grub_uint16_t *) idbuf;
|
|
||||||
|
|
||||||
/* Print identity strings. */
|
|
||||||
char tmp[40];
|
|
||||||
grub_printf ("Model: \"%.40s\"\n", le16_to_char (tmp, &idw[27], 40));
|
|
||||||
grub_printf ("Firmware: \"%.8s\"\n", le16_to_char (tmp, &idw[23], 8));
|
|
||||||
grub_printf ("Serial: \"%.20s\"\n", le16_to_char (tmp, &idw[10], 20));
|
|
||||||
|
|
||||||
/* Print AAM, APM and SMART settings. */
|
|
||||||
grub_uint16_t features1 = grub_le_to_cpu16 (idw[82]);
|
|
||||||
grub_uint16_t features2 = grub_le_to_cpu16 (idw[83]);
|
|
||||||
grub_uint16_t enabled1 = grub_le_to_cpu16 (idw[85]);
|
|
||||||
grub_uint16_t enabled2 = grub_le_to_cpu16 (idw[86]);
|
|
||||||
|
|
||||||
grub_printf ("Automatic Acoustic Management: ");
|
|
||||||
if (features2 & 0x0200)
|
|
||||||
{
|
|
||||||
if (enabled2 & 0x0200)
|
|
||||||
{
|
|
||||||
grub_uint16_t aam = grub_le_to_cpu16 (idw[94]);
|
|
||||||
grub_printf ("%u (128=quiet, ..., 254=fast, recommended=%u)\n",
|
|
||||||
aam & 0xff, (aam >> 8) & 0xff);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("disabled\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("not supported\n");
|
|
||||||
|
|
||||||
grub_printf ("Advanced Power Management: ");
|
|
||||||
if (features2 & 0x0008)
|
|
||||||
{
|
|
||||||
if (enabled2 & 0x0008)
|
|
||||||
grub_printf ("%u (1=low, ..., 254=high)\n",
|
|
||||||
grub_le_to_cpu16 (idw[91]) & 0xff);
|
|
||||||
else
|
|
||||||
grub_printf ("disabled\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("not supported\n");
|
|
||||||
|
|
||||||
grub_printf ("SMART Feature Set: ");
|
|
||||||
if (features1 & 0x0001)
|
|
||||||
grub_printf ("%sabled\n", (enabled1 & 0x0001 ? "en" : "dis"));
|
|
||||||
else
|
|
||||||
grub_printf ("not supported\n");
|
|
||||||
|
|
||||||
/* Print security settings. */
|
|
||||||
grub_uint16_t security = grub_le_to_cpu16 (idw[128]);
|
|
||||||
|
|
||||||
grub_printf ("ATA Security: ");
|
|
||||||
if (security & 0x0001)
|
|
||||||
grub_printf ("%s, %s, %s, %s\n",
|
|
||||||
(security & 0x0002 ? "ENABLED" : "disabled"),
|
|
||||||
(security & 0x0004 ? "**LOCKED**" : "not locked"),
|
|
||||||
(security & 0x0008 ? "frozen" : "NOT FROZEN"),
|
|
||||||
(security & 0x0010 ? "COUNT EXPIRED" : "count not expired"));
|
|
||||||
else
|
|
||||||
grub_printf ("not supported\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_hdparm_print_standby_tout (int timeout)
|
|
||||||
{
|
|
||||||
if (timeout == 0)
|
|
||||||
grub_printf ("off");
|
|
||||||
else if (timeout <= 252 || timeout == 255)
|
|
||||||
{
|
|
||||||
int h = 0, m = 0 , s = 0;
|
|
||||||
if (timeout == 255)
|
|
||||||
{
|
|
||||||
m = 21;
|
|
||||||
s = 15;
|
|
||||||
}
|
|
||||||
else if (timeout == 252)
|
|
||||||
m = 21;
|
|
||||||
else if (timeout <= 240)
|
|
||||||
{
|
|
||||||
s = timeout * 5;
|
|
||||||
m = s / 60;
|
|
||||||
s %= 60;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m = (timeout - 240) * 30;
|
|
||||||
h = m / 60;
|
|
||||||
m %= 60;
|
|
||||||
}
|
|
||||||
grub_printf ("%02d:%02d:%02d", h, m, s);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("invalid or vendor-specific");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int get_int_arg (const struct grub_arg_list *state)
|
|
||||||
{
|
|
||||||
return (state->set ? (int)grub_strtoul (state->arg, 0, 0) : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_hdparm (grub_extcmd_t cmd, int argc, char **args) // state????
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
|
|
||||||
/* Check command line. */
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing device name argument");
|
|
||||||
|
|
||||||
grub_size_t len = grub_strlen (args[0]);
|
|
||||||
if (! (args[0][0] == '(' && args[0][len - 1] == ')'))
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "argument is not a device name");
|
|
||||||
args[0][len - 1] = 0;
|
|
||||||
|
|
||||||
if (! grub_disk_ata_pass_through)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "ATA pass through not available");
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int apm = get_int_arg (&state[i++]);
|
|
||||||
int power = state[i++].set;
|
|
||||||
int sec_freeze = state[i++].set;
|
|
||||||
int health = state[i++].set;
|
|
||||||
int aam = get_int_arg (&state[i++]);
|
|
||||||
int standby_tout = get_int_arg (&state[i++]);
|
|
||||||
int standby_now = state[i++].set;
|
|
||||||
int sleep_now = state[i++].set;
|
|
||||||
int ident = state[i++].set;
|
|
||||||
int dumpid = state[i++].set;
|
|
||||||
int enable_smart = get_int_arg (&state[i++]);
|
|
||||||
quiet = state[i++].set;
|
|
||||||
|
|
||||||
/* Open disk. */
|
|
||||||
grub_disk_t disk = grub_disk_open (&args[0][1]);
|
|
||||||
if (! disk)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (disk->partition)
|
|
||||||
{
|
|
||||||
grub_disk_close (disk);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "partition not allowed");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change settings. */
|
|
||||||
if (aam >= 0)
|
|
||||||
grub_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
|
|
||||||
disk, GRUB_ATA_CMD_SET_FEATURES, (aam ? 0x42 : 0xc2), aam);
|
|
||||||
|
|
||||||
if (apm >= 0)
|
|
||||||
grub_hdparm_set_val_cmd ("Advanced Power Management",
|
|
||||||
(apm != 255 ? apm : -1), disk, GRUB_ATA_CMD_SET_FEATURES,
|
|
||||||
(apm != 255 ? 0x05 : 0x85), (apm != 255 ? apm : 0));
|
|
||||||
|
|
||||||
if (standby_tout >= 0)
|
|
||||||
{
|
|
||||||
if (! quiet)
|
|
||||||
{
|
|
||||||
grub_printf ("Set standby timeout to %d (", standby_tout);
|
|
||||||
grub_hdparm_print_standby_tout (standby_tout);
|
|
||||||
grub_printf (")");
|
|
||||||
}
|
|
||||||
/* The IDLE cmd sets disk to idle mode and configures standby timer. */
|
|
||||||
grub_hdparm_set_val_cmd ("", -1, disk, GRUB_ATA_CMD_IDLE, 0, standby_tout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enable_smart >= 0)
|
|
||||||
{
|
|
||||||
if (! quiet)
|
|
||||||
grub_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
|
|
||||||
int err = grub_hdparm_do_smart_cmd (disk, (enable_smart ?
|
|
||||||
GRUB_ATA_FEAT_SMART_ENABLE : GRUB_ATA_FEAT_SMART_DISABLE));
|
|
||||||
if (! quiet)
|
|
||||||
grub_printf ("%s\n", err ? ": not supported" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sec_freeze)
|
|
||||||
grub_hdparm_simple_cmd ("Freeze security settings", disk,
|
|
||||||
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK);
|
|
||||||
|
|
||||||
/* Print/dump IDENTIFY. */
|
|
||||||
if (ident || dumpid)
|
|
||||||
{
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
if (grub_hdparm_do_ata_cmd (disk, GRUB_ATA_CMD_IDENTIFY_DEVICE,
|
|
||||||
0, 0, buf, sizeof (buf)))
|
|
||||||
grub_printf ("Cannot read ATA IDENTIFY data\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ident)
|
|
||||||
grub_hdparm_print_identify (buf);
|
|
||||||
if (dumpid)
|
|
||||||
hexdump (0, buf, sizeof (buf));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check power mode. */
|
|
||||||
if (power)
|
|
||||||
{
|
|
||||||
grub_printf ("Disk power mode is: ");
|
|
||||||
int mode = grub_hdparm_do_check_powermode_cmd (disk);
|
|
||||||
if (mode < 0)
|
|
||||||
grub_printf ("unknown\n");
|
|
||||||
else
|
|
||||||
grub_printf ("%s (0x%02x)\n",
|
|
||||||
(mode == 0xff ? "active/idle" :
|
|
||||||
mode == 0x80 ? "idle" :
|
|
||||||
mode == 0x00 ? "standby" : "unknown"), mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check health. */
|
|
||||||
int status = 0;
|
|
||||||
if (health)
|
|
||||||
{
|
|
||||||
if (! quiet)
|
|
||||||
grub_printf ("SMART status is: ");
|
|
||||||
int err = grub_hdparm_do_smart_cmd (disk, GRUB_ATA_FEAT_SMART_STATUS);
|
|
||||||
if (! quiet)
|
|
||||||
grub_printf ("%s\n", (err < 0 ? "unknown" :
|
|
||||||
err == 0 ? "OK" : "*BAD*"));
|
|
||||||
status = (err > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change power mode. */
|
|
||||||
if (standby_now)
|
|
||||||
grub_hdparm_simple_cmd ("Set disk to standby mode", disk,
|
|
||||||
GRUB_ATA_CMD_STANDBY_IMMEDIATE);
|
|
||||||
|
|
||||||
if (sleep_now)
|
|
||||||
grub_hdparm_simple_cmd ("Set disk to sleep mode", disk,
|
|
||||||
GRUB_ATA_CMD_SLEEP);
|
|
||||||
|
|
||||||
grub_disk_close (disk);
|
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(hdparm)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[OPTIONS] DISK"),
|
|
||||||
N_("Get/set ATA disk parameters."), options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(hdparm)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
-143
@@ -1,143 +0,0 @@
|
|||||||
/* help.c - command to show a help text. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/charset.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|
||||||
char **args)
|
|
||||||
{
|
|
||||||
int cnt = 0;
|
|
||||||
char *currarg;
|
|
||||||
|
|
||||||
auto int print_command_info (grub_command_t cmd);
|
|
||||||
auto int print_command_help (grub_command_t cmd);
|
|
||||||
|
|
||||||
int print_command_info (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
|
||||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
|
||||||
{
|
|
||||||
struct grub_term_output *term;
|
|
||||||
const char *summary_translated = _(cmd->summary);
|
|
||||||
char *command_help;
|
|
||||||
grub_uint32_t *unicode_command_help;
|
|
||||||
grub_uint32_t *unicode_last_position;
|
|
||||||
|
|
||||||
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
|
||||||
if (!command_help)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
|
||||||
&unicode_last_position);
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
unsigned stringwidth;
|
|
||||||
grub_uint32_t *unicode_last_screen_position;
|
|
||||||
|
|
||||||
unicode_last_screen_position = unicode_command_help;
|
|
||||||
|
|
||||||
stringwidth = 0;
|
|
||||||
|
|
||||||
while (unicode_last_screen_position < unicode_last_position &&
|
|
||||||
stringwidth < ((grub_term_width (term) / 2) - 2))
|
|
||||||
{
|
|
||||||
stringwidth
|
|
||||||
+= grub_term_getcharwidth (term,
|
|
||||||
*unicode_last_screen_position);
|
|
||||||
unicode_last_screen_position++;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_print_ucs4 (unicode_command_help,
|
|
||||||
unicode_last_screen_position, term);
|
|
||||||
if (!(cnt % 2))
|
|
||||||
grub_print_spaces (term, grub_term_width (term) / 2
|
|
||||||
- stringwidth);
|
|
||||||
}
|
|
||||||
if (cnt % 2)
|
|
||||||
grub_printf ("\n");
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
grub_free (command_help);
|
|
||||||
grub_free (unicode_command_help);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int print_command_help (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
|
||||||
{
|
|
||||||
if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
|
|
||||||
{
|
|
||||||
if (cnt++ > 0)
|
|
||||||
grub_printf ("\n\n");
|
|
||||||
|
|
||||||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
|
||||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
|
||||||
else
|
|
||||||
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
|
||||||
_(cmd->description));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_command_iterate (print_command_info);
|
|
||||||
if (!(cnt % 2))
|
|
||||||
grub_printf ("\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
currarg = args[i];
|
|
||||||
grub_command_iterate (print_command_help);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(help)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("help", grub_cmd_help,
|
|
||||||
GRUB_COMMAND_FLAG_CMDLINE,
|
|
||||||
N_("[PATTERN ...]"),
|
|
||||||
N_("Show a help message."), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(help)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
/* hexdump.c - command to dump the contents of a file or memory */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/gzio.h>
|
|
||||||
#include <grub/lib/hexdump.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
|
||||||
{"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0,
|
|
||||||
ARG_TYPE_INT},
|
|
||||||
{"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
|
||||||
grub_ssize_t size, length;
|
|
||||||
grub_disk_addr_t skip;
|
|
||||||
int namelen;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
|
||||||
|
|
||||||
namelen = grub_strlen (args[0]);
|
|
||||||
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
|
|
||||||
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
|
||||||
|
|
||||||
if (!grub_strcmp (args[0], "(mem)"))
|
|
||||||
hexdump (skip, (char *) (grub_addr_t) skip, length);
|
|
||||||
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
|
||||||
{
|
|
||||||
grub_disk_t disk;
|
|
||||||
grub_disk_addr_t sector;
|
|
||||||
grub_size_t ofs;
|
|
||||||
|
|
||||||
args[0][namelen - 1] = 0;
|
|
||||||
disk = grub_disk_open (&args[0][1]);
|
|
||||||
if (! disk)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4;
|
|
||||||
ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1);
|
|
||||||
while (length)
|
|
||||||
{
|
|
||||||
grub_size_t len;
|
|
||||||
|
|
||||||
len = length;
|
|
||||||
if (len > sizeof (buf))
|
|
||||||
len = sizeof (buf);
|
|
||||||
|
|
||||||
if (grub_disk_read (disk, sector, ofs, len, buf))
|
|
||||||
break;
|
|
||||||
|
|
||||||
hexdump (skip, buf, len);
|
|
||||||
|
|
||||||
ofs = 0;
|
|
||||||
skip += len;
|
|
||||||
length -= len;
|
|
||||||
sector += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_disk_close (disk);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
file = grub_gzfile_open (args[0], 1);
|
|
||||||
if (! file)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
file->offset = skip;
|
|
||||||
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
|
||||||
{
|
|
||||||
unsigned long len;
|
|
||||||
|
|
||||||
len = ((length) && (size > length)) ? length : size;
|
|
||||||
hexdump (skip, buf, len);
|
|
||||||
skip += len;
|
|
||||||
if (length)
|
|
||||||
{
|
|
||||||
length -= len;
|
|
||||||
if (!length)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (hexdump)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[OPTIONS] FILE_OR_DEVICE"),
|
|
||||||
N_("Dump the contents of a file or memory."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (hexdump)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/* cpuid.c - test for CPU features */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
|
||||||
* Based on gcc/gcc/config/i386/driver-i386.c
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i386/cpuid.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#define cpuid(num,a,b,c,d) \
|
|
||||||
asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
|
|
||||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
|
||||||
: "0" (num))
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"long-mode", 'l', 0, N_("Check for long mode flag (default)."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
#define bit_LM (1 << 29)
|
|
||||||
|
|
||||||
unsigned char grub_cpuid_has_longmode = 0;
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_cpuid (grub_extcmd_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return grub_cpuid_has_longmode ? GRUB_ERR_NONE
|
|
||||||
: grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(cpuid)
|
|
||||||
{
|
|
||||||
#ifdef __x86_64__
|
|
||||||
/* grub-emu */
|
|
||||||
grub_cpuid_has_longmode = 1;
|
|
||||||
#else
|
|
||||||
unsigned int eax, ebx, ecx, edx;
|
|
||||||
unsigned int max_level;
|
|
||||||
unsigned int ext_level;
|
|
||||||
|
|
||||||
/* See if we can use cpuid. */
|
|
||||||
asm volatile ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
|
|
||||||
"pushl %0; popfl; pushfl; popl %0; popfl"
|
|
||||||
: "=&r" (eax), "=&r" (ebx)
|
|
||||||
: "i" (0x00200000));
|
|
||||||
if (((eax ^ ebx) & 0x00200000) == 0)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* Check the highest input value for eax. */
|
|
||||||
cpuid (0, eax, ebx, ecx, edx);
|
|
||||||
/* We only look at the first four characters. */
|
|
||||||
max_level = eax;
|
|
||||||
if (max_level == 0)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
cpuid (0x80000000, eax, ebx, ecx, edx);
|
|
||||||
ext_level = eax;
|
|
||||||
if (ext_level < 0x80000000)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
cpuid (0x80000001, eax, ebx, ecx, edx);
|
|
||||||
grub_cpuid_has_longmode = !!(edx & bit_LM);
|
|
||||||
done:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"[-l]", N_("Check for CPU features."), options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(cpuid)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* acpi.c - get acpi tables. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v10 *
|
|
||||||
grub_machine_acpi_get_rsdpv1 (void)
|
|
||||||
{
|
|
||||||
int ebda_len;
|
|
||||||
grub_uint8_t *ebda, *ptr;
|
|
||||||
|
|
||||||
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
|
|
||||||
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
|
|
||||||
ebda_len = * (grub_uint16_t *) ebda;
|
|
||||||
if (! ebda_len)
|
|
||||||
return 0;
|
|
||||||
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
|
|
||||||
if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
|
|
||||||
return (struct grub_acpi_rsdp_v10 *) ptr;
|
|
||||||
|
|
||||||
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
|
|
||||||
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
|
|
||||||
ptr += 16)
|
|
||||||
if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
|
|
||||||
return (struct grub_acpi_rsdp_v10 *) ptr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_acpi_rsdp_v20 *
|
|
||||||
grub_machine_acpi_get_rsdpv2 (void)
|
|
||||||
{
|
|
||||||
int ebda_len;
|
|
||||||
grub_uint8_t *ebda, *ptr;
|
|
||||||
|
|
||||||
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
|
|
||||||
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
|
|
||||||
ebda_len = * (grub_uint16_t *) ebda;
|
|
||||||
if (! ebda_len)
|
|
||||||
return 0;
|
|
||||||
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
|
|
||||||
if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
|
|
||||||
&& grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length)
|
|
||||||
== 0)
|
|
||||||
return (struct grub_acpi_rsdp_v20 *) ptr;
|
|
||||||
|
|
||||||
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
|
|
||||||
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
|
|
||||||
ptr += 16)
|
|
||||||
if (grub_memcmp (ptr, "RSD PTR ", 8) == 0
|
|
||||||
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
|
|
||||||
&& ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
|
|
||||||
&& grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length)
|
|
||||||
== 0)
|
|
||||||
return (struct grub_acpi_rsdp_v20 *) ptr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,422 +0,0 @@
|
|||||||
/* drivemap.c - command to manage the BIOS drive mappings. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/loader.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#include <grub/machine/biosnum.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
|
|
||||||
static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
|
|
||||||
|
|
||||||
/* Remember to update enum opt_idxs accordingly. */
|
|
||||||
static const struct grub_arg_option options[] = {
|
|
||||||
{"list", 'l', 0, N_("Show the current mappings."), 0, 0},
|
|
||||||
{"reset", 'r', 0, N_("Reset all mappings to the default values."), 0, 0},
|
|
||||||
{"swap", 's', 0, N_("Perform both direct and reverse mappings."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Remember to update options[] accordingly. */
|
|
||||||
enum opt_idxs
|
|
||||||
{
|
|
||||||
OPTIDX_LIST = 0,
|
|
||||||
OPTIDX_RESET,
|
|
||||||
OPTIDX_SWAP,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Realmode far ptr (2 * 16b) to the previous INT13h handler. */
|
|
||||||
extern grub_uint32_t grub_drivemap_oldhandler;
|
|
||||||
|
|
||||||
/* The type "void" is used for imported assembly labels, takes no storage and
|
|
||||||
serves just to take the address with &label. */
|
|
||||||
|
|
||||||
/* The assembly function to replace the old INT13h handler. It does not follow
|
|
||||||
any C callspecs and returns with IRET. */
|
|
||||||
extern const void grub_drivemap_handler;
|
|
||||||
|
|
||||||
/* Start of the drive mappings area (space reserved at runtime). */
|
|
||||||
extern const void grub_drivemap_mapstart;
|
|
||||||
|
|
||||||
typedef struct drivemap_node
|
|
||||||
{
|
|
||||||
struct drivemap_node *next;
|
|
||||||
grub_uint8_t newdrive;
|
|
||||||
grub_uint8_t redirto;
|
|
||||||
} drivemap_node_t;
|
|
||||||
|
|
||||||
typedef struct __attribute__ ((packed)) int13map_node
|
|
||||||
{
|
|
||||||
grub_uint8_t disknum;
|
|
||||||
grub_uint8_t mapto;
|
|
||||||
} int13map_node_t;
|
|
||||||
|
|
||||||
#define INT13H_OFFSET(x) \
|
|
||||||
(((grub_uint8_t *)(x)) - ((grub_uint8_t *)&grub_drivemap_handler))
|
|
||||||
|
|
||||||
static drivemap_node_t *map_head;
|
|
||||||
static void *drivemap_hook;
|
|
||||||
static int drivemap_mmap;
|
|
||||||
|
|
||||||
/* Puts the specified mapping into the table, replacing an existing mapping
|
|
||||||
for newdrive or adding a new one if required. */
|
|
||||||
static grub_err_t
|
|
||||||
drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
|
|
||||||
{
|
|
||||||
drivemap_node_t *mapping = 0;
|
|
||||||
drivemap_node_t *search = map_head;
|
|
||||||
while (search)
|
|
||||||
{
|
|
||||||
if (search->newdrive == newdrive)
|
|
||||||
{
|
|
||||||
mapping = search;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
search = search->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for pre-existing mappings to modify before creating a new one. */
|
|
||||||
if (mapping)
|
|
||||||
mapping->redirto = redirto;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapping = grub_malloc (sizeof (drivemap_node_t));
|
|
||||||
if (! mapping)
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
||||||
"cannot allocate map entry, not enough memory");
|
|
||||||
mapping->newdrive = newdrive;
|
|
||||||
mapping->redirto = redirto;
|
|
||||||
mapping->next = map_head;
|
|
||||||
map_head = mapping;
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Removes the mapping for newdrive from the table. If there is no mapping,
|
|
||||||
then this function behaves like a no-op on the map. */
|
|
||||||
static void
|
|
||||||
drivemap_remove (grub_uint8_t newdrive)
|
|
||||||
{
|
|
||||||
drivemap_node_t *mapping = 0;
|
|
||||||
drivemap_node_t *search = map_head;
|
|
||||||
drivemap_node_t *previous = 0;
|
|
||||||
|
|
||||||
while (search)
|
|
||||||
{
|
|
||||||
if (search->newdrive == newdrive)
|
|
||||||
{
|
|
||||||
mapping = search;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
previous = search;
|
|
||||||
search = search->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mapping)
|
|
||||||
{
|
|
||||||
if (previous)
|
|
||||||
previous->next = mapping->next;
|
|
||||||
else
|
|
||||||
map_head = mapping->next;
|
|
||||||
grub_free (mapping);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Given a GRUB-like device name and a convenient location, stores the
|
|
||||||
related BIOS disk number. Accepts devices like \((f|h)dN\), with
|
|
||||||
0 <= N < 128. */
|
|
||||||
static grub_err_t
|
|
||||||
tryparse_diskstring (const char *str, grub_uint8_t *output)
|
|
||||||
{
|
|
||||||
/* Skip opening paren in order to allow both (hd0) and hd0. */
|
|
||||||
if (*str == '(')
|
|
||||||
str++;
|
|
||||||
if ((str[0] == 'f' || str[0] == 'h') && str[1] == 'd')
|
|
||||||
{
|
|
||||||
grub_uint8_t bios_num = (str[0] == 'h') ? 0x80 : 0x00;
|
|
||||||
unsigned long drivenum = grub_strtoul (str + 2, 0, 0);
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && drivenum < 128)
|
|
||||||
{
|
|
||||||
bios_num |= drivenum;
|
|
||||||
if (output)
|
|
||||||
*output = bios_num;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device format \"%s\" "
|
|
||||||
"invalid: must be (f|h)dN, with 0 <= N < 128", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
list_mappings (void)
|
|
||||||
{
|
|
||||||
/* Show: list mappings. */
|
|
||||||
if (! map_head)
|
|
||||||
{
|
|
||||||
grub_printf ("No drives have been remapped\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("OS disk #num ------> GRUB/BIOS device\n");
|
|
||||||
drivemap_node_t *curnode = map_head;
|
|
||||||
while (curnode)
|
|
||||||
{
|
|
||||||
grub_printf ("%cD #%-3u (0x%02x) %cd%d\n",
|
|
||||||
(curnode->newdrive & 0x80) ? 'H' : 'F',
|
|
||||||
curnode->newdrive & 0x7F, curnode->newdrive,
|
|
||||||
(curnode->redirto & 0x80) ? 'h' : 'f',
|
|
||||||
curnode->redirto & 0x7F
|
|
||||||
);
|
|
||||||
curnode = curnode->next;
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_drivemap (struct grub_extcmd *cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
if (cmd->state[OPTIDX_LIST].set)
|
|
||||||
{
|
|
||||||
return list_mappings ();
|
|
||||||
}
|
|
||||||
else if (cmd->state[OPTIDX_RESET].set)
|
|
||||||
{
|
|
||||||
/* Reset: just delete all mappings, freeing their memory. */
|
|
||||||
drivemap_node_t *curnode = map_head;
|
|
||||||
drivemap_node_t *prevnode = 0;
|
|
||||||
while (curnode)
|
|
||||||
{
|
|
||||||
prevnode = curnode;
|
|
||||||
curnode = curnode->next;
|
|
||||||
grub_free (prevnode);
|
|
||||||
}
|
|
||||||
map_head = 0;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
else if (!cmd->state[OPTIDX_SWAP].set && argc == 0)
|
|
||||||
{
|
|
||||||
/* No arguments */
|
|
||||||
return list_mappings ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Neither flag: put mapping. */
|
|
||||||
grub_uint8_t mapfrom = 0;
|
|
||||||
grub_uint8_t mapto = 0xFF;
|
|
||||||
grub_err_t err;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
|
||||||
|
|
||||||
err = tryparse_diskstring (args[0], &mapfrom);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
err = tryparse_diskstring (args[1], &mapto);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (mapto == mapfrom)
|
|
||||||
{
|
|
||||||
/* Reset to default. */
|
|
||||||
grub_dprintf ("drivemap", "Removing mapping for %s (%02x)\n",
|
|
||||||
args[0], mapfrom);
|
|
||||||
drivemap_remove (mapfrom);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
/* Set the mapping for the disk (overwrites any existing mapping). */
|
|
||||||
grub_dprintf ("drivemap", "%s %s (%02x) = %s (%02x)\n",
|
|
||||||
cmd->state[OPTIDX_SWAP].set ? "Swapping" : "Mapping",
|
|
||||||
args[1], mapto, args[0], mapfrom);
|
|
||||||
err = drivemap_set (mapto, mapfrom);
|
|
||||||
/* If -s, perform the reverse mapping too (only if the first was OK). */
|
|
||||||
if (cmd->state[OPTIDX_SWAP].set && err == GRUB_ERR_NONE)
|
|
||||||
err = drivemap_set (mapfrom, mapto);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Int13h handler installer - reserves conventional memory for the handler,
|
|
||||||
copies it over and sets the IVT entry for int13h.
|
|
||||||
This code rests on the assumption that GRUB does not activate any kind
|
|
||||||
of memory mapping apart from identity paging, since it accesses
|
|
||||||
realmode structures by their absolute addresses, like the IVT at 0;
|
|
||||||
and transforms a pmode pointer into a rmode seg:off far ptr. */
|
|
||||||
static grub_err_t
|
|
||||||
install_int13_handler (int noret __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
/* Size of the full int13 handler "bundle", including code and map. */
|
|
||||||
grub_uint32_t total_size;
|
|
||||||
/* Base address of the space reserved for the handler bundle. */
|
|
||||||
grub_uint8_t *handler_base = 0;
|
|
||||||
/* Address of the map within the deployed bundle. */
|
|
||||||
int13map_node_t *handler_map;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
int entries = 0;
|
|
||||||
drivemap_node_t *curentry = map_head;
|
|
||||||
|
|
||||||
/* Count entries to prepare a contiguous map block. */
|
|
||||||
while (curentry)
|
|
||||||
{
|
|
||||||
entries++;
|
|
||||||
curentry = curentry->next;
|
|
||||||
}
|
|
||||||
if (entries == 0)
|
|
||||||
{
|
|
||||||
/* No need to install the int13h handler. */
|
|
||||||
grub_dprintf ("drivemap", "No drives marked as remapped, not installing "
|
|
||||||
"our int13h handler.\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("drivemap", "Installing our int13h handler\n");
|
|
||||||
|
|
||||||
/* Save the pointer to the old handler. */
|
|
||||||
grub_drivemap_oldhandler = *int13slot;
|
|
||||||
grub_dprintf ("drivemap", "Original int13 handler: %04x:%04x\n",
|
|
||||||
(grub_drivemap_oldhandler >> 16) & 0x0ffff,
|
|
||||||
grub_drivemap_oldhandler & 0x0ffff);
|
|
||||||
|
|
||||||
/* Find a rmode-segment-aligned zone in conventional memory big
|
|
||||||
enough to hold the handler and its data. */
|
|
||||||
total_size = INT13H_OFFSET (&grub_drivemap_mapstart)
|
|
||||||
+ (entries + 1) * sizeof (int13map_node_t);
|
|
||||||
grub_dprintf ("drivemap", "Payload is %u bytes long\n", total_size);
|
|
||||||
handler_base = grub_mmap_malign_and_register (16, total_size,
|
|
||||||
&drivemap_mmap,
|
|
||||||
GRUB_MACHINE_MEMORY_RESERVED,
|
|
||||||
GRUB_MMAP_MALLOC_LOW);
|
|
||||||
if (! handler_base)
|
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve "
|
|
||||||
"memory for the int13h handler");
|
|
||||||
|
|
||||||
/* Copy int13h handler bundle to reserved area. */
|
|
||||||
grub_dprintf ("drivemap", "Reserved memory at %p, copying handler\n",
|
|
||||||
handler_base);
|
|
||||||
grub_memcpy (handler_base, &grub_drivemap_handler,
|
|
||||||
INT13H_OFFSET (&grub_drivemap_mapstart));
|
|
||||||
|
|
||||||
/* Copy the mappings to the reserved area. */
|
|
||||||
curentry = map_head;
|
|
||||||
handler_map = (int13map_node_t *) (handler_base +
|
|
||||||
INT13H_OFFSET (&grub_drivemap_mapstart));
|
|
||||||
grub_dprintf ("drivemap", "Target map at %p, copying mappings\n", handler_map);
|
|
||||||
for (i = 0; i < entries; ++i, curentry = curentry->next)
|
|
||||||
{
|
|
||||||
handler_map[i].disknum = curentry->newdrive;
|
|
||||||
handler_map[i].mapto = curentry->redirto;
|
|
||||||
grub_dprintf ("drivemap", "\t#%d: 0x%02x <- 0x%02x\n", i,
|
|
||||||
handler_map[i].disknum, handler_map[i].mapto);
|
|
||||||
}
|
|
||||||
/* Signal end-of-map. */
|
|
||||||
handler_map[i].disknum = 0;
|
|
||||||
handler_map[i].mapto = 0;
|
|
||||||
grub_dprintf ("drivemap", "\t#%d: 0x00 <- 0x00 (end)\n", i);
|
|
||||||
|
|
||||||
/* Install our function as the int13h handler in the IVT. */
|
|
||||||
*int13slot = ((grub_uint32_t) handler_base) << 12; /* Segment address. */
|
|
||||||
grub_dprintf ("drivemap", "New int13 handler: %04x:%04x\n",
|
|
||||||
(*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
uninstall_int13_handler (void)
|
|
||||||
{
|
|
||||||
if (! grub_drivemap_oldhandler)
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
*int13slot = grub_drivemap_oldhandler;
|
|
||||||
grub_mmap_free_and_unregister (drivemap_mmap);
|
|
||||||
grub_drivemap_oldhandler = 0;
|
|
||||||
grub_dprintf ("drivemap", "Restored int13 handler: %04x:%04x\n",
|
|
||||||
(*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_get_root_biosnumber_drivemap (void)
|
|
||||||
{
|
|
||||||
char *biosnum;
|
|
||||||
int ret = -1;
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
biosnum = grub_env_get ("biosnum");
|
|
||||||
|
|
||||||
if (biosnum)
|
|
||||||
return grub_strtoul (biosnum, 0, 0);
|
|
||||||
|
|
||||||
dev = grub_device_open (0);
|
|
||||||
if (dev && dev->disk && dev->disk->dev
|
|
||||||
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
|
|
||||||
{
|
|
||||||
drivemap_node_t *curnode = map_head;
|
|
||||||
ret = (int) dev->disk->id;
|
|
||||||
while (curnode)
|
|
||||||
{
|
|
||||||
if (curnode->redirto == ret)
|
|
||||||
{
|
|
||||||
ret = curnode->newdrive;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
curnode = curnode->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev)
|
|
||||||
grub_device_close (dev);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
static int (*grub_get_root_biosnumber_saved) (void);
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (drivemap)
|
|
||||||
{
|
|
||||||
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
|
|
||||||
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
|
||||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"drivemap"
|
|
||||||
N_("-l | -r | [-s] grubdev osdisk."),
|
|
||||||
N_("Manage the BIOS drive mappings."),
|
|
||||||
options);
|
|
||||||
drivemap_hook =
|
|
||||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
|
||||||
&uninstall_int13_handler,
|
|
||||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_NORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (drivemap)
|
|
||||||
{
|
|
||||||
grub_get_root_biosnumber = grub_get_root_biosnumber_saved;
|
|
||||||
grub_loader_unregister_preboot_hook (drivemap_hook);
|
|
||||||
drivemap_hook = 0;
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
/* drivemap_int13h.S - interrupt handler for the BIOS drive remapper */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
|
|
||||||
#define INT13H_OFFSET(x) ((x) - EXT_C(grub_drivemap_handler))
|
|
||||||
|
|
||||||
.code16
|
|
||||||
|
|
||||||
/* Copy starts here. When deployed, this code must be segment-aligned. */
|
|
||||||
|
|
||||||
/* The replacement int13 handler. Preserve all registers. */
|
|
||||||
FUNCTION(grub_drivemap_handler)
|
|
||||||
/* Save %dx for future restore. */
|
|
||||||
push %dx
|
|
||||||
/* Push flags. Used to simulate interrupt with original flags. */
|
|
||||||
pushf
|
|
||||||
|
|
||||||
/* Map the drive number (always in DL). */
|
|
||||||
push %ax
|
|
||||||
push %bx
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
grub_drivemap_mapstart_ofs = INT13H_OFFSET(EXT_C(grub_drivemap_mapstart))
|
|
||||||
movw $grub_drivemap_mapstart_ofs, %bx
|
|
||||||
#else
|
|
||||||
movw $INT13H_OFFSET(EXT_C(grub_drivemap_mapstart)), %bx
|
|
||||||
#endif
|
|
||||||
|
|
||||||
more_remaining:
|
|
||||||
movw %cs:(%bx), %ax
|
|
||||||
cmpb %ah, %al
|
|
||||||
jz not_found /* DRV=DST => map end - drive not remapped, keep DL. */
|
|
||||||
inc %bx
|
|
||||||
inc %bx
|
|
||||||
cmpb %dl, %al
|
|
||||||
jnz more_remaining /* Not found, but more remaining, loop. */
|
|
||||||
movb %ah, %dl /* Found - drive remapped, modify DL. */
|
|
||||||
|
|
||||||
not_found:
|
|
||||||
pop %bx
|
|
||||||
pop %ax
|
|
||||||
|
|
||||||
/* If the call isn't ah=0x8 or ah=0x15 we must restore %dx. */
|
|
||||||
cmpb $0x8, %ah
|
|
||||||
jz norestore
|
|
||||||
cmpb $0x15, %ah
|
|
||||||
jz norestore
|
|
||||||
|
|
||||||
/* Restore flags. */
|
|
||||||
popf
|
|
||||||
pushf
|
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
grub_drivemap_oldhandler_ofs = INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
|
||||||
mov %sp, %bp
|
|
||||||
|
|
||||||
tail:
|
|
||||||
/* Save new flags below %esp so the caller will recieve new flags. */
|
|
||||||
pushf
|
|
||||||
pop %dx
|
|
||||||
mov %dx, 8(%bp)
|
|
||||||
|
|
||||||
pop %bp
|
|
||||||
|
|
||||||
/* Restore %dx. */
|
|
||||||
pop %dx
|
|
||||||
iret
|
|
||||||
|
|
||||||
norestore:
|
|
||||||
|
|
||||||
/* Restore flags. */
|
|
||||||
popf
|
|
||||||
pushf
|
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
|
||||||
mov %sp, %bp
|
|
||||||
|
|
||||||
/* Save %dx. So it won't be restored to original value. */
|
|
||||||
mov %dx, 2(%bp)
|
|
||||||
|
|
||||||
jmp tail
|
|
||||||
|
|
||||||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
|
||||||
IVT entries (thus PI:SC in mem). */
|
|
||||||
VARIABLE(grub_drivemap_oldhandler)
|
|
||||||
.word 0x0, 0x0
|
|
||||||
|
|
||||||
/* This label MUST be at the end of the copied block, since the installer code
|
|
||||||
reserves additional space for mappings at runtime and copies them over it. */
|
|
||||||
.align 2
|
|
||||||
VARIABLE(grub_drivemap_mapstart)
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/* halt.c - command to halt the computer. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_halt (grub_extcmd_t cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
int no_apm = 0;
|
|
||||||
if (state[0].set)
|
|
||||||
no_apm = 1;
|
|
||||||
grub_halt (no_apm);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(halt)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"[-n]",
|
|
||||||
N_("Halt the system, if possible using APM."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(halt)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
/* play.c - command to play a tune */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Lots of this file is borrowed from GNU/Hurd generic-speaker driver. */
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/machine/time.h>
|
|
||||||
#include <grub/cpu/io.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#define BASE_TEMPO (60 * GRUB_TICKS_PER_SECOND)
|
|
||||||
|
|
||||||
/* The speaker port. */
|
|
||||||
#define SPEAKER 0x61
|
|
||||||
|
|
||||||
/* If 0, follow state of SPEAKER_DATA bit, otherwise enable output
|
|
||||||
from timer 2. */
|
|
||||||
#define SPEAKER_TMR2 0x01
|
|
||||||
|
|
||||||
/* If SPEAKER_TMR2 is not set, this provides direct input into the
|
|
||||||
speaker. Otherwise, this enables or disables the output from the
|
|
||||||
timer. */
|
|
||||||
#define SPEAKER_DATA 0x02
|
|
||||||
|
|
||||||
/* The PIT channel value ports. You can write to and read from them.
|
|
||||||
Do not mess with timer 0 or 1. */
|
|
||||||
#define PIT_COUNTER_0 0x40
|
|
||||||
#define PIT_COUNTER_1 0x41
|
|
||||||
#define PIT_COUNTER_2 0x42
|
|
||||||
|
|
||||||
/* The frequency of the PIT clock. */
|
|
||||||
#define PIT_FREQUENCY 0x1234dd
|
|
||||||
|
|
||||||
/* The PIT control port. You can only write to it. Do not mess with
|
|
||||||
timer 0 or 1. */
|
|
||||||
#define PIT_CTRL 0x43
|
|
||||||
#define PIT_CTRL_SELECT_MASK 0xc0
|
|
||||||
#define PIT_CTRL_SELECT_0 0x00
|
|
||||||
#define PIT_CTRL_SELECT_1 0x40
|
|
||||||
#define PIT_CTRL_SELECT_2 0x80
|
|
||||||
|
|
||||||
/* Read and load control. */
|
|
||||||
#define PIT_CTRL_READLOAD_MASK 0x30
|
|
||||||
#define PIT_CTRL_COUNTER_LATCH 0x00 /* Hold timer value until read. */
|
|
||||||
#define PIT_CTRL_READLOAD_LSB 0x10 /* Read/load the LSB. */
|
|
||||||
#define PIT_CTRL_READLOAD_MSB 0x20 /* Read/load the MSB. */
|
|
||||||
#define PIT_CTRL_READLOAD_WORD 0x30 /* Read/load the LSB then the MSB. */
|
|
||||||
|
|
||||||
/* Mode control. */
|
|
||||||
#define PIT_CTRL_MODE_MASK 0x0e
|
|
||||||
|
|
||||||
/* Interrupt on terminal count. Setting the mode sets output to low.
|
|
||||||
When counter is set and terminated, output is set to high. */
|
|
||||||
#define PIT_CTRL_INTR_ON_TERM 0x00
|
|
||||||
|
|
||||||
/* Programmable one-shot. When loading counter, output is set to
|
|
||||||
high. When counter terminated, output is set to low. Can be
|
|
||||||
triggered again from that point on by setting the gate pin to
|
|
||||||
high. */
|
|
||||||
#define PIT_CTRL_PROGR_ONE_SHOT 0x02
|
|
||||||
|
|
||||||
/* Rate generator. Output is low for one period of the counter, and
|
|
||||||
high for the other. */
|
|
||||||
#define PIT_CTRL_RATE_GEN 0x04
|
|
||||||
|
|
||||||
/* Square wave generator. Output is low for one half of the period,
|
|
||||||
and high for the other half. */
|
|
||||||
#define PIT_CTRL_SQUAREWAVE_GEN 0x06
|
|
||||||
|
|
||||||
/* Software triggered strobe. Setting the mode sets output to high.
|
|
||||||
When counter is set and terminated, output is set to low. */
|
|
||||||
#define PIT_CTRL_SOFTSTROBE 0x08
|
|
||||||
|
|
||||||
/* Hardware triggered strobe. Like software triggered strobe, but
|
|
||||||
only starts the counter when the gate pin is set to high. */
|
|
||||||
#define PIT_CTRL_HARDSTROBE 0x0a
|
|
||||||
|
|
||||||
/* Count mode. */
|
|
||||||
#define PIT_CTRL_COUNT_MASK 0x01
|
|
||||||
#define PIT_CTRL_COUNT_BINARY 0x00 /* 16-bit binary counter. */
|
|
||||||
#define PIT_CTRL_COUNT_BCD 0x01 /* 4-decade BCD counter. */
|
|
||||||
|
|
||||||
#define T_REST ((grub_uint16_t) 0)
|
|
||||||
#define T_FINE ((grub_uint16_t) -1)
|
|
||||||
|
|
||||||
struct note
|
|
||||||
{
|
|
||||||
grub_uint16_t pitch;
|
|
||||||
grub_uint16_t duration;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
beep_off (void)
|
|
||||||
{
|
|
||||||
unsigned char status;
|
|
||||||
|
|
||||||
status = grub_inb (SPEAKER);
|
|
||||||
grub_outb (status & ~(SPEAKER_TMR2 | SPEAKER_DATA), SPEAKER);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
beep_on (grub_uint16_t pitch)
|
|
||||||
{
|
|
||||||
unsigned char status;
|
|
||||||
unsigned int counter;
|
|
||||||
|
|
||||||
if (pitch < 20)
|
|
||||||
pitch = 20;
|
|
||||||
else if (pitch > 20000)
|
|
||||||
pitch = 20000;
|
|
||||||
|
|
||||||
counter = PIT_FREQUENCY / pitch;
|
|
||||||
|
|
||||||
/* Program timer 2. */
|
|
||||||
grub_outb (PIT_CTRL_SELECT_2 | PIT_CTRL_READLOAD_WORD
|
|
||||||
| PIT_CTRL_SQUAREWAVE_GEN | PIT_CTRL_COUNT_BINARY, PIT_CTRL);
|
|
||||||
grub_outb (counter & 0xff, PIT_COUNTER_2); /* LSB */
|
|
||||||
grub_outb ((counter >> 8) & 0xff, PIT_COUNTER_2); /* MSB */
|
|
||||||
|
|
||||||
/* Start speaker. */
|
|
||||||
status = grub_inb (SPEAKER);
|
|
||||||
grub_outb (status | SPEAKER_TMR2 | SPEAKER_DATA, SPEAKER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns whether playing should continue. */
|
|
||||||
static int
|
|
||||||
play (unsigned tempo, struct note *note)
|
|
||||||
{
|
|
||||||
unsigned int to;
|
|
||||||
|
|
||||||
if (note->pitch == T_FINE || grub_checkkey () >= 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
|
|
||||||
note->duration);
|
|
||||||
|
|
||||||
switch (note->pitch)
|
|
||||||
{
|
|
||||||
case T_REST:
|
|
||||||
beep_off ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
beep_on (note->pitch);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
to = grub_get_rtc () + BASE_TEMPO * note->duration / tempo;
|
|
||||||
while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0))
|
|
||||||
;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
struct note buf;
|
|
||||||
grub_uint32_t tempo;
|
|
||||||
|
|
||||||
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_error (GRUB_ERR_FILE_READ_ERROR,
|
|
||||||
"file doesn't even contains a full tempo record");
|
|
||||||
}
|
|
||||||
|
|
||||||
tempo = grub_le_to_cpu32 (tempo);
|
|
||||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
|
||||||
|
|
||||||
while (grub_file_read (file, &buf,
|
|
||||||
sizeof (struct note)) == sizeof (struct note))
|
|
||||||
{
|
|
||||||
buf.pitch = grub_le_to_cpu16 (buf.pitch);
|
|
||||||
buf.duration = grub_le_to_cpu16 (buf.duration);
|
|
||||||
|
|
||||||
if (play (tempo, &buf))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *end;
|
|
||||||
unsigned tempo;
|
|
||||||
struct note note;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
tempo = grub_strtoul (args[0], &end, 0);
|
|
||||||
|
|
||||||
if (*end)
|
|
||||||
/* Was not a number either, assume it was supposed to be a file name. */
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
|
||||||
|
|
||||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
|
||||||
|
|
||||||
for (i = 1; i + 1 < argc; i += 2)
|
|
||||||
{
|
|
||||||
note.pitch = grub_strtoul (args[i], &end, 0);
|
|
||||||
if (*end)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_NUMBER, "bogus pitch number");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
note.duration = grub_strtoul (args[i + 1], &end, 0);
|
|
||||||
if (*end)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_NUMBER, "bogus duration number");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (play (tempo, ¬e))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
beep_off ();
|
|
||||||
|
|
||||||
while (grub_checkkey () > 0)
|
|
||||||
grub_getkey ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(play)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("play", grub_cmd_play,
|
|
||||||
N_("FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2] ... "),
|
|
||||||
N_("Play a tune."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(play)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/* pxe.c - command to control the pxe driver */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/machine/pxe.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
if (! grub_pxe_pxenv)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
|
|
||||||
|
|
||||||
grub_pxe_unload ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(pxecmd)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
|
|
||||||
0,
|
|
||||||
N_("Unload PXE environment."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(pxecmd)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
/* vbeinfo.c - command to list compatible VBE video modes. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/machine/init.h>
|
|
||||||
#include <grub/machine/vbe.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static void *
|
|
||||||
real2pm (grub_vbe_farptr_t ptr)
|
|
||||||
{
|
|
||||||
return (void *) ((((unsigned long) ptr & 0xFFFF0000) >> 12UL)
|
|
||||||
+ ((unsigned long) ptr & 0x0000FFFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_vbeinfo (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
struct grub_vbe_info_block controller_info;
|
|
||||||
struct grub_vbe_mode_info_block mode_info_tmp;
|
|
||||||
grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE;
|
|
||||||
grub_uint16_t *video_mode_list;
|
|
||||||
grub_uint16_t *p;
|
|
||||||
grub_uint16_t *saved_video_mode_list;
|
|
||||||
grub_size_t video_mode_list_size;
|
|
||||||
grub_err_t err;
|
|
||||||
char *modevar;
|
|
||||||
|
|
||||||
err = grub_vbe_probe (&controller_info);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
grub_printf ("VBE info: version: %d.%d OEM software rev: %d.%d\n",
|
|
||||||
controller_info.version >> 8,
|
|
||||||
controller_info.version & 0xFF,
|
|
||||||
controller_info.oem_software_rev >> 8,
|
|
||||||
controller_info.oem_software_rev & 0xFF);
|
|
||||||
|
|
||||||
/* The total_memory field is in 64 KiB units. */
|
|
||||||
grub_printf (" total memory: %d KiB\n",
|
|
||||||
(controller_info.total_memory << 16) / 1024);
|
|
||||||
|
|
||||||
/* Because the information on video modes is stored in a temporary place,
|
|
||||||
it is better to copy it to somewhere safe. */
|
|
||||||
p = video_mode_list = real2pm (controller_info.video_mode_ptr);
|
|
||||||
while (*p++ != 0xFFFF)
|
|
||||||
;
|
|
||||||
|
|
||||||
video_mode_list_size = (grub_addr_t) p - (grub_addr_t) video_mode_list;
|
|
||||||
saved_video_mode_list = grub_malloc (video_mode_list_size);
|
|
||||||
if (! saved_video_mode_list)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_memcpy (saved_video_mode_list, video_mode_list, video_mode_list_size);
|
|
||||||
|
|
||||||
grub_printf ("List of compatible video modes:\n");
|
|
||||||
grub_printf ("Legend: P=Packed pixel, D=Direct color, "
|
|
||||||
"mask/pos=R/G/B/reserved\n");
|
|
||||||
|
|
||||||
/* Walk through all video modes listed. */
|
|
||||||
for (p = saved_video_mode_list; *p != 0xFFFF; p++)
|
|
||||||
{
|
|
||||||
const char *memory_model = 0;
|
|
||||||
grub_uint32_t mode = (grub_uint32_t) *p;
|
|
||||||
|
|
||||||
err = grub_vbe_get_video_mode_info (mode, &mode_info_tmp);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mode_info_tmp.mode_attributes & GRUB_VBE_MODEATTR_SUPPORTED) == 0)
|
|
||||||
/* If not available, skip it. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((mode_info_tmp.mode_attributes & GRUB_VBE_MODEATTR_RESERVED_1) == 0)
|
|
||||||
/* Not enough information. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((mode_info_tmp.mode_attributes & GRUB_VBE_MODEATTR_COLOR) == 0)
|
|
||||||
/* Monochrome is unusable. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((mode_info_tmp.mode_attributes & GRUB_VBE_MODEATTR_LFB_AVAIL) == 0)
|
|
||||||
/* We support only linear frame buffer modes. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((mode_info_tmp.mode_attributes & GRUB_VBE_MODEATTR_GRAPHICS) == 0)
|
|
||||||
/* We allow only graphical modes. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (mode_info_tmp.memory_model)
|
|
||||||
{
|
|
||||||
case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL:
|
|
||||||
memory_model = "Packed";
|
|
||||||
break;
|
|
||||||
case GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR:
|
|
||||||
memory_model = "Direct";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! memory_model)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
grub_printf ("0x%03x: %4d x %4d x %2d %s",
|
|
||||||
mode,
|
|
||||||
mode_info_tmp.x_resolution,
|
|
||||||
mode_info_tmp.y_resolution,
|
|
||||||
mode_info_tmp.bits_per_pixel,
|
|
||||||
memory_model);
|
|
||||||
|
|
||||||
/* Show mask and position details for direct color modes. */
|
|
||||||
if (mode_info_tmp.memory_model == GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)
|
|
||||||
grub_printf (", mask: %d/%d/%d/%d pos: %d/%d/%d/%d",
|
|
||||||
mode_info_tmp.red_mask_size,
|
|
||||||
mode_info_tmp.green_mask_size,
|
|
||||||
mode_info_tmp.blue_mask_size,
|
|
||||||
mode_info_tmp.rsvd_mask_size,
|
|
||||||
mode_info_tmp.red_field_position,
|
|
||||||
mode_info_tmp.green_field_position,
|
|
||||||
mode_info_tmp.blue_field_position,
|
|
||||||
mode_info_tmp.rsvd_field_position);
|
|
||||||
grub_printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (saved_video_mode_list);
|
|
||||||
|
|
||||||
/* Check existence of vbe_mode environment variable. */
|
|
||||||
modevar = grub_env_get ("vbe_mode");
|
|
||||||
|
|
||||||
if (modevar != 0)
|
|
||||||
{
|
|
||||||
unsigned long value;
|
|
||||||
|
|
||||||
value = grub_strtoul (modevar, 0, 0);
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
use_mode = value;
|
|
||||||
else
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("Configured VBE mode (vbe_mode) = 0x%03x\n", use_mode);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(vbeinfo)
|
|
||||||
{
|
|
||||||
cmd =
|
|
||||||
grub_register_command ("vbeinfo", grub_cmd_vbeinfo, 0,
|
|
||||||
N_("List compatible VESA BIOS extension video modes."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(vbeinfo)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
/* vbetest.c - command to test VESA BIOS Extension 2.0+ support. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/machine/init.h>
|
|
||||||
#include <grub/machine/vbe.h>
|
|
||||||
#include <grub/video.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
char *modevar;
|
|
||||||
struct grub_vbe_mode_info_block mode_info;
|
|
||||||
struct grub_vbe_info_block controller_info;
|
|
||||||
grub_uint32_t use_mode = GRUB_VBE_DEFAULT_VIDEO_MODE;
|
|
||||||
grub_uint32_t old_mode;
|
|
||||||
grub_uint8_t *framebuffer = 0;
|
|
||||||
grub_uint32_t bytes_per_scan_line = 0;
|
|
||||||
unsigned char *ptr;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
grub_printf ("Probing for VESA BIOS Extension ... ");
|
|
||||||
|
|
||||||
/* Check if VESA BIOS exists. */
|
|
||||||
err = grub_vbe_probe (&controller_info);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
grub_printf ("found!\n");
|
|
||||||
|
|
||||||
/* Dump out controller information. */
|
|
||||||
grub_printf ("VBE signature = %c%c%c%c\n",
|
|
||||||
controller_info.signature[0],
|
|
||||||
controller_info.signature[1],
|
|
||||||
controller_info.signature[2],
|
|
||||||
controller_info.signature[3]);
|
|
||||||
|
|
||||||
grub_printf ("VBE version = %d.%d\n",
|
|
||||||
controller_info.version >> 8,
|
|
||||||
controller_info.version & 0xFF);
|
|
||||||
grub_printf ("OEM string ptr = %08x\n",
|
|
||||||
controller_info.oem_string_ptr);
|
|
||||||
grub_printf ("Total memory = %d\n",
|
|
||||||
controller_info.total_memory);
|
|
||||||
|
|
||||||
err = grub_vbe_get_video_mode (&old_mode);
|
|
||||||
grub_printf ("Get video mode err = %04x\n", err);
|
|
||||||
|
|
||||||
if (err == GRUB_ERR_NONE)
|
|
||||||
grub_printf ("Old video mode = %04x\n", old_mode);
|
|
||||||
else
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
/* Check existence of vbe_mode environment variable. */
|
|
||||||
modevar = grub_env_get ("vbe_mode");
|
|
||||||
if (modevar != 0)
|
|
||||||
{
|
|
||||||
unsigned long value;
|
|
||||||
|
|
||||||
value = grub_strtoul (modevar, 0, 0);
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
use_mode = value;
|
|
||||||
else
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_vbe_get_video_mode_info (use_mode, &mode_info);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* Dump out details about the mode being tested. */
|
|
||||||
grub_printf ("mode: 0x%03x\n",
|
|
||||||
use_mode);
|
|
||||||
grub_printf ("width : %d\n",
|
|
||||||
mode_info.x_resolution);
|
|
||||||
grub_printf ("height: %d\n",
|
|
||||||
mode_info.y_resolution);
|
|
||||||
grub_printf ("memory model: %02x\n",
|
|
||||||
mode_info.memory_model);
|
|
||||||
grub_printf ("bytes/scanline: %d\n",
|
|
||||||
mode_info.bytes_per_scan_line);
|
|
||||||
grub_printf ("bytes/scanline (lin): %d\n",
|
|
||||||
mode_info.lin_bytes_per_scan_line);
|
|
||||||
grub_printf ("base address: %08x\n",
|
|
||||||
mode_info.phys_base_addr);
|
|
||||||
grub_printf ("red mask/pos: %d/%d\n",
|
|
||||||
mode_info.red_mask_size,
|
|
||||||
mode_info.red_field_position);
|
|
||||||
grub_printf ("green mask/pos: %d/%d\n",
|
|
||||||
mode_info.green_mask_size,
|
|
||||||
mode_info.green_field_position);
|
|
||||||
grub_printf ("blue mask/pos: %d/%d\n",
|
|
||||||
mode_info.blue_mask_size,
|
|
||||||
mode_info.blue_field_position);
|
|
||||||
|
|
||||||
grub_printf ("Press any key to continue.\n");
|
|
||||||
|
|
||||||
grub_getkey ();
|
|
||||||
|
|
||||||
/* Setup GFX mode. */
|
|
||||||
err = grub_vbe_set_video_mode (use_mode, &mode_info);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* Determine framebuffer address and how many bytes are in scan line. */
|
|
||||||
framebuffer = (grub_uint8_t *) mode_info.phys_base_addr;
|
|
||||||
ptr = framebuffer;
|
|
||||||
|
|
||||||
if (controller_info.version >= 0x300)
|
|
||||||
{
|
|
||||||
bytes_per_scan_line = mode_info.lin_bytes_per_scan_line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bytes_per_scan_line = mode_info.bytes_per_scan_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw some random data to screen. */
|
|
||||||
for (i = 0; i < 256 * 256; i++)
|
|
||||||
{
|
|
||||||
ptr[i] = i & 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw white line to screen. */
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
{
|
|
||||||
ptr[mode_info.bytes_per_scan_line * 50 + i] = 0x0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw another white line to screen. */
|
|
||||||
grub_memset (ptr + bytes_per_scan_line * 51, 0x0f, bytes_per_scan_line);
|
|
||||||
|
|
||||||
grub_getkey ();
|
|
||||||
|
|
||||||
grub_video_restore ();
|
|
||||||
|
|
||||||
/* Restore old video mode. */
|
|
||||||
grub_vbe_set_video_mode (old_mode, 0);
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(vbetest)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("vbetest", grub_cmd_vbetest,
|
|
||||||
0, N_("Test VESA BIOS Extension 2.0+ support."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(vbetest)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/* suspend.c - command to suspend GRUB and return to Open Firmware */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/ieee1275/ieee1275.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_printf ("Run 'go' to resume GRUB.\n");
|
|
||||||
grub_ieee1275_enter ();
|
|
||||||
grub_cls ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(ieee1275_suspend)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("suspend", grub_cmd_suspend,
|
|
||||||
0, N_("Return to Open Firmware prompt."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(ieee1275_suspend)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
/* keystatus.c - Command to check key modifier status. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"shift", 's', 0, N_("Check Shift key."), 0, 0},
|
|
||||||
{"ctrl", 'c', 0, N_("Check Control key."), 0, 0},
|
|
||||||
{"alt", 'a', 0, N_("Check Alt key."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
#define grub_cur_term_input grub_term_get_current_input ()
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_keystatus (grub_extcmd_t cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
int expect_mods = 0;
|
|
||||||
int mods;
|
|
||||||
|
|
||||||
if (state[0].set)
|
|
||||||
expect_mods |= GRUB_TERM_STATUS_SHIFT;
|
|
||||||
if (state[1].set)
|
|
||||||
expect_mods |= GRUB_TERM_STATUS_CTRL;
|
|
||||||
if (state[2].set)
|
|
||||||
expect_mods |= GRUB_TERM_STATUS_ALT;
|
|
||||||
|
|
||||||
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
|
|
||||||
|
|
||||||
/* Without arguments, just check whether getkeystatus is supported at
|
|
||||||
all. */
|
|
||||||
if (expect_mods == 0)
|
|
||||||
{
|
|
||||||
grub_term_input_t term;
|
|
||||||
int nterms = 0;
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_INPUTS (term)
|
|
||||||
if (!term->getkeystatus)
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
else
|
|
||||||
nterms++;
|
|
||||||
if (!nterms)
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mods = grub_getkeystatus ();
|
|
||||||
grub_dprintf ("keystatus", "mods: %d\n", mods);
|
|
||||||
if (mods >= 0 && (mods & expect_mods) != 0)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(keystatus)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[--shift] [--ctrl] [--alt]"),
|
|
||||||
N_("Check key modifier status."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(keystatus)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,405 +0,0 @@
|
|||||||
/* loadenv.c - command to load/save environment variable. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/lib/envblk.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"file", 'f', 0, N_("Specify filename."), 0, ARG_TYPE_PATHNAME},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_file_t
|
|
||||||
open_envblk_file (char *filename)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
if (! filename)
|
|
||||||
{
|
|
||||||
char *prefix;
|
|
||||||
|
|
||||||
prefix = grub_env_get ("prefix");
|
|
||||||
if (prefix)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = grub_strlen (prefix);
|
|
||||||
filename = grub_malloc (len + 1 + sizeof (GRUB_ENVBLK_DEFCFG));
|
|
||||||
if (! filename)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
grub_strcpy (filename, prefix);
|
|
||||||
filename[len] = '/';
|
|
||||||
grub_strcpy (filename + len + 1, GRUB_ENVBLK_DEFCFG);
|
|
||||||
file = grub_file_open (filename);
|
|
||||||
grub_free (filename);
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "prefix is not found");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return grub_file_open (filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_envblk_t
|
|
||||||
read_envblk_file (grub_file_t file)
|
|
||||||
{
|
|
||||||
grub_off_t offset = 0;
|
|
||||||
char *buf;
|
|
||||||
grub_size_t size = grub_file_size (file);
|
|
||||||
grub_envblk_t envblk;
|
|
||||||
|
|
||||||
buf = grub_malloc (size);
|
|
||||||
if (! buf)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
while (size > 0)
|
|
||||||
{
|
|
||||||
grub_ssize_t ret;
|
|
||||||
|
|
||||||
ret = grub_file_read (file, buf + offset, size);
|
|
||||||
if (ret <= 0)
|
|
||||||
{
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "cannot read");
|
|
||||||
grub_free (buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size -= ret;
|
|
||||||
offset += ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
envblk = grub_envblk_open (buf, offset);
|
|
||||||
if (! envblk)
|
|
||||||
{
|
|
||||||
grub_free (buf);
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid environment block");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return envblk;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_load_env (grub_extcmd_t cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
grub_file_t file;
|
|
||||||
grub_envblk_t envblk;
|
|
||||||
|
|
||||||
auto int set_var (const char *name, const char *value);
|
|
||||||
int set_var (const char *name, const char *value)
|
|
||||||
{
|
|
||||||
grub_env_set (name, value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
envblk = read_envblk_file (file);
|
|
||||||
if (! envblk)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_envblk_iterate (envblk, set_var);
|
|
||||||
grub_envblk_close (envblk);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_list_env (grub_extcmd_t cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
grub_file_t file;
|
|
||||||
grub_envblk_t envblk;
|
|
||||||
|
|
||||||
/* Print all variables in current context. */
|
|
||||||
auto int print_var (const char *name, const char *value);
|
|
||||||
int print_var (const char *name, const char *value)
|
|
||||||
{
|
|
||||||
grub_printf ("%s=%s\n", name, value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
envblk = read_envblk_file (file);
|
|
||||||
if (! envblk)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_envblk_iterate (envblk, print_var);
|
|
||||||
grub_envblk_close (envblk);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Used to maintain a variable length of blocklists internally. */
|
|
||||||
struct blocklist
|
|
||||||
{
|
|
||||||
grub_disk_addr_t sector;
|
|
||||||
unsigned offset;
|
|
||||||
unsigned length;
|
|
||||||
struct blocklist *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
free_blocklists (struct blocklist *p)
|
|
||||||
{
|
|
||||||
struct blocklist *q;
|
|
||||||
|
|
||||||
for (; p; p = q)
|
|
||||||
{
|
|
||||||
q = p->next;
|
|
||||||
grub_free (p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|
||||||
grub_file_t file)
|
|
||||||
{
|
|
||||||
grub_size_t total_length;
|
|
||||||
grub_size_t index;
|
|
||||||
grub_disk_t disk;
|
|
||||||
grub_disk_addr_t part_start;
|
|
||||||
struct blocklist *p;
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
/* Sanity checks. */
|
|
||||||
total_length = 0;
|
|
||||||
for (p = blocklists; p; p = p->next)
|
|
||||||
{
|
|
||||||
struct blocklist *q;
|
|
||||||
for (q = p->next; q; q = q->next)
|
|
||||||
{
|
|
||||||
/* Check if any pair of blocks overlap. */
|
|
||||||
if (p->sector == q->sector)
|
|
||||||
{
|
|
||||||
/* This might be actually valid, but it is unbelievable that
|
|
||||||
any filesystem makes such a silly allocation. */
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS, "malformed file");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
total_length += p->length;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total_length != grub_file_size (file))
|
|
||||||
{
|
|
||||||
/* Maybe sparse, unallocated sectors. No way in GRUB. */
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
|
||||||
those with the data read via a file. */
|
|
||||||
disk = file->device->disk;
|
|
||||||
if (disk->partition)
|
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
|
||||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
|
||||||
{
|
|
||||||
char blockbuf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
|
|
||||||
if (grub_disk_read (disk, p->sector - part_start,
|
|
||||||
p->offset, p->length, blockbuf))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
|
|
||||||
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|
||||||
grub_file_t file)
|
|
||||||
{
|
|
||||||
char *buf;
|
|
||||||
grub_disk_t disk;
|
|
||||||
grub_disk_addr_t part_start;
|
|
||||||
struct blocklist *p;
|
|
||||||
grub_size_t index;
|
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
|
||||||
disk = file->device->disk;
|
|
||||||
if (disk->partition)
|
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
index = 0;
|
|
||||||
for (p = blocklists; p; index += p->length, p = p->next)
|
|
||||||
{
|
|
||||||
if (grub_disk_write (disk, p->sector - part_start,
|
|
||||||
p->offset, p->length, buf + index))
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
grub_file_t file;
|
|
||||||
grub_envblk_t envblk;
|
|
||||||
struct blocklist *head = 0;
|
|
||||||
struct blocklist *tail = 0;
|
|
||||||
|
|
||||||
/* Store blocklists in a linked list. */
|
|
||||||
auto void NESTED_FUNC_ATTR read_hook (grub_disk_addr_t sector,
|
|
||||||
unsigned offset,
|
|
||||||
unsigned length);
|
|
||||||
void NESTED_FUNC_ATTR read_hook (grub_disk_addr_t sector,
|
|
||||||
unsigned offset, unsigned length)
|
|
||||||
{
|
|
||||||
struct blocklist *block;
|
|
||||||
|
|
||||||
if (offset + length > GRUB_DISK_SECTOR_SIZE)
|
|
||||||
/* Seemingly a bug. */
|
|
||||||
return;
|
|
||||||
|
|
||||||
block = grub_malloc (sizeof (*block));
|
|
||||||
if (! block)
|
|
||||||
return;
|
|
||||||
|
|
||||||
block->sector = sector;
|
|
||||||
block->offset = offset;
|
|
||||||
block->length = length;
|
|
||||||
|
|
||||||
/* Slightly complicated, because the list should be FIFO. */
|
|
||||||
block->next = 0;
|
|
||||||
if (tail)
|
|
||||||
tail->next = block;
|
|
||||||
tail = block;
|
|
||||||
if (! head)
|
|
||||||
head = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! argc)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified");
|
|
||||||
|
|
||||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (! file->device->disk)
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "disk device required");
|
|
||||||
}
|
|
||||||
|
|
||||||
file->read_hook = read_hook;
|
|
||||||
envblk = read_envblk_file (file);
|
|
||||||
file->read_hook = 0;
|
|
||||||
if (! envblk)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (check_blocklists (envblk, head, file))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
while (argc)
|
|
||||||
{
|
|
||||||
char *value;
|
|
||||||
|
|
||||||
value = grub_env_get (args[0]);
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
if (! grub_envblk_set (envblk, args[0], value))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "environment block too small");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
argc--;
|
|
||||||
args++;
|
|
||||||
}
|
|
||||||
|
|
||||||
write_blocklists (envblk, head, file);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (envblk)
|
|
||||||
grub_envblk_close (envblk);
|
|
||||||
free_blocklists (head);
|
|
||||||
grub_file_close (file);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd_load, cmd_list, cmd_save;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(loadenv)
|
|
||||||
{
|
|
||||||
cmd_load =
|
|
||||||
grub_register_extcmd ("load_env", grub_cmd_load_env,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-f FILE]"),
|
|
||||||
N_("Load variables from environment block file."),
|
|
||||||
options);
|
|
||||||
cmd_list =
|
|
||||||
grub_register_extcmd ("list_env", grub_cmd_list_env,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-f FILE]"),
|
|
||||||
N_("List variables from environment block file."),
|
|
||||||
options);
|
|
||||||
cmd_save =
|
|
||||||
grub_register_extcmd ("save_env", grub_cmd_save_env,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-f FILE] variable_name [...]"),
|
|
||||||
N_("Save variables to environment block file."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(loadenv)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd_load);
|
|
||||||
grub_unregister_extcmd (cmd_list);
|
|
||||||
grub_unregister_extcmd (cmd_save);
|
|
||||||
}
|
|
||||||
-276
@@ -1,276 +0,0 @@
|
|||||||
/* ls.c - command to list files and devices */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2003,2005,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/datetime.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0},
|
|
||||||
{"human-readable", 'h', 0, N_("Print sizes in a human readable format."), 0, 0},
|
|
||||||
{"all", 'a', 0, N_("List all files."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char grub_human_sizes[] = {' ', 'K', 'M', 'G', 'T'};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_ls_list_devices (int longlist)
|
|
||||||
{
|
|
||||||
auto int grub_ls_print_devices (const char *name);
|
|
||||||
int grub_ls_print_devices (const char *name)
|
|
||||||
{
|
|
||||||
if (longlist)
|
|
||||||
grub_normal_print_device_info (name);
|
|
||||||
else
|
|
||||||
grub_printf ("(%s) ", name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_device_iterate (grub_ls_print_devices);
|
|
||||||
grub_putchar ('\n');
|
|
||||||
grub_refresh ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|
||||||
{
|
|
||||||
char *device_name;
|
|
||||||
grub_fs_t fs;
|
|
||||||
const char *path;
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
auto int print_files (const char *filename,
|
|
||||||
const struct grub_dirhook_info *info);
|
|
||||||
auto int print_files_long (const char *filename,
|
|
||||||
const struct grub_dirhook_info *info);
|
|
||||||
|
|
||||||
int print_files (const char *filename, const struct grub_dirhook_info *info)
|
|
||||||
{
|
|
||||||
if (all || filename[0] != '.')
|
|
||||||
grub_printf ("%s%s ", filename, info->dir ? "/" : "");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int print_files_long (const char *filename,
|
|
||||||
const struct grub_dirhook_info *info)
|
|
||||||
{
|
|
||||||
if ((! all) && (filename[0] == '.'))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (! info->dir)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char *pathname;
|
|
||||||
|
|
||||||
if (dirname[grub_strlen (dirname) - 1] == '/')
|
|
||||||
pathname = grub_xasprintf ("%s%s", dirname, filename);
|
|
||||||
else
|
|
||||||
pathname = grub_xasprintf ("%s/%s", dirname, filename);
|
|
||||||
|
|
||||||
if (!pathname)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* XXX: For ext2fs symlinks are detected as files while they
|
|
||||||
should be reported as directories. */
|
|
||||||
file = grub_file_open (pathname);
|
|
||||||
if (! file)
|
|
||||||
{
|
|
||||||
grub_errno = 0;
|
|
||||||
grub_free (pathname);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! human)
|
|
||||||
grub_printf ("%-12llu", (unsigned long long) file->size);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_uint64_t fsize = file->size * 100ULL;
|
|
||||||
int fsz = file->size;
|
|
||||||
int units = 0;
|
|
||||||
char buf[20];
|
|
||||||
|
|
||||||
while (fsz / 1024)
|
|
||||||
{
|
|
||||||
fsize = (fsize + 512) / 1024;
|
|
||||||
fsz /= 1024;
|
|
||||||
units++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (units)
|
|
||||||
{
|
|
||||||
grub_uint32_t whole, fraction;
|
|
||||||
|
|
||||||
whole = grub_divmod64 (fsize, 100, &fraction);
|
|
||||||
grub_snprintf (buf, sizeof (buf),
|
|
||||||
"%u.%02u%c", whole, fraction,
|
|
||||||
grub_human_sizes[units]);
|
|
||||||
grub_printf ("%-12s", buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("%-12llu", (unsigned long long) file->size);
|
|
||||||
|
|
||||||
}
|
|
||||||
grub_file_close (file);
|
|
||||||
grub_free (pathname);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("%-12s", "DIR");
|
|
||||||
|
|
||||||
if (info->mtimeset)
|
|
||||||
{
|
|
||||||
struct grub_datetime datetime;
|
|
||||||
grub_unixtime2datetime (info->mtime, &datetime);
|
|
||||||
if (human)
|
|
||||||
grub_printf (" %d-%02d-%02d %02d:%02d:%02d %-11s ",
|
|
||||||
datetime.year, datetime.month, datetime.day,
|
|
||||||
datetime.hour, datetime.minute,
|
|
||||||
datetime.second,
|
|
||||||
grub_get_weekday_name (&datetime));
|
|
||||||
else
|
|
||||||
grub_printf (" %04d%02d%02d%02d%02d%02d ",
|
|
||||||
datetime.year, datetime.month,
|
|
||||||
datetime.day, datetime.hour,
|
|
||||||
datetime.minute, datetime.second);
|
|
||||||
}
|
|
||||||
grub_printf ("%s%s\n", filename, info->dir ? "/" : "");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
device_name = grub_file_get_device_name (dirname);
|
|
||||||
dev = grub_device_open (device_name);
|
|
||||||
if (! dev)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
path = grub_strchr (dirname, ')');
|
|
||||||
if (! path)
|
|
||||||
path = dirname;
|
|
||||||
else
|
|
||||||
path++;
|
|
||||||
|
|
||||||
if (! path && ! device_name)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! *path)
|
|
||||||
{
|
|
||||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
grub_normal_print_device_info (device_name);
|
|
||||||
}
|
|
||||||
else if (fs)
|
|
||||||
{
|
|
||||||
if (longlist)
|
|
||||||
(fs->dir) (dev, path, print_files_long);
|
|
||||||
else
|
|
||||||
(fs->dir) (dev, path, print_files);
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE
|
|
||||||
&& path[grub_strlen (path) - 1] != '/')
|
|
||||||
{
|
|
||||||
/* PATH might be a regular file. */
|
|
||||||
char *p;
|
|
||||||
grub_file_t file;
|
|
||||||
struct grub_dirhook_info info;
|
|
||||||
grub_errno = 0;
|
|
||||||
|
|
||||||
file = grub_file_open (dirname);
|
|
||||||
if (! file)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
p = grub_strrchr (dirname, '/') + 1;
|
|
||||||
dirname = grub_strndup (dirname, p - dirname);
|
|
||||||
if (! dirname)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
all = 1;
|
|
||||||
grub_memset (&info, 0, sizeof (info));
|
|
||||||
if (longlist)
|
|
||||||
print_files_long (p, &info);
|
|
||||||
else
|
|
||||||
print_files (p, &info);
|
|
||||||
|
|
||||||
grub_free (dirname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
grub_putchar ('\n');
|
|
||||||
|
|
||||||
grub_refresh ();
|
|
||||||
}
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (dev)
|
|
||||||
grub_device_close (dev);
|
|
||||||
|
|
||||||
grub_free (device_name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_ls (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
grub_ls_list_devices (state[0].set);
|
|
||||||
else
|
|
||||||
grub_ls_list_files (args[0], state[0].set, state[2].set,
|
|
||||||
state[1].set);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(ls)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[-l|-h|-a] [FILE]"),
|
|
||||||
N_("List devices and files."), options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(ls)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
|
|
||||||
|
|
||||||
{
|
|
||||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
|
||||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
|
||||||
{
|
|
||||||
grub_printf ("base_addr = 0x%llx, length = 0x%llx, type = 0x%x\n",
|
|
||||||
(long long) addr, (long long) size, type);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
grub_machine_mmap_iterate (hook);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(lsmmap)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("lsmmap", grub_cmd_lsmmap,
|
|
||||||
0, N_("List memory map provided by firmware."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(lsmmap)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
/* lspci.c - List PCI devices. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
struct grub_pci_classname
|
|
||||||
{
|
|
||||||
int class;
|
|
||||||
int subclass;
|
|
||||||
char *desc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct grub_pci_classname grub_pci_classes[] =
|
|
||||||
{
|
|
||||||
{ 0, 0, "" },
|
|
||||||
{ 1, 0, "SCSI Controller" },
|
|
||||||
{ 1, 1, "IDE Controller" },
|
|
||||||
{ 1, 2, "Floppy Controller" },
|
|
||||||
{ 1, 3, "IPI Controller" },
|
|
||||||
{ 1, 4, "RAID Controller" },
|
|
||||||
{ 1, 6, "SATA Controller" },
|
|
||||||
{ 1, 0x80, "Mass storage Controller" },
|
|
||||||
{ 2, 0, "Ethernet Controller" },
|
|
||||||
{ 2, 1, "Token Ring Controller" },
|
|
||||||
{ 2, 2, "FDDI Controller" },
|
|
||||||
{ 2, 3, "ATM Controller" },
|
|
||||||
{ 2, 4, "ISDN Controller" },
|
|
||||||
{ 2, 0x80, "Network controller" },
|
|
||||||
{ 3, 0, "VGA Controller" },
|
|
||||||
{ 3, 1, "XGA Controller" },
|
|
||||||
{ 3, 2, "3D Controller" },
|
|
||||||
{ 3, 0x80, "Display Controller" },
|
|
||||||
{ 4, 0, "Multimedia Video Device" },
|
|
||||||
{ 4, 1, "Multimedia Audio Device" },
|
|
||||||
{ 4, 2, "Multimedia Telephony Device" },
|
|
||||||
{ 4, 0x80, "Multimedia device" },
|
|
||||||
{ 5, 0, "RAM Controller" },
|
|
||||||
{ 5, 1, "Flash Memory Controller" },
|
|
||||||
{ 5, 0x80, "Memory Controller" },
|
|
||||||
{ 6, 0, "Host Bridge" },
|
|
||||||
{ 6, 1, "ISA Bridge" },
|
|
||||||
{ 6, 2, "EISA Bride" },
|
|
||||||
{ 6, 3, "MCA Bridge" },
|
|
||||||
{ 6, 4, "PCI-PCI Bridge" },
|
|
||||||
{ 6, 5, "PCMCIA Bridge" },
|
|
||||||
{ 6, 6, "NuBus Bridge" },
|
|
||||||
{ 6, 7, "CardBus Bridge" },
|
|
||||||
{ 6, 8, "Raceway Bridge" },
|
|
||||||
{ 6, 0x80, "Unknown Bridge" },
|
|
||||||
{ 7, 0x80, "Communication controller" },
|
|
||||||
{ 8, 0x80, "System hardware" },
|
|
||||||
{ 9, 0, "Keyboard Controller" },
|
|
||||||
{ 9, 1, "Digitizer" },
|
|
||||||
{ 9, 2, "Mouse Controller" },
|
|
||||||
{ 9, 3, "Scanner Controller" },
|
|
||||||
{ 9, 4, "Gameport Controller" },
|
|
||||||
{ 9, 0x80, "Unknown Input Device" },
|
|
||||||
{ 10, 0, "Generic Docking Station" },
|
|
||||||
{ 10, 0x80, "Unknown Docking Station" },
|
|
||||||
{ 11, 0, "80386 Processor" },
|
|
||||||
{ 11, 1, "80486 Processor" },
|
|
||||||
{ 11, 2, "Pentium Processor" },
|
|
||||||
{ 11, 0x10, "Alpha Processor" },
|
|
||||||
{ 11, 0x20, "PowerPC Processor" },
|
|
||||||
{ 11, 0x30, "MIPS Processor" },
|
|
||||||
{ 11, 0x40, "Co-Processor" },
|
|
||||||
{ 11, 0x80, "Unknown Processor" },
|
|
||||||
{ 12, 3, "USB Controller" },
|
|
||||||
{ 12, 0x80, "Serial Bus Controller" },
|
|
||||||
{ 13, 0x80, "Wireless Controller" },
|
|
||||||
{ 14, 0, "I2O" },
|
|
||||||
{ 15, 0, "IrDA Controller" },
|
|
||||||
{ 15, 1, "Consumer IR" },
|
|
||||||
{ 15, 0x10, "RF-Controller" },
|
|
||||||
{ 15, 0x80, "Satellite Communication Controller" },
|
|
||||||
{ 16, 0, "Network Decryption" },
|
|
||||||
{ 16, 1, "Entertainment Decryption" },
|
|
||||||
{ 16, 0x80, "Unknown Decryption Controller" },
|
|
||||||
{ 17, 0, "Digital IO Module" },
|
|
||||||
{ 17, 0x80, "Unknown Data Input System" },
|
|
||||||
{ 0, 0, 0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
grub_pci_get_class (int class, int subclass)
|
|
||||||
{
|
|
||||||
const struct grub_pci_classname *curr = grub_pci_classes;
|
|
||||||
|
|
||||||
while (curr->desc)
|
|
||||||
{
|
|
||||||
if (curr->class == class && curr->subclass == subclass)
|
|
||||||
return curr->desc;
|
|
||||||
curr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"iospace", 'i', 0, "show I/O spaces", 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static int iospace;
|
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
|
||||||
grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|
||||||
{
|
|
||||||
grub_uint32_t class;
|
|
||||||
const char *sclass;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
int reg;
|
|
||||||
|
|
||||||
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
|
|
||||||
grub_pci_get_device (dev), grub_pci_get_function (dev),
|
|
||||||
pciid & 0xFFFF, pciid >> 16);
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
class = grub_pci_read (addr);
|
|
||||||
|
|
||||||
/* Lookup the class name, if there isn't a specific one,
|
|
||||||
retry with 0x80 to get the generic class name. */
|
|
||||||
sclass = grub_pci_get_class (class >> 24, (class >> 16) & 0xFF);
|
|
||||||
if (! sclass)
|
|
||||||
sclass = grub_pci_get_class (class >> 24, 0x80);
|
|
||||||
if (! sclass)
|
|
||||||
sclass = "";
|
|
||||||
|
|
||||||
grub_printf (" [%04x] %s", (class >> 16) & 0xffff, sclass);
|
|
||||||
|
|
||||||
grub_uint8_t pi = (class >> 8) & 0xff;
|
|
||||||
if (pi)
|
|
||||||
grub_printf (" [PI %02x]", pi);
|
|
||||||
|
|
||||||
grub_printf ("\n");
|
|
||||||
|
|
||||||
if (iospace)
|
|
||||||
{
|
|
||||||
reg = GRUB_PCI_REG_ADDRESSES;
|
|
||||||
while (reg < GRUB_PCI_REG_CIS_POINTER)
|
|
||||||
{
|
|
||||||
grub_uint64_t space;
|
|
||||||
addr = grub_pci_make_address (dev, reg);
|
|
||||||
space = grub_pci_read (addr);
|
|
||||||
|
|
||||||
reg += sizeof (grub_uint32_t);
|
|
||||||
|
|
||||||
if (space == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
|
|
||||||
{
|
|
||||||
case GRUB_PCI_ADDR_SPACE_IO:
|
|
||||||
grub_printf ("\tIO space %d at 0x%llx\n",
|
|
||||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
|
||||||
/ sizeof (grub_uint32_t)) - 1,
|
|
||||||
(unsigned long long)
|
|
||||||
(space & GRUB_PCI_ADDR_IO_MASK));
|
|
||||||
break;
|
|
||||||
case GRUB_PCI_ADDR_SPACE_MEMORY:
|
|
||||||
if ((space & GRUB_PCI_ADDR_MEM_TYPE_MASK)
|
|
||||||
== GRUB_PCI_ADDR_MEM_TYPE_64)
|
|
||||||
{
|
|
||||||
addr = grub_pci_make_address (dev, reg);
|
|
||||||
space |= ((grub_uint64_t) grub_pci_read (addr)) << 32;
|
|
||||||
reg += sizeof (grub_uint32_t);
|
|
||||||
grub_printf ("\t64-bit memory space %d at 0x%016llx [%s]\n",
|
|
||||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
|
||||||
/ sizeof (grub_uint32_t)) - 2,
|
|
||||||
(unsigned long long)
|
|
||||||
(space & GRUB_PCI_ADDR_MEM_MASK),
|
|
||||||
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
|
||||||
? "prefetchable" : "non-prefetchable");
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n",
|
|
||||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
|
||||||
/ sizeof (grub_uint32_t)) - 1,
|
|
||||||
(unsigned long long)
|
|
||||||
(space & GRUB_PCI_ADDR_MEM_MASK),
|
|
||||||
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
|
||||||
? "prefetchable" : "non-prefetchable");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_lspci (grub_extcmd_t cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
iospace = cmd->state[0].set;
|
|
||||||
grub_pci_iterate (grub_lspci_iter);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(lspci)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"[-i]", N_("List PCI devices."), options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(lspci)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/* memrw.c - command to read / write physical memory */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
|
||||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
|
||||||
"VARNAME", ARG_TYPE_STRING},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
|
||||||
{
|
|
||||||
grub_target_addr_t addr;
|
|
||||||
grub_uint32_t value = 0;
|
|
||||||
char buf[sizeof ("XXXXXXXX")];
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
|
||||||
|
|
||||||
addr = grub_strtoul (argv[0], 0, 0);
|
|
||||||
switch (cmd->cmd->name[sizeof ("read_") - 1])
|
|
||||||
{
|
|
||||||
case 'd':
|
|
||||||
value = *((volatile grub_uint32_t *) addr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'w':
|
|
||||||
value = *((volatile grub_uint16_t *) addr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
|
||||||
value = *((volatile grub_uint8_t *) addr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd->state[0].set)
|
|
||||||
{
|
|
||||||
grub_snprintf (buf, sizeof (buf), "%x", value);
|
|
||||||
grub_env_set (cmd->state[0].arg, buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("0x%x\n", value);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
|
||||||
{
|
|
||||||
grub_target_addr_t addr;
|
|
||||||
grub_uint32_t value;
|
|
||||||
grub_uint32_t mask = 0xffffffff;
|
|
||||||
|
|
||||||
if (argc != 2 && argc != 3)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
|
||||||
|
|
||||||
addr = grub_strtoul (argv[0], 0, 0);
|
|
||||||
value = grub_strtoul (argv[1], 0, 0);
|
|
||||||
if (argc == 3)
|
|
||||||
mask = grub_strtoul (argv[2], 0, 0);
|
|
||||||
value &= mask;
|
|
||||||
switch (cmd->name[sizeof ("write_") - 1])
|
|
||||||
{
|
|
||||||
case 'd':
|
|
||||||
if (mask != 0xffffffff)
|
|
||||||
*((volatile grub_uint32_t *) addr)
|
|
||||||
= (*((volatile grub_uint32_t *) addr) & ~mask) | value;
|
|
||||||
else
|
|
||||||
*((volatile grub_uint32_t *) addr) = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'w':
|
|
||||||
if ((mask & 0xffff) != 0xffff)
|
|
||||||
*((volatile grub_uint16_t *) addr)
|
|
||||||
= (*((volatile grub_uint16_t *) addr) & ~mask) | value;
|
|
||||||
else
|
|
||||||
*((volatile grub_uint16_t *) addr) = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
|
||||||
if ((mask & 0xff) != 0xff)
|
|
||||||
*((volatile grub_uint8_t *) addr)
|
|
||||||
= (*((volatile grub_uint8_t *) addr) & ~mask) | value;
|
|
||||||
else
|
|
||||||
*((volatile grub_uint8_t *) addr) = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(memrw)
|
|
||||||
{
|
|
||||||
cmd_read_byte =
|
|
||||||
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("ADDR"), N_("Read byte from ADDR."), options);
|
|
||||||
cmd_read_word =
|
|
||||||
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("ADDR"), N_("Read word from ADDR."), options);
|
|
||||||
cmd_read_dword =
|
|
||||||
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("ADDR"), N_("Read dword from ADDR."), options);
|
|
||||||
cmd_write_byte =
|
|
||||||
grub_register_command ("write_byte", grub_cmd_write,
|
|
||||||
N_("ADDR VALUE [MASK]"), N_("Write byte VALUE to ADDR."));
|
|
||||||
cmd_write_word =
|
|
||||||
grub_register_command ("write_word", grub_cmd_write,
|
|
||||||
N_("ADDR VALUE [MASK]"), N_("Write word VALUE to ADDR."));
|
|
||||||
cmd_write_dword =
|
|
||||||
grub_register_command ("write_dword", grub_cmd_write,
|
|
||||||
N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(memrw)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd_read_byte);
|
|
||||||
grub_unregister_extcmd (cmd_read_word);
|
|
||||||
grub_unregister_extcmd (cmd_read_dword);
|
|
||||||
grub_unregister_command (cmd_write_byte);
|
|
||||||
grub_unregister_command (cmd_write_word);
|
|
||||||
grub_unregister_command (cmd_write_dword);
|
|
||||||
}
|
|
||||||
@@ -1,391 +0,0 @@
|
|||||||
/* minicmd.c - commands for the rescue mode */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/loader.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
/* cat FILE */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
grub_ssize_t size;
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
|
||||||
|
|
||||||
file = grub_file_open (argv[0]);
|
|
||||||
if (! file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
unsigned char c = buf[i];
|
|
||||||
|
|
||||||
if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
|
|
||||||
grub_putchar (c);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
|
||||||
grub_printf ("<%x>", (int) c);
|
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_putchar ('\n');
|
|
||||||
grub_refresh ();
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* help */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_command_t p;
|
|
||||||
|
|
||||||
for (p = grub_command_list; p; p = p->next)
|
|
||||||
grub_printf ("%s (%d%c)\t%s\n", p->name,
|
|
||||||
p->prio & GRUB_PRIO_LIST_PRIO_MASK,
|
|
||||||
(p->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) ? '+' : '-',
|
|
||||||
p->description);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
grub_rescue_cmd_info (void)
|
|
||||||
{
|
|
||||||
extern void grub_disk_cache_get_performance (unsigned long *,
|
|
||||||
unsigned long *);
|
|
||||||
unsigned long hits, misses;
|
|
||||||
|
|
||||||
grub_disk_cache_get_performance (&hits, &misses);
|
|
||||||
grub_printf ("Disk cache: hits = %u, misses = %u ", hits, misses);
|
|
||||||
if (hits + misses)
|
|
||||||
{
|
|
||||||
unsigned long ratio = hits * 10000 / (hits + misses);
|
|
||||||
grub_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("(N/A)\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* root [DEVICE] */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_root (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
grub_fs_t fs;
|
|
||||||
|
|
||||||
if (argc > 0)
|
|
||||||
{
|
|
||||||
char *device_name = grub_file_get_device_name (argv[0]);
|
|
||||||
if (! device_name)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_env_set ("root", device_name);
|
|
||||||
grub_free (device_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
dev = grub_device_open (0);
|
|
||||||
if (! dev)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
grub_printf ("(%s): Filesystem is %s.\n",
|
|
||||||
grub_env_get ("root"), fs ? fs->name : "unknown");
|
|
||||||
|
|
||||||
grub_device_close (dev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
grub_rescue_cmd_testload (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char *buf;
|
|
||||||
grub_ssize_t size;
|
|
||||||
grub_ssize_t pos;
|
|
||||||
auto void read_func (unsigned long sector, unsigned offset, unsigned len);
|
|
||||||
|
|
||||||
void read_func (unsigned long sector __attribute__ ((unused)),
|
|
||||||
unsigned offset __attribute__ ((unused)),
|
|
||||||
unsigned len __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_putchar ('.');
|
|
||||||
grub_refresh ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = grub_file_open (argv[0]);
|
|
||||||
if (! file)
|
|
||||||
return;
|
|
||||||
|
|
||||||
size = grub_file_size (file) & ~(GRUB_DISK_SECTOR_SIZE - 1);
|
|
||||||
if (size == 0)
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = grub_malloc (size);
|
|
||||||
if (! buf)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_printf ("Reading %s sequentially", argv[0]);
|
|
||||||
file->read_hook = read_func;
|
|
||||||
if (grub_file_read (file, buf, size) != size)
|
|
||||||
goto fail;
|
|
||||||
grub_printf (" Done.\n");
|
|
||||||
|
|
||||||
/* Read sequentially again. */
|
|
||||||
grub_printf ("Reading %s sequentially again", argv[0]);
|
|
||||||
if (grub_file_seek (file, 0) < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
for (pos = 0; pos < size; pos += GRUB_DISK_SECTOR_SIZE)
|
|
||||||
{
|
|
||||||
char sector[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
|
|
||||||
if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE)
|
|
||||||
!= GRUB_DISK_SECTOR_SIZE)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0)
|
|
||||||
{
|
|
||||||
grub_printf ("\nDiffers in %d\n", pos);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
grub_printf (" Done.\n");
|
|
||||||
|
|
||||||
/* Read backwards and compare. */
|
|
||||||
grub_printf ("Reading %s backwards", argv[0]);
|
|
||||||
pos = size;
|
|
||||||
while (pos > 0)
|
|
||||||
{
|
|
||||||
char sector[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
|
|
||||||
pos -= GRUB_DISK_SECTOR_SIZE;
|
|
||||||
|
|
||||||
if (grub_file_seek (file, pos) < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE)
|
|
||||||
!= GRUB_DISK_SECTOR_SIZE)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
grub_printf ("\nDiffers in %d\n", pos);
|
|
||||||
|
|
||||||
for (i = 0; i < GRUB_DISK_SECTOR_SIZE; i++)
|
|
||||||
grub_putchar (buf[pos + i]);
|
|
||||||
|
|
||||||
if (i)
|
|
||||||
grub_refresh ();
|
|
||||||
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
grub_printf (" Done.\n");
|
|
||||||
|
|
||||||
fail:
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
grub_free (buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* dump ADDRESS [SIZE] */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_dump (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_uint8_t *addr;
|
|
||||||
grub_size_t size = 4;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no address specified");
|
|
||||||
|
|
||||||
addr = (grub_uint8_t *) grub_strtoul (argv[0], 0, 0);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
size = (grub_size_t) grub_strtoul (argv[1], 0, 0);
|
|
||||||
|
|
||||||
while (size--)
|
|
||||||
{
|
|
||||||
grub_printf ("%x%x ", *addr >> 4, *addr & 0xf);
|
|
||||||
addr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rmmod MODULE */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_rmmod (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
|
|
||||||
|
|
||||||
mod = grub_dl_get (argv[0]);
|
|
||||||
if (! mod)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such module");
|
|
||||||
|
|
||||||
if (grub_dl_unref (mod) <= 0)
|
|
||||||
grub_dl_unload (mod);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lsmod */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
auto int print_module (grub_dl_t mod);
|
|
||||||
|
|
||||||
int print_module (grub_dl_t mod)
|
|
||||||
{
|
|
||||||
grub_dl_dep_t dep;
|
|
||||||
|
|
||||||
grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count);
|
|
||||||
for (dep = mod->dep; dep; dep = dep->next)
|
|
||||||
{
|
|
||||||
if (dep != mod->dep)
|
|
||||||
grub_putchar (',');
|
|
||||||
|
|
||||||
grub_printf ("%s", dep->mod->name);
|
|
||||||
}
|
|
||||||
grub_putchar ('\n');
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
|
||||||
grub_dl_iterate (print_module);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exit */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_exit ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clear */
|
|
||||||
static grub_err_t
|
|
||||||
grub_mini_cmd_clear (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_cls ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_cat, cmd_help, cmd_root;
|
|
||||||
static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
|
|
||||||
static grub_command_t cmd_clear;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(minicmd)
|
|
||||||
{
|
|
||||||
cmd_cat =
|
|
||||||
grub_register_command ("cat", grub_mini_cmd_cat,
|
|
||||||
N_("FILE"), N_("Show the contents of a file."));
|
|
||||||
cmd_help =
|
|
||||||
grub_register_command ("help", grub_mini_cmd_help,
|
|
||||||
0, N_("Show this message."));
|
|
||||||
cmd_root =
|
|
||||||
grub_register_command ("root", grub_mini_cmd_root,
|
|
||||||
N_("[DEVICE]"), N_("Set the root device."));
|
|
||||||
cmd_dump =
|
|
||||||
grub_register_command ("dump", grub_mini_cmd_dump,
|
|
||||||
N_("ADDR"), N_("Dump memory."));
|
|
||||||
cmd_rmmod =
|
|
||||||
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
|
||||||
N_("MODULE"), N_("Remove a module."));
|
|
||||||
cmd_lsmod =
|
|
||||||
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
|
|
||||||
0, N_("Show loaded modules."));
|
|
||||||
cmd_exit =
|
|
||||||
grub_register_command ("exit", grub_mini_cmd_exit,
|
|
||||||
0, N_("Exit from GRUB."));
|
|
||||||
cmd_clear =
|
|
||||||
grub_register_command ("clear", grub_mini_cmd_clear,
|
|
||||||
0, N_("Clear the screen."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(minicmd)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_cat);
|
|
||||||
grub_unregister_command (cmd_help);
|
|
||||||
grub_unregister_command (cmd_root);
|
|
||||||
grub_unregister_command (cmd_dump);
|
|
||||||
grub_unregister_command (cmd_rmmod);
|
|
||||||
grub_unregister_command (cmd_lsmod);
|
|
||||||
grub_unregister_command (cmd_exit);
|
|
||||||
grub_unregister_command (cmd_clear);
|
|
||||||
}
|
|
||||||
@@ -1,332 +0,0 @@
|
|||||||
/* parttool.c - common dispatcher and parser for partition operations */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* 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; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/parttool.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static struct grub_parttool *parts = 0;
|
|
||||||
static int curhandle = 0;
|
|
||||||
static grub_dl_t mymod;
|
|
||||||
static char helpmsg[] =
|
|
||||||
"Perform COMMANDS on partition.\n"
|
|
||||||
"Use \"parttool PARTITION help\" for the list "
|
|
||||||
"of available commands.";
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_parttool_register(const char *part_name,
|
|
||||||
const grub_parttool_function_t func,
|
|
||||||
const struct grub_parttool_argdesc *args)
|
|
||||||
{
|
|
||||||
struct grub_parttool *cur;
|
|
||||||
int nargs = 0;
|
|
||||||
|
|
||||||
if (! parts)
|
|
||||||
grub_dl_ref (mymod);
|
|
||||||
|
|
||||||
cur = (struct grub_parttool *) grub_malloc (sizeof (struct grub_parttool));
|
|
||||||
cur->next = parts;
|
|
||||||
cur->name = grub_strdup (part_name);
|
|
||||||
cur->handle = curhandle++;
|
|
||||||
for (nargs = 0; args[nargs].name != 0; nargs++);
|
|
||||||
cur->nargs = nargs;
|
|
||||||
cur->args = (struct grub_parttool_argdesc *)
|
|
||||||
grub_malloc ((nargs + 1) * sizeof (struct grub_parttool_argdesc));
|
|
||||||
grub_memcpy (cur->args, args,
|
|
||||||
(nargs + 1) * sizeof (struct grub_parttool_argdesc));
|
|
||||||
|
|
||||||
cur->func = func;
|
|
||||||
parts = cur;
|
|
||||||
return cur->handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_parttool_unregister (int handle)
|
|
||||||
{
|
|
||||||
struct grub_parttool *prev = 0, *cur, *t;
|
|
||||||
for (cur = parts; cur; )
|
|
||||||
if (cur->handle == handle)
|
|
||||||
{
|
|
||||||
grub_free (cur->args);
|
|
||||||
grub_free (cur->name);
|
|
||||||
if (prev)
|
|
||||||
prev->next = cur->next;
|
|
||||||
else
|
|
||||||
parts = cur->next;
|
|
||||||
t = cur;
|
|
||||||
cur = cur->next;
|
|
||||||
grub_free (t);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
prev = cur;
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
if (! parts)
|
|
||||||
grub_dl_unref (mymod);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
struct grub_parttool *cur, *ptool;
|
|
||||||
int *parsed;
|
|
||||||
int i, j;
|
|
||||||
grub_err_t err = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
auto grub_err_t show_help (void);
|
|
||||||
grub_err_t show_help (void)
|
|
||||||
{
|
|
||||||
int found = 0;
|
|
||||||
for (cur = parts; cur; cur = cur->next)
|
|
||||||
if (grub_strcmp (dev->disk->partition->partmap->name, cur->name) == 0)
|
|
||||||
{
|
|
||||||
struct grub_parttool_argdesc *curarg;
|
|
||||||
found = 1;
|
|
||||||
for (curarg = cur->args; curarg->name; curarg++)
|
|
||||||
{
|
|
||||||
int spacing = 20;
|
|
||||||
|
|
||||||
spacing -= grub_strlen (curarg->name);
|
|
||||||
grub_printf ("%s", curarg->name);
|
|
||||||
|
|
||||||
switch (curarg->type)
|
|
||||||
{
|
|
||||||
case GRUB_PARTTOOL_ARG_BOOL:
|
|
||||||
grub_printf ("+/-");
|
|
||||||
spacing -= 3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_PARTTOOL_ARG_VAL:
|
|
||||||
grub_printf ("=VAL");
|
|
||||||
spacing -= 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_PARTTOOL_ARG_END:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
while (spacing-- > 0)
|
|
||||||
grub_printf (" ");
|
|
||||||
grub_printf ("%s\n", curarg->desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! found)
|
|
||||||
grub_printf ("Sorry no parttool is available for %s\n",
|
|
||||||
dev->disk->partition->partmap->name);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
{
|
|
||||||
grub_printf ("%s\n", helpmsg);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too few arguments");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0][0] == '(' && args[0][grub_strlen (args[0]) - 1] == ')')
|
|
||||||
{
|
|
||||||
args[0][grub_strlen (args[0]) - 1] = 0;
|
|
||||||
dev = grub_device_open (args[0] + 1);
|
|
||||||
args[0][grub_strlen (args[0]) - 1] = ')';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dev = grub_device_open (args[0]);
|
|
||||||
|
|
||||||
if (! dev)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (! dev->disk)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! dev->disk->partition)
|
|
||||||
{
|
|
||||||
grub_device_close (dev);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a partition");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load modules. */
|
|
||||||
#ifndef GRUB_UTIL
|
|
||||||
{
|
|
||||||
const char *prefix;
|
|
||||||
prefix = grub_env_get ("prefix");
|
|
||||||
if (prefix)
|
|
||||||
{
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/parttool.lst", prefix);
|
|
||||||
if (filename)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
file = grub_file_open (filename);
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
char *buf = 0;
|
|
||||||
for (;; grub_free(buf))
|
|
||||||
{
|
|
||||||
char *p, *name;
|
|
||||||
|
|
||||||
buf = grub_file_getline (file);
|
|
||||||
|
|
||||||
if (! buf)
|
|
||||||
break;
|
|
||||||
|
|
||||||
name = buf;
|
|
||||||
|
|
||||||
if (! grub_isgraph (name[0]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = grub_strchr (name, ':');
|
|
||||||
if (! p)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
*p = '\0';
|
|
||||||
while (*++p == ' ')
|
|
||||||
;
|
|
||||||
|
|
||||||
if (! grub_isgraph (*p))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (grub_strcmp (name, dev->disk->partition->partmap->name)
|
|
||||||
!= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
grub_dl_load (p);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Ignore errors. */
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc == 1)
|
|
||||||
return show_help ();
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
if (grub_strcmp (args[i], "help") == 0)
|
|
||||||
return show_help ();
|
|
||||||
|
|
||||||
parsed = (int *) grub_zalloc (argc * sizeof (int));
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
if (! parsed[i])
|
|
||||||
{
|
|
||||||
struct grub_parttool_argdesc *curarg;
|
|
||||||
struct grub_parttool_args *pargs;
|
|
||||||
for (cur = parts; cur; cur = cur->next)
|
|
||||||
if (grub_strcmp (dev->disk->partition->partmap->name, cur->name) == 0)
|
|
||||||
{
|
|
||||||
for (curarg = cur->args; curarg->name; curarg++)
|
|
||||||
if (grub_strncmp (curarg->name, args[i],
|
|
||||||
grub_strlen (curarg->name)) == 0
|
|
||||||
&& ((curarg->type == GRUB_PARTTOOL_ARG_BOOL
|
|
||||||
&& (args[i][grub_strlen (curarg->name)] == '+'
|
|
||||||
|| args[i][grub_strlen (curarg->name)] == '-'
|
|
||||||
|| args[i][grub_strlen (curarg->name)] == 0))
|
|
||||||
|| (curarg->type == GRUB_PARTTOOL_ARG_VAL
|
|
||||||
&& args[i][grub_strlen (curarg->name)] == '=')))
|
|
||||||
|
|
||||||
break;
|
|
||||||
if (curarg->name)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (! cur)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unrecognised argument %s",
|
|
||||||
args[i]);
|
|
||||||
ptool = cur;
|
|
||||||
pargs = (struct grub_parttool_args *)
|
|
||||||
grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args));
|
|
||||||
for (j = i; j < argc; j++)
|
|
||||||
if (! parsed[j])
|
|
||||||
{
|
|
||||||
for (curarg = ptool->args; curarg->name; curarg++)
|
|
||||||
if (grub_strncmp (curarg->name, args[i],
|
|
||||||
grub_strlen (curarg->name)) == 0
|
|
||||||
&& ((curarg->type == GRUB_PARTTOOL_ARG_BOOL
|
|
||||||
&& (args[j][grub_strlen (curarg->name)] == '+'
|
|
||||||
|| args[j][grub_strlen (curarg->name)] == '-'
|
|
||||||
|| args[j][grub_strlen (curarg->name)] == 0))
|
|
||||||
|| (curarg->type == GRUB_PARTTOOL_ARG_VAL
|
|
||||||
&& args[j][grub_strlen (curarg->name)] == '=')))
|
|
||||||
{
|
|
||||||
parsed[j] = 1;
|
|
||||||
pargs[curarg - ptool->args].set = 1;
|
|
||||||
switch (curarg->type)
|
|
||||||
{
|
|
||||||
case GRUB_PARTTOOL_ARG_BOOL:
|
|
||||||
pargs[curarg - ptool->args].bool
|
|
||||||
= (args[j][grub_strlen (curarg->name)] != '-');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_PARTTOOL_ARG_VAL:
|
|
||||||
pargs[curarg - ptool->args].str
|
|
||||||
= (args[j] + grub_strlen (curarg->name) + 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_PARTTOOL_ARG_END:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = ptool->func (dev, pargs);
|
|
||||||
grub_free (pargs);
|
|
||||||
if (err)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (parsed);
|
|
||||||
grub_device_close (dev);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(parttool)
|
|
||||||
{
|
|
||||||
mymod = mod;
|
|
||||||
cmd = grub_register_command ("parttool", grub_cmd_parttool,
|
|
||||||
N_("PARTITION COMMANDS"),
|
|
||||||
helpmsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(parttool)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/auth.h>
|
|
||||||
#include <grub/crypto.h>
|
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
check_password (const char *user, const char *entered,
|
|
||||||
void *password)
|
|
||||||
{
|
|
||||||
if (grub_crypto_memcmp (entered, password, GRUB_AUTH_MAX_PASSLEN) != 0)
|
|
||||||
return GRUB_ACCESS_DENIED;
|
|
||||||
|
|
||||||
grub_auth_authenticate (user);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
char *pass;
|
|
||||||
int copylen;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
|
|
||||||
|
|
||||||
pass = grub_zalloc (GRUB_AUTH_MAX_PASSLEN);
|
|
||||||
if (!pass)
|
|
||||||
return grub_errno;
|
|
||||||
copylen = grub_strlen (args[1]);
|
|
||||||
if (copylen >= GRUB_AUTH_MAX_PASSLEN)
|
|
||||||
copylen = GRUB_AUTH_MAX_PASSLEN - 1;
|
|
||||||
grub_memcpy (pass, args[1], copylen);
|
|
||||||
|
|
||||||
err = grub_auth_register_authentication (args[0], check_password, pass);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (pass);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
grub_dl_ref (my_mod);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(password)
|
|
||||||
{
|
|
||||||
my_mod = mod;
|
|
||||||
cmd = grub_register_command ("password", grub_cmd_password,
|
|
||||||
N_("USER PASSWORD"),
|
|
||||||
N_("Set user password (plaintext). "
|
|
||||||
"Unrecommended and insecure."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(password)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/auth.h>
|
|
||||||
#include <grub/crypto.h>
|
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
|
||||||
|
|
||||||
struct pbkdf2_password
|
|
||||||
{
|
|
||||||
grub_uint8_t *salt;
|
|
||||||
grub_size_t saltlen;
|
|
||||||
unsigned int c;
|
|
||||||
grub_uint8_t *expected;
|
|
||||||
grub_size_t buflen;
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
check_password (const char *user, const char *entered, void *pin)
|
|
||||||
{
|
|
||||||
grub_uint8_t *buf;
|
|
||||||
struct pbkdf2_password *pass = pin;
|
|
||||||
gcry_err_code_t err;
|
|
||||||
|
|
||||||
buf = grub_malloc (pass->buflen);
|
|
||||||
if (!buf)
|
|
||||||
return grub_crypto_gcry_error (GPG_ERR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
err = grub_crypto_pbkdf2 (GRUB_MD_SHA512, (grub_uint8_t *) entered,
|
|
||||||
grub_strlen (entered),
|
|
||||||
pass->salt, pass->saltlen, pass->c,
|
|
||||||
buf, pass->buflen);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (buf);
|
|
||||||
return grub_crypto_gcry_error (err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
|
|
||||||
return GRUB_ACCESS_DENIED;
|
|
||||||
|
|
||||||
grub_auth_authenticate (user);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hex2val (char hex)
|
|
||||||
{
|
|
||||||
if ('0' <= hex && hex <= '9')
|
|
||||||
return hex - '0';
|
|
||||||
if ('a' <= hex && hex <= 'f')
|
|
||||||
return hex - 'a' + 10;
|
|
||||||
if ('A' <= hex && hex <= 'F')
|
|
||||||
return hex - 'A' + 10;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
char *ptr, *ptr2;
|
|
||||||
grub_uint8_t *ptro;
|
|
||||||
struct pbkdf2_password *pass;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
|
|
||||||
|
|
||||||
if (grub_memcmp (args[1], "grub.pbkdf2.sha512.",
|
|
||||||
sizeof ("grub.pbkdf2.sha512.") - 1) != 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
|
||||||
|
|
||||||
ptr = args[1] + sizeof ("grub.pbkdf2.sha512.") - 1;
|
|
||||||
|
|
||||||
pass = grub_malloc (sizeof (*pass));
|
|
||||||
if (!pass)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
pass->c = grub_strtoul (ptr, &ptr, 0);
|
|
||||||
if (*ptr != '.')
|
|
||||||
{
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
|
||||||
}
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
ptr2 = grub_strchr (ptr, '.');
|
|
||||||
if (!ptr2 || ((ptr2 - ptr) & 1) || grub_strlen (ptr2 + 1) & 1)
|
|
||||||
{
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
|
||||||
}
|
|
||||||
|
|
||||||
pass->saltlen = (ptr2 - ptr) >> 1;
|
|
||||||
pass->buflen = grub_strlen (ptr2 + 1) >> 1;
|
|
||||||
ptro = pass->salt = grub_malloc (pass->saltlen);
|
|
||||||
if (!ptro)
|
|
||||||
{
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
while (ptr < ptr2)
|
|
||||||
{
|
|
||||||
int hex1, hex2;
|
|
||||||
hex1 = hex2val (*ptr);
|
|
||||||
ptr++;
|
|
||||||
hex2 = hex2val (*ptr);
|
|
||||||
ptr++;
|
|
||||||
if (hex1 < 0 || hex2 < 0)
|
|
||||||
{
|
|
||||||
grub_free (pass->salt);
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"Incorrect PBKDF2 password.");
|
|
||||||
}
|
|
||||||
|
|
||||||
*ptro = (hex1 << 4) | hex2;
|
|
||||||
ptro++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptro = pass->expected = grub_malloc (pass->buflen);
|
|
||||||
if (!ptro)
|
|
||||||
{
|
|
||||||
grub_free (pass->salt);
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
ptr = ptr2 + 1;
|
|
||||||
ptr2 += grub_strlen (ptr2);
|
|
||||||
while (ptr < ptr2)
|
|
||||||
{
|
|
||||||
int hex1, hex2;
|
|
||||||
hex1 = hex2val (*ptr);
|
|
||||||
ptr++;
|
|
||||||
hex2 = hex2val (*ptr);
|
|
||||||
ptr++;
|
|
||||||
if (hex1 < 0 || hex2 < 0)
|
|
||||||
{
|
|
||||||
grub_free (pass->expected);
|
|
||||||
grub_free (pass->salt);
|
|
||||||
grub_free (pass);
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"Incorrect PBKDF2 password.");
|
|
||||||
}
|
|
||||||
|
|
||||||
*ptro = (hex1 << 4) | hex2;
|
|
||||||
ptro++;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_auth_register_authentication (args[0], check_password, pass);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (pass);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
grub_dl_ref (my_mod);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(password_pbkdf2)
|
|
||||||
{
|
|
||||||
my_mod = mod;
|
|
||||||
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
|
||||||
"password_pbkdf2 USER PBKDF2_PASSWORD",
|
|
||||||
"Set user password (PBKDF2). ");
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(password_pbkdf2)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
#include <grub/net.h>
|
|
||||||
#include <grub/fs.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
|
||||||
N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING},
|
|
||||||
{"driver", 'd', 0, N_("Determine driver."), 0, 0},
|
|
||||||
{"partmap", 'p', 0, N_("Determine partition map type."), 0, 0},
|
|
||||||
{"fs", 'f', 0, N_("Determine filesystem type."), 0, 0},
|
|
||||||
{"fs-uuid", 'u', 0, N_("Determine filesystem UUID."), 0, 0},
|
|
||||||
{"label", 'l', 0, N_("Determine filesystem label."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_probe (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
grub_device_t dev;
|
|
||||||
grub_fs_t fs;
|
|
||||||
char *ptr;
|
|
||||||
grub_err_t err;
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
|
|
||||||
|
|
||||||
ptr = args[0] + grub_strlen (args[0]) - 1;
|
|
||||||
if (args[0][0] == '(' && *ptr == ')')
|
|
||||||
{
|
|
||||||
*ptr = 0;
|
|
||||||
dev = grub_device_open (args[0] + 1);
|
|
||||||
*ptr = ')';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dev = grub_device_open (args[0]);
|
|
||||||
if (! dev)
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "couldn't open device");
|
|
||||||
|
|
||||||
if (state[1].set)
|
|
||||||
{
|
|
||||||
const char *val = "none";
|
|
||||||
if (dev->net)
|
|
||||||
val = dev->net->dev->name;
|
|
||||||
if (dev->disk)
|
|
||||||
val = dev->disk->dev->name;
|
|
||||||
if (state[0].set)
|
|
||||||
grub_env_set (state[0].arg, val);
|
|
||||||
else
|
|
||||||
grub_printf ("%s", val);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
if (state[2].set)
|
|
||||||
{
|
|
||||||
const char *val = "none";
|
|
||||||
if (dev->disk && dev->disk->partition)
|
|
||||||
val = dev->disk->partition->partmap->name;
|
|
||||||
if (state[0].set)
|
|
||||||
grub_env_set (state[0].arg, val);
|
|
||||||
else
|
|
||||||
grub_printf ("%s", val);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
if (! fs)
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_FS, "unrecognised fs");
|
|
||||||
if (state[3].set)
|
|
||||||
{
|
|
||||||
if (state[0].set)
|
|
||||||
grub_env_set (state[0].arg, fs->name);
|
|
||||||
else
|
|
||||||
grub_printf ("%s", fs->name);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
if (state[4].set)
|
|
||||||
{
|
|
||||||
char *uuid;
|
|
||||||
if (! fs->uuid)
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
"uuid for this FS isn't supported yet");
|
|
||||||
err = fs->uuid (dev, &uuid);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
if (! uuid)
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
"uuid for this FS isn't supported yet");
|
|
||||||
|
|
||||||
if (state[0].set)
|
|
||||||
grub_env_set (state[0].arg, uuid);
|
|
||||||
else
|
|
||||||
grub_printf ("%s", uuid);
|
|
||||||
grub_free (uuid);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
if (state[5].set)
|
|
||||||
{
|
|
||||||
char *label;
|
|
||||||
if (! fs->label)
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
"label for this FS isn't supported yet");
|
|
||||||
err = fs->label (dev, &label);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
if (! label)
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
"uuid for this FS isn't supported yet");
|
|
||||||
|
|
||||||
if (state[0].set)
|
|
||||||
grub_env_set (state[0].arg, label);
|
|
||||||
else
|
|
||||||
grub_printf ("%s", label);
|
|
||||||
grub_free (label);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unrecognised target");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (probe)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("[DEVICE]"),
|
|
||||||
N_("Retrieve device info."), options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (probe)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/* read.c - Command to read variables from user. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static char *
|
|
||||||
grub_getline (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char *line;
|
|
||||||
char *tmp;
|
|
||||||
char c;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
line = grub_malloc (1 + i + sizeof('\0'));
|
|
||||||
if (! line)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
c = grub_getkey ();
|
|
||||||
if ((c == '\n') || (c == '\r'))
|
|
||||||
break;
|
|
||||||
|
|
||||||
line[i] = c;
|
|
||||||
if (grub_isprint (c))
|
|
||||||
grub_putchar (c);
|
|
||||||
i++;
|
|
||||||
tmp = grub_realloc (line, 1 + i + sizeof('\0'));
|
|
||||||
if (! tmp)
|
|
||||||
{
|
|
||||||
grub_free (line);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
line = tmp;
|
|
||||||
}
|
|
||||||
line[i] = '\0';
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_read (grub_command_t cmd __attribute__ ((unused)), int argc, char **args)
|
|
||||||
{
|
|
||||||
char *line = grub_getline ();
|
|
||||||
if (! line)
|
|
||||||
return grub_errno;
|
|
||||||
if (argc > 0)
|
|
||||||
grub_env_set (args[0], line);
|
|
||||||
|
|
||||||
grub_free (line);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(read)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("read", grub_cmd_read,
|
|
||||||
N_("[ENVVAR]"),
|
|
||||||
N_("Set variable with user input."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(read)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/* reboot.c - command to reboot the computer. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_reboot ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(reboot)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("reboot", grub_cmd_reboot,
|
|
||||||
0, N_("Reboot the computer."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(reboot)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
/* search.c - search devices based on a file or a filesystem label */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/search.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
FUNC_NAME (const char *key, const char *var, int no_floppy)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
grub_fs_autoload_hook_t saved_autoload;
|
|
||||||
|
|
||||||
auto int iterate_device (const char *name);
|
|
||||||
int iterate_device (const char *name)
|
|
||||||
{
|
|
||||||
int found = 0;
|
|
||||||
|
|
||||||
/* Skip floppy drives when requested. */
|
|
||||||
if (no_floppy &&
|
|
||||||
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FILE
|
|
||||||
{
|
|
||||||
char *buf;
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
buf = grub_xasprintf ("(%s)%s", name, key);
|
|
||||||
if (! buf)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
file = grub_file_open (buf);
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
found = 1;
|
|
||||||
grub_file_close (file);
|
|
||||||
}
|
|
||||||
grub_free (buf);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
/* SEARCH_FS_UUID or SEARCH_LABEL */
|
|
||||||
grub_device_t dev;
|
|
||||||
grub_fs_t fs;
|
|
||||||
char *quid;
|
|
||||||
|
|
||||||
dev = grub_device_open (name);
|
|
||||||
if (dev)
|
|
||||||
{
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FS_UUID
|
|
||||||
#define compare_fn grub_strcasecmp
|
|
||||||
#define read_fn uuid
|
|
||||||
#else
|
|
||||||
#define compare_fn grub_strcmp
|
|
||||||
#define read_fn label
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fs && fs->read_fn)
|
|
||||||
{
|
|
||||||
fs->read_fn (dev, &quid);
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && quid)
|
|
||||||
{
|
|
||||||
if (compare_fn (quid, key) == 0)
|
|
||||||
found = 1;
|
|
||||||
|
|
||||||
grub_free (quid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_device_close (dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (found)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
if (var)
|
|
||||||
grub_env_set (var, name);
|
|
||||||
else
|
|
||||||
grub_printf (" %s", name);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
return (found && var);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First try without autoloading if we're setting variable. */
|
|
||||||
if (var)
|
|
||||||
{
|
|
||||||
saved_autoload = grub_fs_autoload_hook;
|
|
||||||
grub_fs_autoload_hook = 0;
|
|
||||||
grub_device_iterate (iterate_device);
|
|
||||||
|
|
||||||
/* Restore autoload hook. */
|
|
||||||
grub_fs_autoload_hook = saved_autoload;
|
|
||||||
|
|
||||||
/* Retry with autoload if nothing found. */
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
|
||||||
grub_device_iterate (iterate_device);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_device_iterate (iterate_device);
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
|
||||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "no such device: %s", key);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
|
|
||||||
char **args)
|
|
||||||
{
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
|
||||||
|
|
||||||
FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0);
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FILE
|
|
||||||
GRUB_MOD_INIT(search_file)
|
|
||||||
#elif defined (DO_SEARCH_FS_UUID)
|
|
||||||
GRUB_MOD_INIT(search_fs_uuid)
|
|
||||||
#else
|
|
||||||
GRUB_MOD_INIT(search_fs_label)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
cmd =
|
|
||||||
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
|
|
||||||
N_("NAME [VARIABLE]"),
|
|
||||||
HELP_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FILE
|
|
||||||
GRUB_MOD_FINI(search_file)
|
|
||||||
#elif defined (DO_SEARCH_FS_UUID)
|
|
||||||
GRUB_MOD_FINI(search_fs_uuid)
|
|
||||||
#else
|
|
||||||
GRUB_MOD_FINI(search_fs_label)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#define DO_SEARCH_FILE 1
|
|
||||||
#define FUNC_NAME grub_search_fs_file
|
|
||||||
#define COMMAND_NAME "search.file"
|
|
||||||
#define SEARCH_TARGET "file"
|
|
||||||
#define HELP_MESSAGE N_("Search devices by file. If VARIABLE is specified, the first device found is set to a variable.")
|
|
||||||
#include "search.c"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#define DO_SEARCH_FS_LABEL 1
|
|
||||||
#define FUNC_NAME grub_search_label
|
|
||||||
#define COMMAND_NAME "search.fs_label"
|
|
||||||
#define SEARCH_TARGET "filesystem label"
|
|
||||||
#define HELP_MESSAGE N_("Search devices by label. If VARIABLE is specified, the first device found is set to a variable.")
|
|
||||||
#include "search.c"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#define DO_SEARCH_FS_UUID 1
|
|
||||||
#define FUNC_NAME grub_search_fs_uuid
|
|
||||||
#define COMMAND_NAME "search.fs_uuid"
|
|
||||||
#define SEARCH_TARGET "filesystem UUID"
|
|
||||||
#define HELP_MESSAGE N_("Search devices by UUID. If VARIABLE is specified, the first device found is set to a variable.")
|
|
||||||
#include "search.c"
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/* search.c - search devices based on a file or a filesystem label */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/search.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
|
|
||||||
{"label", 'l', 0, N_("Search devices by a filesystem label."),
|
|
||||||
0, 0},
|
|
||||||
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."),
|
|
||||||
0, 0},
|
|
||||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
|
||||||
N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
|
|
||||||
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum options
|
|
||||||
{
|
|
||||||
SEARCH_FILE,
|
|
||||||
SEARCH_LABEL,
|
|
||||||
SEARCH_FS_UUID,
|
|
||||||
SEARCH_SET,
|
|
||||||
SEARCH_NO_FLOPPY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
const char *var = 0;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
|
||||||
|
|
||||||
if (state[SEARCH_SET].set)
|
|
||||||
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
|
|
||||||
|
|
||||||
if (state[SEARCH_LABEL].set)
|
|
||||||
grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
|
||||||
else if (state[SEARCH_FS_UUID].set)
|
|
||||||
grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
|
||||||
else if (state[SEARCH_FILE].set)
|
|
||||||
grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
|
||||||
else
|
|
||||||
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(search)
|
|
||||||
{
|
|
||||||
cmd =
|
|
||||||
grub_register_extcmd ("search", grub_cmd_search,
|
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("search [-f|-l|-u|-s|-n] NAME"),
|
|
||||||
N_("Search devices by file, filesystem label"
|
|
||||||
" or filesystem UUID."
|
|
||||||
" If --set is specified, the first device found is"
|
|
||||||
" set to a variable. If no variable name is"
|
|
||||||
" specified, \"root\" is used."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(search)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
/* lspci.c - List PCI devices. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
|
|
||||||
struct pci_register
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
grub_uint16_t addr;
|
|
||||||
unsigned size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pci_register pci_registers[] =
|
|
||||||
{
|
|
||||||
{"VENDOR_ID", GRUB_PCI_REG_VENDOR , 2},
|
|
||||||
{"DEVICE_ID", GRUB_PCI_REG_DEVICE , 2},
|
|
||||||
{"COMMAND", GRUB_PCI_REG_COMMAND , 2},
|
|
||||||
{"STATUS", GRUB_PCI_REG_STATUS , 2},
|
|
||||||
{"REVISION", GRUB_PCI_REG_REVISION , 1},
|
|
||||||
{"CLASS_PROG", GRUB_PCI_REG_CLASS + 1 , 1},
|
|
||||||
{"CLASS_DEVICE", GRUB_PCI_REG_CLASS + 2 , 2},
|
|
||||||
{"CACHE_LINE_SIZE", GRUB_PCI_REG_CACHELINE , 1},
|
|
||||||
{"LATENCY_TIMER", GRUB_PCI_REG_LAT_TIMER , 1},
|
|
||||||
{"HEADER_TYPE", GRUB_PCI_REG_HEADER_TYPE , 1},
|
|
||||||
{"BIST", GRUB_PCI_REG_BIST , 1},
|
|
||||||
{"BASE_ADDRESS_0", GRUB_PCI_REG_ADDRESS_REG0, 4},
|
|
||||||
{"BASE_ADDRESS_1", GRUB_PCI_REG_ADDRESS_REG1, 4},
|
|
||||||
{"BASE_ADDRESS_2", GRUB_PCI_REG_ADDRESS_REG2, 4},
|
|
||||||
{"BASE_ADDRESS_3", GRUB_PCI_REG_ADDRESS_REG3, 4},
|
|
||||||
{"BASE_ADDRESS_4", GRUB_PCI_REG_ADDRESS_REG4, 4},
|
|
||||||
{"BASE_ADDRESS_5", GRUB_PCI_REG_ADDRESS_REG5, 4},
|
|
||||||
{"CARDBUS_CIS", GRUB_PCI_REG_CIS_POINTER , 4},
|
|
||||||
{"SUBVENDOR_ID", GRUB_PCI_REG_SUBVENDOR , 2},
|
|
||||||
{"SUBSYSTEM_ID", GRUB_PCI_REG_SUBSYSTEM , 2},
|
|
||||||
{"ROM_ADDRESS", GRUB_PCI_REG_ROM_ADDRESS , 4},
|
|
||||||
{"CAP_POINTER", GRUB_PCI_REG_CAP_POINTER , 1},
|
|
||||||
{"INTERRUPT_LINE", GRUB_PCI_REG_IRQ_LINE , 1},
|
|
||||||
{"INTERRUPT_PIN", GRUB_PCI_REG_IRQ_PIN , 1},
|
|
||||||
{"MIN_GNT", GRUB_PCI_REG_MIN_GNT , 1},
|
|
||||||
{"MAX_LAT", GRUB_PCI_REG_MIN_GNT , 1},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{0, 'd', 0, "Select device by vendor and device IDs.",
|
|
||||||
"[vendor]:[device]", ARG_TYPE_STRING},
|
|
||||||
{0, 's', 0, "Select device by its position on the bus.",
|
|
||||||
"[bus]:[slot][.func]", ARG_TYPE_STRING},
|
|
||||||
{0, 'v', 0, "Save read value into variable VARNAME.",
|
|
||||||
"VARNAME", ARG_TYPE_STRING},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_uint32_t pciid_check_mask, pciid_check_value;
|
|
||||||
static int bus, device, function;
|
|
||||||
static int check_bus, check_device, check_function;
|
|
||||||
static grub_uint32_t write_mask, regwrite;
|
|
||||||
static int regsize;
|
|
||||||
static grub_uint16_t regaddr;
|
|
||||||
static const char *varname;
|
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
|
||||||
grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|
||||||
{
|
|
||||||
grub_uint32_t regval = 0;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
|
|
||||||
if ((pciid & pciid_check_mask) != pciid_check_value)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (check_bus && grub_pci_get_bus (dev) != bus)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (check_device && grub_pci_get_device (dev) != device)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (check_function && grub_pci_get_function (dev) != device)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, regaddr);
|
|
||||||
|
|
||||||
switch (regsize)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
regval = grub_pci_read_byte (addr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
regval = grub_pci_read_word (addr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
regval = grub_pci_read (addr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (varname)
|
|
||||||
{
|
|
||||||
char buf[sizeof ("XXXXXXXX")];
|
|
||||||
grub_snprintf (buf, sizeof (buf), "%x", regval);
|
|
||||||
grub_env_set (varname, buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!write_mask)
|
|
||||||
{
|
|
||||||
grub_printf ("Register %x of %d:%d.%d is %x\n", regaddr,
|
|
||||||
grub_pci_get_bus (dev),
|
|
||||||
grub_pci_get_device (dev),
|
|
||||||
grub_pci_get_function (dev),
|
|
||||||
regval);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
regval = (regval & ~write_mask) | regwrite;
|
|
||||||
|
|
||||||
switch (regsize)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
grub_pci_write_byte (addr, regval);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
grub_pci_write_word (addr, regval);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
grub_pci_write (addr, regval);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_setpci (grub_extcmd_t cmd, int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *ptr;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
pciid_check_value = 0;
|
|
||||||
pciid_check_mask = 0;
|
|
||||||
|
|
||||||
if (cmd->state[0].set)
|
|
||||||
{
|
|
||||||
ptr = cmd->state[0].arg;
|
|
||||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff);
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
ptr = cmd->state[0].arg;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pciid_check_mask |= 0xffff;
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
if (*ptr != ':')
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
|
||||||
ptr++;
|
|
||||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
|
||||||
<< 16;
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
else
|
|
||||||
pciid_check_mask |= 0xffff0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
pciid_check_value &= pciid_check_mask;
|
|
||||||
|
|
||||||
check_bus = check_device = check_function = 0;
|
|
||||||
|
|
||||||
if (cmd->state[1].set)
|
|
||||||
{
|
|
||||||
const char *optr;
|
|
||||||
|
|
||||||
ptr = cmd->state[1].arg;
|
|
||||||
optr = ptr;
|
|
||||||
bus = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
ptr = optr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
check_bus = 1;
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
if (*ptr != ':')
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
|
||||||
ptr++;
|
|
||||||
optr = ptr;
|
|
||||||
device = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
ptr = optr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
check_device = 1;
|
|
||||||
if (*ptr == '.')
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
function = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
check_function = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd->state[2].set)
|
|
||||||
varname = cmd->state[2].arg;
|
|
||||||
else
|
|
||||||
varname = NULL;
|
|
||||||
|
|
||||||
write_mask = 0;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Command expected.");
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Only one command is supported.");
|
|
||||||
|
|
||||||
ptr = argv[0];
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (pci_registers); i++)
|
|
||||||
{
|
|
||||||
if (grub_strncmp (ptr, pci_registers[i].name,
|
|
||||||
grub_strlen (pci_registers[i].name)) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == ARRAY_SIZE (pci_registers))
|
|
||||||
{
|
|
||||||
regsize = 0;
|
|
||||||
regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown register");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
regaddr = pci_registers[i].addr;
|
|
||||||
regsize = pci_registers[i].size;
|
|
||||||
ptr += grub_strlen (pci_registers[i].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (*ptr == '+')
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
regaddr += grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_memcmp (ptr, ".L", sizeof (".L") - 1) == 0
|
|
||||||
|| grub_memcmp (ptr, ".l", sizeof (".l") - 1) == 0)
|
|
||||||
{
|
|
||||||
regsize = 4;
|
|
||||||
ptr += sizeof (".l") - 1;
|
|
||||||
}
|
|
||||||
else if (grub_memcmp (ptr, ".W", sizeof (".W") - 1) == 0
|
|
||||||
|| grub_memcmp (ptr, ".w", sizeof (".w") - 1) == 0)
|
|
||||||
{
|
|
||||||
regsize = 2;
|
|
||||||
ptr += sizeof (".w") - 1;
|
|
||||||
}
|
|
||||||
else if (grub_memcmp (ptr, ".B", sizeof (".B") - 1) == 0
|
|
||||||
|| grub_memcmp (ptr, ".b", sizeof (".b") - 1) == 0)
|
|
||||||
{
|
|
||||||
regsize = 1;
|
|
||||||
ptr += sizeof (".b") - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!regsize)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"Unknown register size.");
|
|
||||||
|
|
||||||
write_mask = 0;
|
|
||||||
if (*ptr == '=')
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
regwrite = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
write_mask = 0xffffffff;
|
|
||||||
if (*ptr == ':')
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
write_mask = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
||||||
if (grub_errno)
|
|
||||||
return grub_errno;
|
|
||||||
write_mask = 0xffffffff;
|
|
||||||
}
|
|
||||||
regwrite &= write_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (write_mask && varname)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"Option -v isn't valid for writes.");
|
|
||||||
|
|
||||||
grub_pci_iterate (grub_setpci_iter);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(setpci)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
|
||||||
"[REGISTER][=VALUE[:MASK]]",
|
|
||||||
"Manipulate PCI devices.", options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(setpci)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/* sleep.c - Command to wait a specified number of seconds. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/machine/time.h>
|
|
||||||
#include <grub/extcmd.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"verbose", 'v', 0, N_("Verbose countdown."), 0, 0},
|
|
||||||
{"interruptible", 'i', 0, N_("Interruptible with ESC."), 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_uint16_t *pos;
|
|
||||||
|
|
||||||
static void
|
|
||||||
do_print (int n)
|
|
||||||
{
|
|
||||||
grub_term_restore_pos (pos);
|
|
||||||
/* NOTE: Do not remove the trailing space characters.
|
|
||||||
They are required to clear the line. */
|
|
||||||
grub_printf ("%d ", n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Based on grub_millisleep() from kern/generic/millisleep.c. */
|
|
||||||
static int
|
|
||||||
grub_interruptible_millisleep (grub_uint32_t ms)
|
|
||||||
{
|
|
||||||
grub_uint64_t start;
|
|
||||||
|
|
||||||
start = grub_get_time_ms ();
|
|
||||||
|
|
||||||
while (grub_get_time_ms () - start < ms)
|
|
||||||
if (grub_checkkey () >= 0 &&
|
|
||||||
GRUB_TERM_ASCII_CHAR (grub_getkey ()) == GRUB_TERM_ESC)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
|
||||||
{
|
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing operand");
|
|
||||||
|
|
||||||
n = grub_strtoul (args[0], 0, 10);
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
{
|
|
||||||
/* Either `0' or broken input. */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = grub_term_save_pos ();
|
|
||||||
|
|
||||||
for (; n; n--)
|
|
||||||
{
|
|
||||||
if (state[0].set)
|
|
||||||
do_print (n);
|
|
||||||
|
|
||||||
if (state[1].set)
|
|
||||||
{
|
|
||||||
if (grub_interruptible_millisleep (1000))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_millisleep (1000);
|
|
||||||
}
|
|
||||||
if (state[0].set)
|
|
||||||
do_print (0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(sleep)
|
|
||||||
{
|
|
||||||
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
|
|
||||||
N_("NUMBER_OF_SECONDS"),
|
|
||||||
N_("Wait for a specified number of seconds."),
|
|
||||||
options);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(sleep)
|
|
||||||
{
|
|
||||||
grub_unregister_extcmd (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
|
||||||
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_term_input_t term;
|
|
||||||
struct grub_term_autoload *aut;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_puts_ (N_ ("Active input terminals:"));
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
grub_printf ("%s ", term->name);
|
|
||||||
grub_printf ("\n");
|
|
||||||
grub_puts_ (N_ ("Available input terminals:"));
|
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
|
||||||
grub_printf ("%s ", term->name);
|
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
|
||||||
modules ever. */
|
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
grub_printf ("%s ", aut->name);
|
|
||||||
}
|
|
||||||
grub_printf ("\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0
|
|
||||||
|| grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i == argc)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
|
||||||
|
|
||||||
for (; i < argc; i++)
|
|
||||||
{
|
|
||||||
int again = 0;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term == 0)
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
break;
|
|
||||||
if (again)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
mod = grub_dl_load (aut->modname);
|
|
||||||
if (mod)
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!aut)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
again = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_inputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
{
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (i == argc)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_inputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
grub_term_output_t term;
|
|
||||||
struct grub_term_autoload *aut;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_puts_ (N_ ("Active output terminals:"));
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
grub_printf ("%s ", term->name);
|
|
||||||
grub_printf ("\n");
|
|
||||||
grub_puts_ (N_ ("Available output terminals:"));
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
grub_printf ("%s ", term->name);
|
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
|
||||||
modules ever. */
|
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
grub_printf ("%s ", aut->name);
|
|
||||||
}
|
|
||||||
grub_printf ("\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0
|
|
||||||
|| grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i == argc)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
|
||||||
|
|
||||||
for (; i < argc; i++)
|
|
||||||
{
|
|
||||||
int again = 0;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term == 0)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
break;
|
|
||||||
if (again)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
mod = grub_dl_load (aut->modname);
|
|
||||||
if (mod)
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!aut)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
again = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (i == argc)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(terminal)
|
|
||||||
{
|
|
||||||
cmd_terminal_input =
|
|
||||||
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
|
||||||
"[--append|--remove] "
|
|
||||||
"[TERMINAL1] [TERMINAL2] ...",
|
|
||||||
"List or select an input terminal.");
|
|
||||||
cmd_terminal_output =
|
|
||||||
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
|
||||||
"[--append|--remove] "
|
|
||||||
"[TERMINAL1] [TERMINAL2] ...",
|
|
||||||
"List or select an output terminal.");
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(terminal)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_terminal_input);
|
|
||||||
grub_unregister_command (cmd_terminal_output);
|
|
||||||
}
|
|
||||||
-433
@@ -1,433 +0,0 @@
|
|||||||
/* test.c -- The test command.. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/fs.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
/* A simple implementation for signed numbers. */
|
|
||||||
static int
|
|
||||||
grub_strtosl (char *arg, char **end, int base)
|
|
||||||
{
|
|
||||||
if (arg[0] == '-')
|
|
||||||
return -grub_strtoul (arg + 1, end, base);
|
|
||||||
return grub_strtoul (arg, end, base);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse a test expression starting from *argn. */
|
|
||||||
static int
|
|
||||||
test_parse (char **args, int *argn, int argc)
|
|
||||||
{
|
|
||||||
int ret = 0, discard = 0, invert = 0;
|
|
||||||
int file_exists;
|
|
||||||
struct grub_dirhook_info file_info;
|
|
||||||
|
|
||||||
auto void update_val (int val);
|
|
||||||
auto void get_fileinfo (char *pathname);
|
|
||||||
|
|
||||||
/* Take care of discarding and inverting. */
|
|
||||||
void update_val (int val)
|
|
||||||
{
|
|
||||||
if (! discard)
|
|
||||||
ret = invert ? ! val : val;
|
|
||||||
invert = discard = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if file exists and fetch its information. */
|
|
||||||
void get_fileinfo (char *path)
|
|
||||||
{
|
|
||||||
char *filename, *pathname;
|
|
||||||
char *device_name;
|
|
||||||
grub_fs_t fs;
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
/* A hook for iterating directories. */
|
|
||||||
auto int find_file (const char *cur_filename,
|
|
||||||
const struct grub_dirhook_info *info);
|
|
||||||
int find_file (const char *cur_filename,
|
|
||||||
const struct grub_dirhook_info *info)
|
|
||||||
{
|
|
||||||
if ((info->case_insensitive ? grub_strcasecmp (cur_filename, filename)
|
|
||||||
: grub_strcmp (cur_filename, filename)) == 0)
|
|
||||||
{
|
|
||||||
file_info = *info;
|
|
||||||
file_exists = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
file_exists = 0;
|
|
||||||
device_name = grub_file_get_device_name (path);
|
|
||||||
dev = grub_device_open (device_name);
|
|
||||||
if (! dev)
|
|
||||||
{
|
|
||||||
grub_free (device_name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
if (! fs)
|
|
||||||
{
|
|
||||||
grub_free (device_name);
|
|
||||||
grub_device_close (dev);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pathname = grub_strchr (path, ')');
|
|
||||||
if (! pathname)
|
|
||||||
pathname = path;
|
|
||||||
else
|
|
||||||
pathname++;
|
|
||||||
|
|
||||||
/* Remove trailing '/'. */
|
|
||||||
while (*pathname && pathname[grub_strlen (pathname) - 1] == '/')
|
|
||||||
pathname[grub_strlen (pathname) - 1] = 0;
|
|
||||||
|
|
||||||
/* Split into path and filename. */
|
|
||||||
filename = grub_strrchr (pathname, '/');
|
|
||||||
if (! filename)
|
|
||||||
{
|
|
||||||
path = grub_strdup ("/");
|
|
||||||
filename = pathname;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filename++;
|
|
||||||
path = grub_strdup (pathname);
|
|
||||||
path[filename - pathname] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* It's the whole device. */
|
|
||||||
if (! *pathname)
|
|
||||||
{
|
|
||||||
file_exists = 1;
|
|
||||||
grub_memset (&file_info, 0, sizeof (file_info));
|
|
||||||
/* Root is always a directory. */
|
|
||||||
file_info.dir = 1;
|
|
||||||
|
|
||||||
/* Fetch writing time. */
|
|
||||||
file_info.mtimeset = 0;
|
|
||||||
if (fs->mtime)
|
|
||||||
{
|
|
||||||
if (! fs->mtime (dev, &file_info.mtime))
|
|
||||||
file_info.mtimeset = 1;
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
(fs->dir) (dev, path, find_file);
|
|
||||||
|
|
||||||
grub_device_close (dev);
|
|
||||||
grub_free (path);
|
|
||||||
grub_free (device_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Here we have the real parsing. */
|
|
||||||
while (*argn < argc)
|
|
||||||
{
|
|
||||||
/* First try 3 argument tests. */
|
|
||||||
if (*argn + 2 < argc)
|
|
||||||
{
|
|
||||||
/* String tests. */
|
|
||||||
if (grub_strcmp (args[*argn + 1], "=") == 0
|
|
||||||
|| grub_strcmp (args[*argn + 1], "==") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) == 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "!=") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) != 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GRUB extension: lexicographical sorting. */
|
|
||||||
if (grub_strcmp (args[*argn + 1], "<") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) < 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "<=") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) <= 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], ">") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) > 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], ">=") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strcmp (args[*argn], args[*argn + 2]) >= 0);
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Number tests. */
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-eq") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
== grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-ge") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
>= grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-gt") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
> grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-le") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
<= grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-lt") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
< grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-ne") == 0)
|
|
||||||
{
|
|
||||||
update_val (grub_strtosl (args[*argn], 0, 0)
|
|
||||||
!= grub_strtosl (args[*argn + 2], 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GRUB extension: compare numbers skipping prefixes.
|
|
||||||
Useful for comparing versions. E.g. vmlinuz-2 -plt vmlinuz-11. */
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-pgt") == 0
|
|
||||||
|| grub_strcmp (args[*argn + 1], "-plt") == 0)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
/* Skip common prefix. */
|
|
||||||
for (i = 0; args[*argn][i] == args[*argn + 2][i]
|
|
||||||
&& args[*argn][i]; i++);
|
|
||||||
|
|
||||||
/* Go the digits back. */
|
|
||||||
i--;
|
|
||||||
while (grub_isdigit (args[*argn][i]) && i > 0)
|
|
||||||
i--;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn + 1], "-pgt") == 0)
|
|
||||||
update_val (grub_strtoul (args[*argn] + i, 0, 0)
|
|
||||||
> grub_strtoul (args[*argn + 2] + i, 0, 0));
|
|
||||||
else
|
|
||||||
update_val (grub_strtoul (args[*argn] + i, 0, 0)
|
|
||||||
< grub_strtoul (args[*argn + 2] + i, 0, 0));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -nt and -ot tests. GRUB extension: when doing -?t<bias> bias
|
|
||||||
will be added to the first mtime. */
|
|
||||||
if (grub_memcmp (args[*argn + 1], "-nt", 3) == 0
|
|
||||||
|| grub_memcmp (args[*argn + 1], "-ot", 3) == 0)
|
|
||||||
{
|
|
||||||
struct grub_dirhook_info file1;
|
|
||||||
int file1exists;
|
|
||||||
int bias = 0;
|
|
||||||
|
|
||||||
/* Fetch fileinfo. */
|
|
||||||
get_fileinfo (args[*argn]);
|
|
||||||
file1 = file_info;
|
|
||||||
file1exists = file_exists;
|
|
||||||
get_fileinfo (args[*argn + 2]);
|
|
||||||
|
|
||||||
if (args[*argn + 1][3])
|
|
||||||
bias = grub_strtosl (args[*argn + 1] + 3, 0, 0);
|
|
||||||
|
|
||||||
if (grub_memcmp (args[*argn + 1], "-nt", 3) == 0)
|
|
||||||
update_val ((file1exists && ! file_exists)
|
|
||||||
|| (file1.mtimeset && file_info.mtimeset
|
|
||||||
&& file1.mtime + bias > file_info.mtime));
|
|
||||||
else
|
|
||||||
update_val ((! file1exists && file_exists)
|
|
||||||
|| (file1.mtimeset && file_info.mtimeset
|
|
||||||
&& file1.mtime + bias < file_info.mtime));
|
|
||||||
(*argn) += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Two-argument tests. */
|
|
||||||
if (*argn + 1 < argc)
|
|
||||||
{
|
|
||||||
/* File tests. */
|
|
||||||
if (grub_strcmp (args[*argn], "-d") == 0)
|
|
||||||
{
|
|
||||||
get_fileinfo (args[*argn + 1]);
|
|
||||||
update_val (file_exists && file_info.dir);
|
|
||||||
(*argn) += 2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn], "-e") == 0)
|
|
||||||
{
|
|
||||||
get_fileinfo (args[*argn + 1]);
|
|
||||||
update_val (file_exists);
|
|
||||||
(*argn) += 2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn], "-f") == 0)
|
|
||||||
{
|
|
||||||
get_fileinfo (args[*argn + 1]);
|
|
||||||
/* FIXME: check for other types. */
|
|
||||||
update_val (file_exists && ! file_info.dir);
|
|
||||||
(*argn) += 2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn], "-s") == 0)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
file = grub_file_open (args[*argn + 1]);
|
|
||||||
update_val (file && (grub_file_size (file) != 0));
|
|
||||||
if (file)
|
|
||||||
grub_file_close (file);
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
(*argn) += 2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* String tests. */
|
|
||||||
if (grub_strcmp (args[*argn], "-n") == 0)
|
|
||||||
{
|
|
||||||
update_val (args[*argn + 1][0]);
|
|
||||||
|
|
||||||
(*argn) += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (grub_strcmp (args[*argn], "-z") == 0)
|
|
||||||
{
|
|
||||||
update_val (! args[*argn + 1][0]);
|
|
||||||
(*argn) += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Special modifiers. */
|
|
||||||
|
|
||||||
/* End of expression. return to parent. */
|
|
||||||
if (grub_strcmp (args[*argn], ")") == 0)
|
|
||||||
{
|
|
||||||
(*argn)++;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
/* Recursively invoke if parenthesis. */
|
|
||||||
if (grub_strcmp (args[*argn], "(") == 0)
|
|
||||||
{
|
|
||||||
(*argn)++;
|
|
||||||
update_val (test_parse (args, argn, argc));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[*argn], "!") == 0)
|
|
||||||
{
|
|
||||||
invert = ! invert;
|
|
||||||
(*argn)++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (grub_strcmp (args[*argn], "-a") == 0)
|
|
||||||
{
|
|
||||||
/* If current value is 0 second value is to be discarded. */
|
|
||||||
discard = ! ret;
|
|
||||||
(*argn)++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (grub_strcmp (args[*argn], "-o") == 0)
|
|
||||||
{
|
|
||||||
/* If current value is 1 second value is to be discarded. */
|
|
||||||
discard = ret;
|
|
||||||
(*argn)++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No test found. Interpret if as just a string. */
|
|
||||||
update_val (args[*argn][0]);
|
|
||||||
(*argn)++;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_test (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
int argn = 0;
|
|
||||||
|
|
||||||
if (argc >= 1 && grub_strcmp (args[argc - 1], "]") == 0)
|
|
||||||
argc--;
|
|
||||||
|
|
||||||
return test_parse (args, &argn, argc) ? GRUB_ERR_NONE
|
|
||||||
: grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_1, cmd_2;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(test)
|
|
||||||
{
|
|
||||||
cmd_1 = grub_register_command ("[", grub_cmd_test,
|
|
||||||
N_("EXPRESSION ]"), N_("Evaluate an expression."));
|
|
||||||
cmd_2 = grub_register_command ("test", grub_cmd_test,
|
|
||||||
N_("EXPRESSION"), N_("Evaluate an expression."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(test)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_1);
|
|
||||||
grub_unregister_command (cmd_2);
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/* true.c - true and false commands. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_false (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char *argv[] __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_true, cmd_false;
|
|
||||||
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(true)
|
|
||||||
{
|
|
||||||
cmd_true =
|
|
||||||
grub_register_command ("true", grub_cmd_true,
|
|
||||||
0, N_("Do nothing, successfully."));
|
|
||||||
cmd_false =
|
|
||||||
grub_register_command ("false", grub_cmd_false,
|
|
||||||
0, N_("Do nothing, unsuccessfully."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(true)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_true);
|
|
||||||
grub_unregister_command (cmd_false);
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
/* usbtest.c - test module for USB */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/charset.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/usb.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static const char *usb_classes[] =
|
|
||||||
{
|
|
||||||
"",
|
|
||||||
"Audio",
|
|
||||||
"Communication Interface",
|
|
||||||
"HID",
|
|
||||||
"",
|
|
||||||
"Physical",
|
|
||||||
"Image",
|
|
||||||
"Printer",
|
|
||||||
"Mass Storage",
|
|
||||||
"Hub",
|
|
||||||
"Data Interface",
|
|
||||||
"Smart Card",
|
|
||||||
"Content Security",
|
|
||||||
"Video"
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *usb_endp_type[] =
|
|
||||||
{
|
|
||||||
"Control",
|
|
||||||
"Isochronous",
|
|
||||||
"Bulk",
|
|
||||||
"Interrupt"
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *usb_devspeed[] =
|
|
||||||
{
|
|
||||||
"",
|
|
||||||
"Low",
|
|
||||||
"Full",
|
|
||||||
"High"
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_usb_err_t
|
|
||||||
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
|
|
||||||
char **string)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_str descstr;
|
|
||||||
struct grub_usb_desc_str *descstrp;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
|
|
||||||
/* Only get the length. */
|
|
||||||
err = grub_usb_control_msg (dev, 1 << 7,
|
|
||||||
0x06, (3 << 8) | index,
|
|
||||||
langid, 1, (char *) &descstr);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
descstrp = grub_malloc (descstr.length);
|
|
||||||
if (! descstrp)
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
err = grub_usb_control_msg (dev, 1 << 7,
|
|
||||||
0x06, (3 << 8) | index,
|
|
||||||
langid, descstr.length, (char *) descstrp);
|
|
||||||
|
|
||||||
*string = grub_malloc (descstr.length / 2);
|
|
||||||
if (! *string)
|
|
||||||
{
|
|
||||||
grub_free (descstrp);
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
|
|
||||||
(*string)[descstr.length / 2 - 1] = '\0';
|
|
||||||
grub_free (descstrp);
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
grub_usb_err_t err;
|
|
||||||
/* XXX: LANGID */
|
|
||||||
|
|
||||||
if (! idx)
|
|
||||||
return;
|
|
||||||
|
|
||||||
err = grub_usb_get_string (dev, idx, 0x0409, &name);
|
|
||||||
if (err)
|
|
||||||
grub_printf ("Error %d retrieving %s\n", err, description);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_printf ("%s: `%s'\n", description, name);
|
|
||||||
grub_free (name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
usb_iterate (grub_usb_device_t dev)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_device *descdev;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
descdev = &dev->descdev;
|
|
||||||
|
|
||||||
usb_print_str ("Product", dev, descdev->strprod);
|
|
||||||
usb_print_str ("Vendor", dev, descdev->strvendor);
|
|
||||||
usb_print_str ("Serial", dev, descdev->strserial);
|
|
||||||
|
|
||||||
if (descdev->class > 0 && descdev->class <= 0x0E)
|
|
||||||
grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n",
|
|
||||||
descdev->class, usb_classes[descdev->class],
|
|
||||||
descdev->subclass, descdev->protocol);
|
|
||||||
grub_printf ("USB version %d.%d, VendorID: 0x%02x, ProductID: 0x%02x, #conf: %d\n",
|
|
||||||
descdev->usbrel >> 8, (descdev->usbrel >> 4) & 0x0F,
|
|
||||||
descdev->vendorid, descdev->prodid, descdev->configcnt);
|
|
||||||
|
|
||||||
grub_printf ("%s speed device\n", usb_devspeed[dev->speed]);
|
|
||||||
|
|
||||||
for (i = 0; i < descdev->configcnt; i++)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_config *config;
|
|
||||||
|
|
||||||
config = dev->config[i].descconf;
|
|
||||||
usb_print_str ("Configuration:", dev, config->strconfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < dev->config[0].descconf->numif; i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
struct grub_usb_desc_if *interf;
|
|
||||||
interf = dev->config[0].interf[i].descif;
|
|
||||||
|
|
||||||
grub_printf ("Interface #%d: #Endpoints: %d ",
|
|
||||||
i, interf->endpointcnt);
|
|
||||||
if (interf->class > 0 && interf->class <= 0x0E)
|
|
||||||
grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n",
|
|
||||||
interf->class, usb_classes[interf->class],
|
|
||||||
interf->subclass, interf->protocol);
|
|
||||||
|
|
||||||
usb_print_str ("Interface", dev, interf->strif);
|
|
||||||
|
|
||||||
for (j = 0; j < interf->endpointcnt; j++)
|
|
||||||
{
|
|
||||||
struct grub_usb_desc_endp *endp;
|
|
||||||
endp = &dev->config[0].interf[i].descendp[j];
|
|
||||||
|
|
||||||
grub_printf ("Endpoint #%d: %s, max packed size: %d, transfer type: %s, latency: %d\n",
|
|
||||||
endp->endp_addr & 15,
|
|
||||||
(endp->endp_addr & 128) ? "IN" : "OUT",
|
|
||||||
endp->maxpacket, usb_endp_type[endp->attrib & 3],
|
|
||||||
endp->interval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf("\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_usbtest (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_printf ("USB devices:\n\n");
|
|
||||||
grub_usb_iterate (usb_iterate);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(usbtest)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("usb", grub_cmd_usbtest,
|
|
||||||
0, N_("Test USB support."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(usbtest)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2006,2007,2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/video.h>
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/font.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
grub_video_color_t color;
|
|
||||||
unsigned int x;
|
|
||||||
unsigned int y;
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
int i;
|
|
||||||
grub_font_t sansbig;
|
|
||||||
grub_font_t sans;
|
|
||||||
grub_font_t sanssmall;
|
|
||||||
grub_font_t fixed;
|
|
||||||
struct grub_font_glyph *glyph;
|
|
||||||
struct grub_video_render_target *text_layer;
|
|
||||||
grub_video_color_t palette[16];
|
|
||||||
const char *str;
|
|
||||||
int texty;
|
|
||||||
|
|
||||||
err = grub_video_set_mode ("auto", GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
grub_video_get_viewport (&x, &y, &width, &height);
|
|
||||||
|
|
||||||
grub_video_create_render_target (&text_layer, width, height,
|
|
||||||
GRUB_VIDEO_MODE_TYPE_RGB
|
|
||||||
| GRUB_VIDEO_MODE_TYPE_ALPHA);
|
|
||||||
|
|
||||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
|
||||||
|
|
||||||
color = grub_video_map_rgb (0, 0, 0);
|
|
||||||
grub_video_fill_rect (color, 0, 0, width, height);
|
|
||||||
|
|
||||||
color = grub_video_map_rgb (255, 0, 0);
|
|
||||||
grub_video_fill_rect (color, 0, 0, 100, 100);
|
|
||||||
|
|
||||||
color = grub_video_map_rgb (0, 255, 255);
|
|
||||||
grub_video_fill_rect (color, 100, 100, 100, 100);
|
|
||||||
|
|
||||||
sansbig = grub_font_get ("Unknown Regular 16");
|
|
||||||
sans = grub_font_get ("Unknown Regular 16");
|
|
||||||
sanssmall = grub_font_get ("Unknown Regular 16");
|
|
||||||
fixed = grub_font_get ("Fixed 20");
|
|
||||||
if (! sansbig || ! sans || ! sanssmall || ! fixed)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
|
|
||||||
|
|
||||||
glyph = grub_font_get_glyph (fixed, '*');
|
|
||||||
grub_font_draw_glyph (glyph, color, 200 ,0);
|
|
||||||
|
|
||||||
grub_video_set_viewport (x + 150, y + 150,
|
|
||||||
width - 150 * 2, height - 150 * 2);
|
|
||||||
color = grub_video_map_rgb (77, 33, 77);
|
|
||||||
grub_video_fill_rect (color, 0, 0, width, height);
|
|
||||||
|
|
||||||
grub_video_set_active_render_target (text_layer);
|
|
||||||
|
|
||||||
color = grub_video_map_rgb (255, 255, 255);
|
|
||||||
|
|
||||||
texty = 32;
|
|
||||||
grub_font_draw_string ("The quick brown fox jumped over the lazy dog.",
|
|
||||||
sans, color, 16, texty);
|
|
||||||
texty += grub_font_get_descent (sans) + grub_font_get_leading (sans);
|
|
||||||
|
|
||||||
texty += grub_font_get_ascent (fixed);
|
|
||||||
grub_font_draw_string ("The quick brown fox jumped over the lazy dog.",
|
|
||||||
fixed, color, 16, texty);
|
|
||||||
texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed);
|
|
||||||
|
|
||||||
/* To convert Unicode characters into UTF-8 for this test, the following
|
|
||||||
command is useful:
|
|
||||||
echo -ne '\x00\x00\x26\x3A' | iconv -f UTF-32BE -t UTF-8 | od -t x1
|
|
||||||
This converts the Unicode character U+263A to UTF-8. */
|
|
||||||
|
|
||||||
/* Characters used:
|
|
||||||
Code point Description UTF-8 encoding
|
|
||||||
----------- ------------------------------ --------------
|
|
||||||
U+263A unfilled smiley face E2 98 BA
|
|
||||||
U+00A1 inverted exclamation point C2 A1
|
|
||||||
U+00A3 British pound currency symbol C2 A3
|
|
||||||
U+03C4 Greek tau CF 84
|
|
||||||
U+00E4 lowercase letter a with umlaut C3 A4
|
|
||||||
U+2124 set 'Z' symbol (integers) E2 84 A4
|
|
||||||
U+2287 subset symbol E2 8A 87
|
|
||||||
U+211D set 'R' symbol (real numbers) E2 84 9D */
|
|
||||||
|
|
||||||
str =
|
|
||||||
"Unicode test: happy\xE2\x98\xBA \xC2\xA3 5.00"
|
|
||||||
" \xC2\xA1\xCF\x84\xC3\xA4u! "
|
|
||||||
" \xE2\x84\xA4\xE2\x8A\x87\xE2\x84\x9D";
|
|
||||||
color = grub_video_map_rgb (128, 128, 255);
|
|
||||||
|
|
||||||
/* All characters in the string exist in the 'Fixed 20' (10x20) font. */
|
|
||||||
texty += grub_font_get_ascent(fixed);
|
|
||||||
grub_font_draw_string (str, fixed, color, 16, texty);
|
|
||||||
texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed);
|
|
||||||
|
|
||||||
texty += grub_font_get_ascent(sansbig);
|
|
||||||
grub_font_draw_string (str, sansbig, color, 16, texty);
|
|
||||||
texty += grub_font_get_descent (sansbig) + grub_font_get_leading (sansbig);
|
|
||||||
|
|
||||||
texty += grub_font_get_ascent(sans);
|
|
||||||
grub_font_draw_string (str, sans, color, 16, texty);
|
|
||||||
texty += grub_font_get_descent (sans) + grub_font_get_leading (sans);
|
|
||||||
|
|
||||||
texty += grub_font_get_ascent(sanssmall);
|
|
||||||
grub_font_draw_string (str, sanssmall, color, 16, texty);
|
|
||||||
texty += (grub_font_get_descent (sanssmall)
|
|
||||||
+ grub_font_get_leading (sanssmall));
|
|
||||||
|
|
||||||
glyph = grub_font_get_glyph (fixed, '*');
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
color = grub_video_map_color (i);
|
|
||||||
palette[i] = color;
|
|
||||||
grub_font_draw_glyph (glyph, color, 16 + i * 16, 220);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
|
||||||
{
|
|
||||||
color = grub_video_map_rgb (i, 33, 77);
|
|
||||||
grub_video_fill_rect (color, 0, 0, width, height);
|
|
||||||
grub_video_blit_render_target (text_layer, GRUB_VIDEO_BLIT_BLEND, 0, 0,
|
|
||||||
0, 0, width, height);
|
|
||||||
grub_video_swap_buffers ();
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_getkey ();
|
|
||||||
|
|
||||||
grub_video_delete_render_target (text_layer);
|
|
||||||
|
|
||||||
grub_video_restore ();
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
grub_printf("color %d: %08x\n", i, palette[i]);
|
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(videotest)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("videotest", grub_cmd_videotest,
|
|
||||||
0, N_("Test video subsystem."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(videotest)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/* xnu_uuid.c - transform 64-bit serial number
|
|
||||||
to 128-bit uuid suitable for xnu. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 1995,1996,1998,1999,2001,2002,
|
|
||||||
* 2003, 2009 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB 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, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/device.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/fs.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <grub/crypto.h>
|
|
||||||
|
|
||||||
/* This prefix is used by xnu and boot-132 to hash
|
|
||||||
together with volume serial. */
|
|
||||||
static grub_uint8_t hash_prefix[16]
|
|
||||||
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
|
|
||||||
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_uint64_t serial;
|
|
||||||
grub_uint8_t *xnu_uuid;
|
|
||||||
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
|
|
||||||
char *ptr;
|
|
||||||
grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
|
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "UUID required");
|
|
||||||
|
|
||||||
serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
|
|
||||||
|
|
||||||
GRUB_MD_MD5->init (&ctx);
|
|
||||||
GRUB_MD_MD5->write (&ctx, hash_prefix, sizeof (hash_prefix));
|
|
||||||
GRUB_MD_MD5->write (&ctx, &serial, sizeof (serial));
|
|
||||||
GRUB_MD_MD5->final (&ctx);
|
|
||||||
xnu_uuid = GRUB_MD_MD5->read (&ctx);
|
|
||||||
|
|
||||||
grub_snprintf (uuid_string, sizeof (uuid_string),
|
|
||||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
|
||||||
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
|
|
||||||
(unsigned int) xnu_uuid[2], (unsigned int) xnu_uuid[3],
|
|
||||||
(unsigned int) xnu_uuid[4], (unsigned int) xnu_uuid[5],
|
|
||||||
(unsigned int) ((xnu_uuid[6] & 0xf) | 0x30),
|
|
||||||
(unsigned int) xnu_uuid[7],
|
|
||||||
(unsigned int) ((xnu_uuid[8] & 0x3f) | 0x80),
|
|
||||||
(unsigned int) xnu_uuid[9],
|
|
||||||
(unsigned int) xnu_uuid[10], (unsigned int) xnu_uuid[11],
|
|
||||||
(unsigned int) xnu_uuid[12], (unsigned int) xnu_uuid[13],
|
|
||||||
(unsigned int) xnu_uuid[14], (unsigned int) xnu_uuid[15]);
|
|
||||||
for (ptr = uuid_string; *ptr; ptr++)
|
|
||||||
*ptr = grub_toupper (*ptr);
|
|
||||||
if (argc == 1)
|
|
||||||
grub_printf ("%s", uuid_string);
|
|
||||||
if (argc > 1)
|
|
||||||
grub_env_set (args[1], uuid_string);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (xnu_uuid)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid,
|
|
||||||
N_("GRUBUUID [VARNAME]"),
|
|
||||||
N_("Transform 64-bit UUID to format "
|
|
||||||
"suitable for XNU."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (xnu_uuid)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Wrapper for compilers which do not understand `-c -o'.
|
||||||
|
|
||||||
|
scriptversion=2004-10-12.08
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
|
||||||
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||||
|
#
|
||||||
|
# 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; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
'')
|
||||||
|
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
-h | --h*)
|
||||||
|
cat <<\EOF
|
||||||
|
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||||
|
|
||||||
|
Wrapper for compilers which do not understand `-c -o'.
|
||||||
|
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||||
|
arguments, and rename the output as expected.
|
||||||
|
|
||||||
|
If you are trying to build a whole package this is not the
|
||||||
|
right script to run: please start by reading the file `INSTALL'.
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-v | --v*)
|
||||||
|
echo "compile $scriptversion"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ofile=
|
||||||
|
cfile=
|
||||||
|
eat=
|
||||||
|
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if test -n "$eat"; then
|
||||||
|
eat=
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
-o)
|
||||||
|
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||||
|
# So we strip `-o arg' only if arg is an object.
|
||||||
|
eat=1
|
||||||
|
case $2 in
|
||||||
|
*.o | *.obj)
|
||||||
|
ofile=$2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" -o "$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*.c)
|
||||||
|
cfile=$1
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "$ofile" || test -z "$cfile"; then
|
||||||
|
# If no `-o' option was seen then we might have been invoked from a
|
||||||
|
# pattern rule where we don't need one. That is ok -- this is a
|
||||||
|
# normal compilation that the losing compiler can handle. If no
|
||||||
|
# `.c' file was seen then we are probably linking. That is also
|
||||||
|
# ok.
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Name of file we expect compiler to create.
|
||||||
|
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||||
|
|
||||||
|
# Create the lock directory.
|
||||||
|
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||||
|
# that we are using for the .o file. Also, base the name on the expected
|
||||||
|
# object file name, since that is what matters with a parallel build.
|
||||||
|
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||||
|
while true; do
|
||||||
|
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
# FIXME: race condition here if user kills between mkdir and trap.
|
||||||
|
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||||
|
|
||||||
|
# Run the compile.
|
||||||
|
"$@"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if test -f "$cofile"; then
|
||||||
|
mv "$cofile" "$ofile"
|
||||||
|
elif test -f "${cofile}bj"; then
|
||||||
|
mv "${cofile}bj" "$ofile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$lockdir"
|
||||||
|
exit $ret
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-end: "$"
|
||||||
|
# End:
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
sbin_UTILITIES += grub-emu
|
|
||||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
|
||||||
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|
||||||
commands/configfile.c commands/echo.c commands/help.c \
|
|
||||||
commands/handler.c commands/ls.c commands/test.c \
|
|
||||||
commands/search_wrap.c commands/search_file.c \
|
|
||||||
commands/search_label.c commands/search_uuid.c \
|
|
||||||
commands/blocklist.c commands/hexdump.c \
|
|
||||||
lib/hexdump.c commands/halt.c commands/reboot.c \
|
|
||||||
lib/envblk.c commands/loadenv.c \
|
|
||||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
|
||||||
commands/password.c commands/keystatus.c \
|
|
||||||
disk/host.c disk/loopback.c disk/scsi.c \
|
|
||||||
fs/fshelp.c \
|
|
||||||
\
|
|
||||||
io/gzio.c \
|
|
||||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
|
||||||
kern/err.c kern/list.c kern/handler.c \
|
|
||||||
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
|
||||||
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
|
||||||
kern/partition.c kern/term.c \
|
|
||||||
kern/rescue_reader.c kern/rescue_parser.c \
|
|
||||||
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
|
|
||||||
normal/handler.c normal/auth.c lib/crypto.c normal/autofs.c \
|
|
||||||
normal/completion.c normal/main.c normal/color.c \
|
|
||||||
normal/menu.c normal/menu_entry.c \
|
|
||||||
normal/menu_text.c normal/crypto.c normal/term.c \
|
|
||||||
commands/terminal.c normal/context.c lib/charset.c \
|
|
||||||
script/main.c script/execute.c script/function.c \
|
|
||||||
script/lexer.c script/script.c grub_script.tab.c \
|
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
|
||||||
partmap/acorn.c partmap/gpt.c \
|
|
||||||
\
|
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
|
||||||
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
|
|
||||||
video/fb/fbfill.c video/fb/fbutil.c commands/videotest.c \
|
|
||||||
video/bitmap.c video/bitmap_scale.c video/readers/tga.c \
|
|
||||||
video/readers/jpeg.c video/readers/png.c font/font_cmd.c \
|
|
||||||
font/font.c term/gfxterm.c io/bufio.c \
|
|
||||||
\
|
|
||||||
gfxmenu/gfxmenu.c gfxmenu/model.c gfxmenu/view.c \
|
|
||||||
gfxmenu/icon_manager.c gfxmenu/theme_loader.c \
|
|
||||||
gfxmenu/widget-box.c gfxmenu/gui_canvas.c \
|
|
||||||
gfxmenu/gui_circular_progress.c gfxmenu/gui_box.c \
|
|
||||||
gfxmenu/gui_label.c gfxmenu/gui_list.c gfxmenu/gui_image.c \
|
|
||||||
gfxmenu/gui_progress_bar.c gfxmenu/gui_util.c \
|
|
||||||
gfxmenu/gui_string_util.c gfxmenu/named_colors.c trigtables.c \
|
|
||||||
\
|
|
||||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
|
||||||
util/hostdisk.c util/getroot.c \
|
|
||||||
\
|
|
||||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
|
||||||
commands/parttool.c parttool/msdospart.c \
|
|
||||||
lib/libgcrypt-grub/cipher/md5.c \
|
|
||||||
grub_emu_init.c gnulib/progname.c
|
|
||||||
grub_emu_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(target_cpu), i386)
|
|
||||||
grub_emu_SOURCES += commands/i386/cpuid.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_usb), yes)
|
|
||||||
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
|
|
||||||
commands/usbtest.c
|
|
||||||
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_sdl), yes)
|
|
||||||
grub_emu_SOURCES += util/sdl.c
|
|
||||||
grub_emu_LDFLAGS += $(LIBSDL)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_pci), yes)
|
|
||||||
grub_emu_SOURCES += util/pci.c commands/lspci.c
|
|
||||||
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_emu_init.lst
|
|
||||||
|
|
||||||
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_emu_init.h
|
|
||||||
|
|
||||||
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_emu_init.c
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME: this could be shared with common.rmk
|
|
||||||
|
|
||||||
trigtables.c: gentrigtables
|
|
||||||
./gentrigtables > $@
|
|
||||||
DISTCLEANFILES += trigtables.c
|
|
||||||
gentrigtables: gentrigtables.c
|
|
||||||
$(CC) -o $@ $^ $(CPPFLAGS) -lm
|
|
||||||
DISTCLEANFILES += gentrigtables
|
|
||||||
|
|
||||||
# For grub-mkfont.
|
|
||||||
ifeq ($(enable_grub_mkfont), yes)
|
|
||||||
bin_UTILITIES += grub-mkfont
|
|
||||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
|
|
||||||
grub_mkfont_CFLAGS = $(freetype_cflags)
|
|
||||||
grub_mkfont_LDFLAGS = $(freetype_libs)
|
|
||||||
endif
|
|
||||||
|
|
||||||
grub_script.tab.c grub_script.tab.h: script/parser.y
|
|
||||||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
|
||||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-bin2h
|
|
||||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
|
||||||
-782
@@ -1,782 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
sbin_UTILITIES += grub-mkdevicemap
|
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
|
||||||
util/deviceiter.c \
|
|
||||||
util/misc.c
|
|
||||||
|
|
||||||
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
|
||||||
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
|
||||||
else
|
|
||||||
grub_mkdevicemap_SOURCES += util/devicemap.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For grub-mkelfimage.
|
|
||||||
bin_UTILITIES += grub-mkelfimage
|
|
||||||
grub_mkelfimage_SOURCES = gnulib/progname.c \
|
|
||||||
util/elf/grub-mkimage.c util/misc.c \
|
|
||||||
util/resolve.c
|
|
||||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-probe.
|
|
||||||
sbin_UTILITIES += grub-probe
|
|
||||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
|
||||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
|
||||||
util/hostdisk.c util/misc.c util/getroot.c \
|
|
||||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
|
||||||
kern/parser.c kern/partition.c kern/file.c \
|
|
||||||
\
|
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
|
||||||
partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
|
||||||
kern/fs.c kern/env.c fs/fshelp.c \
|
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
|
||||||
|
|
||||||
ifeq ($(enable_grub_fstest), yes)
|
|
||||||
bin_UTILITIES += grub-fstest
|
|
||||||
endif
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkisofs
|
|
||||||
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
|
|
||||||
util/mkisofs/hash.c util/mkisofs/joliet.c \
|
|
||||||
util/mkisofs/match.c util/mkisofs/mkisofs.c \
|
|
||||||
util/mkisofs/multi.c util/mkisofs/name.c \
|
|
||||||
util/mkisofs/rock.c util/mkisofs/tree.c \
|
|
||||||
util/mkisofs/write.c \
|
|
||||||
\
|
|
||||||
gnulib/fnmatch.c gnulib/getopt1.c gnulib/getopt.c \
|
|
||||||
gnulib/error.c gnulib/progname.c
|
|
||||||
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
|
||||||
-I$(srcdir)/util/mkisofs/include \
|
|
||||||
-Wno-all -Werror
|
|
||||||
|
|
||||||
# For grub-fstest.
|
|
||||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
|
||||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
|
||||||
util/misc.c \
|
|
||||||
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
|
||||||
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
|
||||||
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
|
||||||
lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.c \
|
|
||||||
\
|
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
|
||||||
fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
|
||||||
kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c \
|
|
||||||
partmap/gpt.c \
|
|
||||||
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
|
||||||
disk/raid5_recover.c disk/raid6_recover.c \
|
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
|
||||||
grub_fstest_init.c
|
|
||||||
|
|
||||||
# For grub-mkfont.
|
|
||||||
ifeq ($(enable_grub_mkfont), yes)
|
|
||||||
bin_UTILITIES += grub-mkfont
|
|
||||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
|
|
||||||
grub_mkfont_CFLAGS = $(freetype_cflags)
|
|
||||||
grub_mkfont_LDFLAGS = $(freetype_libs)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For grub-mkrelpath.
|
|
||||||
bin_UTILITIES += grub-mkrelpath
|
|
||||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-bin2h
|
|
||||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
|
||||||
|
|
||||||
# For grub-script-check.
|
|
||||||
bin_UTILITIES += grub-script-check
|
|
||||||
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
|
||||||
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
|
||||||
util/grub-script-check.c util/misc.c \
|
|
||||||
script/main.c script/script.c script/function.c script/lexer.c \
|
|
||||||
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
|
||||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c
|
|
||||||
|
|
||||||
# For the parser.
|
|
||||||
grub_script.tab.c grub_script.tab.h: script/parser.y
|
|
||||||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
|
||||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
|
||||||
|
|
||||||
# For grub-script-check.
|
|
||||||
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.lst
|
|
||||||
|
|
||||||
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.h
|
|
||||||
|
|
||||||
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.c
|
|
||||||
|
|
||||||
# For grub-probe.
|
|
||||||
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_probe_init.lst
|
|
||||||
|
|
||||||
grub_probe_init.h: grub_probe_init.lst $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_probe_init.h
|
|
||||||
|
|
||||||
grub_probe_init.c: grub_probe_init.lst $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) geninit.sh grub_probe_init.h
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_probe_init.c
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
grub_setup_init.lst: geninit.sh $(filter-out grub_setup_init.c,$(grub_setup_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_setup_init.lst
|
|
||||||
|
|
||||||
grub_setup_init.h: grub_setup_init.lst $(filter-out grub_setup_init.c,$(grub_setup_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_setup_init.h
|
|
||||||
|
|
||||||
grub_setup_init.c: grub_setup_init.lst $(filter-out grub_setup_init.c,$(grub_setup_SOURCES)) geninit.sh grub_setup_init.h
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_setup_init.c
|
|
||||||
|
|
||||||
# For grub-fstest.
|
|
||||||
grub_fstest_init.lst: geninit.sh $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_fstest_init.lst
|
|
||||||
|
|
||||||
grub_fstest_init.h: grub_fstest_init.lst $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_fstest_init.h
|
|
||||||
|
|
||||||
grub_fstest_init.c: grub_fstest_init.lst $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES)) geninit.sh grub_fstest_init.h
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_fstest_init.c
|
|
||||||
|
|
||||||
# for grub-editenv
|
|
||||||
bin_UTILITIES += grub-editenv
|
|
||||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
|
|
||||||
CLEANFILES += grub-editenv
|
|
||||||
|
|
||||||
# Needed for genmk.rb to work
|
|
||||||
ifeq (0,1)
|
|
||||||
bin_UTILITIES += grub-macho2img grub-pe2elf
|
|
||||||
endif
|
|
||||||
|
|
||||||
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
|
|
||||||
CLEANFILES += grub-pe2elf
|
|
||||||
|
|
||||||
grub_macho2img_SOURCES = util/grub-macho2img.c
|
|
||||||
CLEANFILES += grub-macho2img
|
|
||||||
|
|
||||||
# For grub-mkconfig
|
|
||||||
grub-mkconfig: util/grub-mkconfig.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
sbin_SCRIPTS += grub-mkconfig
|
|
||||||
CLEANFILES += grub-mkconfig
|
|
||||||
|
|
||||||
grub-mkconfig_lib: util/grub-mkconfig_lib.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
lib_SCRIPTS += grub-mkconfig_lib
|
|
||||||
CLEANFILES += grub-mkconfig_lib
|
|
||||||
|
|
||||||
update-grub_lib: util/update-grub_lib.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
lib_SCRIPTS += update-grub_lib
|
|
||||||
CLEANFILES += update-grub_lib
|
|
||||||
|
|
||||||
grub-gettext_lib: util/grub-gettext_lib.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
lib_DATA += grub-gettext_lib
|
|
||||||
CLEANFILES += grub-gettext_lib
|
|
||||||
|
|
||||||
%: util/grub.d/%.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom
|
|
||||||
ifneq (, $(host_kernel))
|
|
||||||
grub-mkconfig_SCRIPTS += 10_$(host_kernel)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CLEANFILES += $(grub-mkconfig_SCRIPTS)
|
|
||||||
|
|
||||||
grub-mkconfig_DATA += util/grub.d/README
|
|
||||||
|
|
||||||
# For grub-set-default.
|
|
||||||
grub-set-default: util/grub-set-default.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
sbin_SCRIPTS += grub-set-default
|
|
||||||
CLEANFILES += grub-set-default
|
|
||||||
|
|
||||||
# For grub-reboot.
|
|
||||||
grub-reboot: util/grub-reboot.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
sbin_SCRIPTS += grub-reboot
|
|
||||||
CLEANFILES += grub-reboot
|
|
||||||
|
|
||||||
# Filing systems.
|
|
||||||
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
|
||||||
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
|
||||||
affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \
|
|
||||||
udf.mod afs.mod afs_be.mod befs.mod befs_be.mod
|
|
||||||
|
|
||||||
# For fshelp.mod.
|
|
||||||
fshelp_mod_SOURCES = fs/fshelp.c
|
|
||||||
fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fat.mod.
|
|
||||||
fat_mod_SOURCES = fs/fat.c
|
|
||||||
fat_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ufs1.mod.
|
|
||||||
ufs1_mod_SOURCES = fs/ufs.c
|
|
||||||
ufs1_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ufs1_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ufs2.mod.
|
|
||||||
ufs2_mod_SOURCES = fs/ufs2.c
|
|
||||||
ufs2_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ufs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ext2.mod.
|
|
||||||
ext2_mod_SOURCES = fs/ext2.c
|
|
||||||
ext2_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ext2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ntfs.mod.
|
|
||||||
ntfs_mod_SOURCES = fs/ntfs.c
|
|
||||||
ntfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ntfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ntfscomp.mod.
|
|
||||||
ntfscomp_mod_SOURCES = fs/ntfscomp.c
|
|
||||||
ntfscomp_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ntfscomp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For minix.mod.
|
|
||||||
minix_mod_SOURCES = fs/minix.c
|
|
||||||
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For hfs.mod.
|
|
||||||
hfs_mod_SOURCES = fs/hfs.c
|
|
||||||
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For jfs.mod.
|
|
||||||
jfs_mod_SOURCES = fs/jfs.c
|
|
||||||
jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
jfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For iso9660.mod.
|
|
||||||
iso9660_mod_SOURCES = fs/iso9660.c
|
|
||||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
iso9660_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For xfs.mod.
|
|
||||||
xfs_mod_SOURCES = fs/xfs.c
|
|
||||||
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For affs.mod.
|
|
||||||
affs_mod_SOURCES = fs/affs.c
|
|
||||||
affs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
affs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For sfs.mod.
|
|
||||||
sfs_mod_SOURCES = fs/sfs.c
|
|
||||||
sfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
sfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For hfsplus.mod.
|
|
||||||
hfsplus_mod_SOURCES = fs/hfsplus.c
|
|
||||||
hfsplus_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reiserfs.mod.
|
|
||||||
reiserfs_mod_SOURCES = fs/reiserfs.c
|
|
||||||
reiserfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reiserfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For cpio.mod.
|
|
||||||
cpio_mod_SOURCES = fs/cpio.c
|
|
||||||
cpio_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
cpio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For tar.mod.
|
|
||||||
tar_mod_SOURCES = fs/tar.c
|
|
||||||
tar_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
tar_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For udf.mod.
|
|
||||||
udf_mod_SOURCES = fs/udf.c
|
|
||||||
udf_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
udf_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For afs.mod.
|
|
||||||
afs_mod_SOURCES = fs/afs.c
|
|
||||||
afs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
afs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For afs_be.mod.
|
|
||||||
afs_be_mod_SOURCES = fs/afs_be.c
|
|
||||||
afs_be_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
afs_be_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For befs.mod.
|
|
||||||
befs_mod_SOURCES = fs/befs.c
|
|
||||||
befs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
befs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For befs_be.mod.
|
|
||||||
befs_be_mod_SOURCES = fs/befs_be.c
|
|
||||||
befs_be_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
befs_be_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Partition maps.
|
|
||||||
|
|
||||||
pkglib_MODULES += part_amiga.mod
|
|
||||||
part_amiga_mod_SOURCES = partmap/amiga.c
|
|
||||||
part_amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_amiga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += part_apple.mod
|
|
||||||
part_apple_mod_SOURCES = partmap/apple.c
|
|
||||||
part_apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_apple_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += part_msdos.mod
|
|
||||||
part_msdos_mod_SOURCES = partmap/msdos.c
|
|
||||||
part_msdos_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_msdos_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += part_sun.mod
|
|
||||||
part_sun_mod_SOURCES = partmap/sun.c
|
|
||||||
part_sun_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_sun_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += part_acorn.mod
|
|
||||||
part_acorn_mod_SOURCES = partmap/acorn.c
|
|
||||||
part_acorn_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_acorn_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += part_gpt.mod
|
|
||||||
part_gpt_mod_SOURCES = partmap/gpt.c
|
|
||||||
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Special disk structures and generic drivers
|
|
||||||
|
|
||||||
pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \
|
|
||||||
lvm.mod scsi.mod
|
|
||||||
|
|
||||||
# For raid.mod
|
|
||||||
raid_mod_SOURCES = disk/raid.c
|
|
||||||
raid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
raid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For raid5rec.mod
|
|
||||||
raid5rec_mod_SOURCES = disk/raid5_recover.c
|
|
||||||
raid5rec_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
raid5rec_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For raid6rec.mod
|
|
||||||
raid6rec_mod_SOURCES = disk/raid6_recover.c
|
|
||||||
raid6rec_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
raid6rec_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mdraid.mod
|
|
||||||
mdraid_mod_SOURCES = disk/mdraid_linux.c
|
|
||||||
mdraid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mdraid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For dm_nv.mod
|
|
||||||
dm_nv_mod_SOURCES = disk/dmraid_nvidia.c
|
|
||||||
dm_nv_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
dm_nv_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lvm.mod
|
|
||||||
lvm_mod_SOURCES = disk/lvm.c
|
|
||||||
lvm_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lvm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For scsi.mod
|
|
||||||
scsi_mod_SOURCES = disk/scsi.c
|
|
||||||
scsi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Commands.
|
|
||||||
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
|
||||||
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
|
||||||
configfile.mod echo.mod \
|
|
||||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
|
||||||
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
|
||||||
msdospart.mod memrw.mod normal.mod sh.mod \
|
|
||||||
gptsync.mod true.mod probe.mod password.mod \
|
|
||||||
keystatus.mod
|
|
||||||
|
|
||||||
# For password.mod.
|
|
||||||
password_mod_SOURCES = commands/password.c
|
|
||||||
password_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
password_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For gptsync.mod.
|
|
||||||
gptsync_mod_SOURCES = commands/gptsync.c
|
|
||||||
gptsync_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
gptsync_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For minicmd.mod.
|
|
||||||
minicmd_mod_SOURCES = commands/minicmd.c
|
|
||||||
minicmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
minicmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For extcmd.mod.
|
|
||||||
extcmd_mod_SOURCES = commands/extcmd.c lib/arg.c
|
|
||||||
extcmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
extcmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For hello.mod.
|
|
||||||
hello_mod_SOURCES = hello/hello.c
|
|
||||||
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For gfxmenu.mod.
|
|
||||||
pkglib_MODULES += gfxmenu.mod
|
|
||||||
gfxmenu_mod_SOURCES = \
|
|
||||||
gfxmenu/gfxmenu.c \
|
|
||||||
gfxmenu/model.c \
|
|
||||||
gfxmenu/view.c \
|
|
||||||
gfxmenu/icon_manager.c \
|
|
||||||
gfxmenu/theme_loader.c \
|
|
||||||
gfxmenu/widget-box.c \
|
|
||||||
gfxmenu/gui_canvas.c \
|
|
||||||
gfxmenu/gui_circular_progress.c \
|
|
||||||
gfxmenu/gui_box.c \
|
|
||||||
gfxmenu/gui_label.c \
|
|
||||||
gfxmenu/gui_list.c \
|
|
||||||
gfxmenu/gui_image.c \
|
|
||||||
gfxmenu/gui_progress_bar.c \
|
|
||||||
gfxmenu/gui_util.c \
|
|
||||||
gfxmenu/gui_string_util.c \
|
|
||||||
gfxmenu/named_colors.c
|
|
||||||
gfxmenu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
gfxmenu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For parttool.mod.
|
|
||||||
parttool_mod_SOURCES = commands/parttool.c
|
|
||||||
parttool_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
parttool_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For msdospart.mod.
|
|
||||||
msdospart_mod_SOURCES = parttool/msdospart.c
|
|
||||||
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For handler.mod.
|
|
||||||
handler_mod_SOURCES = commands/handler.c
|
|
||||||
handler_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
handler_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ls.mod.
|
|
||||||
ls_mod_SOURCES = commands/ls.c
|
|
||||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ls_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For cmp.mod.
|
|
||||||
cmp_mod_SOURCES = commands/cmp.c
|
|
||||||
cmp_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
cmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For cat.mod.
|
|
||||||
cat_mod_SOURCES = commands/cat.c
|
|
||||||
cat_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
cat_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For echo.mod
|
|
||||||
echo_mod_SOURCES = commands/echo.c
|
|
||||||
echo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
echo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For help.mod.
|
|
||||||
help_mod_SOURCES = commands/help.c
|
|
||||||
help_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For search.mod.
|
|
||||||
search_mod_SOURCES = commands/search_wrap.c
|
|
||||||
search_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += search_fs_file.mod search_fs_uuid.mod search_label.mod
|
|
||||||
|
|
||||||
# For search.mod.
|
|
||||||
search_fs_file_mod_SOURCES = commands/search_file.c
|
|
||||||
search_fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
search_fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For search.mod.
|
|
||||||
search_label_mod_SOURCES = commands/search_label.c
|
|
||||||
search_label_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
search_label_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For search.mod.
|
|
||||||
search_fs_uuid_mod_SOURCES = commands/search_uuid.c
|
|
||||||
search_fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
search_fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For test.mod.
|
|
||||||
test_mod_SOURCES = commands/test.c
|
|
||||||
test_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loopback.mod
|
|
||||||
loopback_mod_SOURCES = disk/loopback.c
|
|
||||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For configfile.mod
|
|
||||||
configfile_mod_SOURCES = commands/configfile.c
|
|
||||||
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
configfile_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For terminfo.mod.
|
|
||||||
terminfo_mod_SOURCES = term/terminfo.c term/tparm.c
|
|
||||||
terminfo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
terminfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For blocklist.mod.
|
|
||||||
blocklist_mod_SOURCES = commands/blocklist.c
|
|
||||||
blocklist_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
blocklist_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For hexdump.mod.
|
|
||||||
hexdump_mod_SOURCES = commands/hexdump.c lib/hexdump.c
|
|
||||||
hexdump_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hexdump_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For read.mod.
|
|
||||||
read_mod_SOURCES = commands/read.c
|
|
||||||
read_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
read_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For sleep.mod.
|
|
||||||
sleep_mod_SOURCES = commands/sleep.c
|
|
||||||
sleep_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
sleep_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadenv.mod.
|
|
||||||
loadenv_mod_SOURCES = commands/loadenv.c lib/envblk.c
|
|
||||||
loadenv_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadenv_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For crc.mod.
|
|
||||||
crc_mod_SOURCES = commands/crc.c lib/crc.c
|
|
||||||
crc_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
crc_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memrw.mod.
|
|
||||||
memrw_mod_SOURCES = commands/memrw.c
|
|
||||||
memrw_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memrw_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For true.mod
|
|
||||||
true_mod_SOURCES = commands/true.c
|
|
||||||
true_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
true_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For probe.mod.
|
|
||||||
probe_mod_SOURCES = commands/probe.c
|
|
||||||
probe_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
probe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For keystatus.mod.
|
|
||||||
keystatus_mod_SOURCES = commands/keystatus.c
|
|
||||||
keystatus_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For normal.mod.
|
|
||||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
|
||||||
normal/auth.c normal/autofs.c normal/handler.c \
|
|
||||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
|
||||||
normal/menu_entry.c normal/menu_text.c \
|
|
||||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
|
||||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For sh.mod.
|
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
|
||||||
script/function.c script/lexer.c grub_script.tab.c
|
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
ifneq (, $(FONT_SOURCE))
|
|
||||||
font/font.c_DEPENDENCIES = ascii.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Common Video Subsystem specific modules.
|
|
||||||
# On Yeeloong it's part of kernel
|
|
||||||
ifneq ($(platform), yeeloong)
|
|
||||||
|
|
||||||
# For video.mod.
|
|
||||||
pkglib_MODULES += video.mod
|
|
||||||
video_mod_SOURCES = video/video.c
|
|
||||||
video_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += video_fb.mod
|
|
||||||
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
|
|
||||||
video/fb/fbfill.c video/fb/fbutil.c
|
|
||||||
video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For bitmap.mod
|
|
||||||
pkglib_MODULES += bitmap.mod
|
|
||||||
bitmap_mod_SOURCES = video/bitmap.c
|
|
||||||
bitmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For bitmap_scale.mod
|
|
||||||
pkglib_MODULES += bitmap_scale.mod
|
|
||||||
bitmap_scale_mod_SOURCES = video/bitmap_scale.c
|
|
||||||
bitmap_scale_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
bitmap_scale_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += font.mod
|
|
||||||
font_mod_SOURCES = font/font_cmd.c font/font.c
|
|
||||||
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
font_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For gfxterm.mod.
|
|
||||||
pkglib_MODULES += gfxterm.mod
|
|
||||||
gfxterm_mod_SOURCES = term/gfxterm.c
|
|
||||||
gfxterm_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For videotest.mod.
|
|
||||||
pkglib_MODULES += videotest.mod
|
|
||||||
videotest_mod_SOURCES = commands/videotest.c
|
|
||||||
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For tga.mod
|
|
||||||
pkglib_MODULES += tga.mod
|
|
||||||
tga_mod_SOURCES = video/readers/tga.c
|
|
||||||
tga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
tga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For jpeg.mod.
|
|
||||||
pkglib_MODULES += jpeg.mod
|
|
||||||
jpeg_mod_SOURCES = video/readers/jpeg.c
|
|
||||||
jpeg_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
jpeg_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For png.mod.
|
|
||||||
pkglib_MODULES += png.mod
|
|
||||||
png_mod_SOURCES = video/readers/png.c
|
|
||||||
png_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
# Misc.
|
|
||||||
pkglib_MODULES += gzio.mod elf.mod
|
|
||||||
|
|
||||||
# For elf.mod.
|
|
||||||
elf_mod_SOURCES = kern/elf.c
|
|
||||||
elf_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
elf_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For gzio.mod.
|
|
||||||
gzio_mod_SOURCES = io/gzio.c
|
|
||||||
gzio_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
gzio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# On Yeeloong it's part of kernel
|
|
||||||
ifneq ($(platform), yeeloong)
|
|
||||||
# For bufio.mod.
|
|
||||||
pkglib_MODULES += bufio.mod
|
|
||||||
bufio_mod_SOURCES = io/bufio.c
|
|
||||||
bufio_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For gettext.mod.
|
|
||||||
pkglib_MODULES += gettext.mod
|
|
||||||
gettext_mod_SOURCES = gettext/gettext.c
|
|
||||||
gettext_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Misc.
|
|
||||||
pkglib_MODULES += xnu_uuid.mod
|
|
||||||
|
|
||||||
# For elf.mod.
|
|
||||||
xnu_uuid_mod_SOURCES = commands/xnu_uuid.c
|
|
||||||
xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += trig.mod
|
|
||||||
trig_mod_SOURCES = trigtables.c
|
|
||||||
trig_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
trig_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
trigtables.c: gentrigtables
|
|
||||||
./gentrigtables > $@
|
|
||||||
DISTCLEANFILES += trigtables.c
|
|
||||||
gentrigtables: gentrigtables.c
|
|
||||||
$(CC) -o $@ $^ $(CPPFLAGS) -lm
|
|
||||||
DISTCLEANFILES += gentrigtables
|
|
||||||
|
|
||||||
pkglib_MODULES += setjmp.mod
|
|
||||||
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
|
||||||
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += charset.mod
|
|
||||||
charset_mod_SOURCES = lib/charset.c
|
|
||||||
charset_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
charset_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += terminal.mod
|
|
||||||
terminal_mod_SOURCES = commands/terminal.c
|
|
||||||
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
terminal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += crypto.mod
|
|
||||||
crypto_mod_SOURCES = lib/crypto.c
|
|
||||||
crypto_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
crypto_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += hashsum.mod
|
|
||||||
hashsum_mod_SOURCES = commands/hashsum.c
|
|
||||||
hashsum_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hashsum_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += pbkdf2.mod
|
|
||||||
pbkdf2_mod_SOURCES = lib/pbkdf2.c
|
|
||||||
pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For password_pbkdf2.mod.
|
|
||||||
pkglib_MODULES += password_pbkdf2.mod
|
|
||||||
password_pbkdf2_mod_SOURCES = commands/password_pbkdf2.c
|
|
||||||
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
|
||||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
|
|
||||||
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
|
||||||
|
|
||||||
include $(srcdir)/conf/gcry.mk
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
|
||||||
|
|
||||||
ifeq ($(platform), coreboot)
|
|
||||||
|
|
||||||
pkglib_PROGRAMS += kernel.img
|
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/i386/coreboot/init.c \
|
|
||||||
kern/i386/multiboot_mmap.c \
|
|
||||||
kern/i386/halt.c \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/env.c \
|
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
|
||||||
env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(platform), qemu)
|
|
||||||
|
|
||||||
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
|
||||||
|
|
||||||
pkglib_IMAGES += boot.img
|
|
||||||
boot_img_SOURCES = boot/i386/qemu/boot.S
|
|
||||||
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_FORMAT = binary
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkimage
|
|
||||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
|
|
||||||
pkglib_IMAGES += kernel.img
|
|
||||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/i386/coreboot/init.c \
|
|
||||||
kern/i386/qemu/mmap.c \
|
|
||||||
kern/i386/halt.c \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/env.c \
|
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
|
||||||
env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
endif
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
|
||||||
grub_install_SOURCES = util/grub-install.in
|
|
||||||
|
|
||||||
bin_SCRIPTS += grub-mkrescue
|
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = linux.mod \
|
|
||||||
aout.mod play.mod serial.mod \
|
|
||||||
memdisk.mod pci.mod lspci.mod reboot.mod \
|
|
||||||
halt.mod datetime.mod date.mod datehook.mod \
|
|
||||||
lsmmap.mod mmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod.
|
|
||||||
aout_mod_SOURCES = loader/aout.c
|
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For bsd.mod
|
|
||||||
pkglib_MODULES += bsd.mod
|
|
||||||
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
|
||||||
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
|
||||||
COMMON_CFLAGS = -fno-builtin -m32
|
|
||||||
COMMON_LDFLAGS = -melf_i386 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
|
||||||
util/misc.c util/resolve.c
|
|
||||||
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
|
||||||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
||||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
|
||||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c \
|
|
||||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
|
||||||
# kern/fs.c kern/env.c fs/fshelp.c
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
pkglib_MODULES = chain.mod appleldr.mod \
|
|
||||||
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
|
||||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
|
||||||
fixvideo.mod mmap.mod acpi.mod
|
|
||||||
|
|
||||||
# For kernel.img.
|
|
||||||
kernel_img_RELOCATABLE = yes
|
|
||||||
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
|
||||||
term/efi/console.c disk/efi/efidisk.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h \
|
|
||||||
i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
|
||||||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
|
||||||
mmap/efi/mmap.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/efi/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For appleldr.mod.
|
|
||||||
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
|
||||||
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/efi/datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadbios.mod
|
|
||||||
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
|
||||||
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fixvideo.mod
|
|
||||||
fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
|
||||||
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_uga.mod
|
|
||||||
efi_uga_mod_SOURCES = video/efi_uga.c
|
|
||||||
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_gop.mod
|
|
||||||
efi_gop_mod_SOURCES = video/efi_gop.c
|
|
||||||
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
|
||||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -m32 -nostdinc -fno-builtin
|
|
||||||
COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3
|
|
||||||
COMMON_LDFLAGS = -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
|
|
||||||
# For kernel.img.
|
|
||||||
kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/i386/ieee1275/init.c \
|
|
||||||
kern/ieee1275/init.c \
|
|
||||||
kern/ieee1275/mmap.c \
|
|
||||||
kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/ieee1275/ieee1275.c \
|
|
||||||
term/ieee1275/ofconsole.c \
|
|
||||||
disk/ieee1275/ofdisk.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
|
|
||||||
list.h handler.h command.h i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/ieee1275/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = halt.mod reboot.mod suspend.mod \
|
|
||||||
aout.mod serial.mod linux.mod \
|
|
||||||
nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \
|
|
||||||
date.mod datehook.mod lsmmap.mod mmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod.
|
|
||||||
aout_mod_SOURCES = loader/aout.c
|
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For suspend.mod
|
|
||||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For nand.mod.
|
|
||||||
nand_mod_SOURCES = disk/ieee1275/nand.c
|
|
||||||
nand_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/* Linker script to create grub .img files on Cygwin. */
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
start = . ;
|
|
||||||
*(.text)
|
|
||||||
etext = . ;
|
|
||||||
}
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
__data_start__ = . ;
|
|
||||||
*(.data)
|
|
||||||
__data_end__ = . ;
|
|
||||||
}
|
|
||||||
.rdata :
|
|
||||||
{
|
|
||||||
__rdata_start__ = . ;
|
|
||||||
*(.rdata)
|
|
||||||
__rdata_end__ = . ;
|
|
||||||
}
|
|
||||||
.pdata :
|
|
||||||
{
|
|
||||||
*(.pdata)
|
|
||||||
edata = . ;
|
|
||||||
}
|
|
||||||
.bss :
|
|
||||||
{
|
|
||||||
__bss_start__ = . ;
|
|
||||||
*(.bss)
|
|
||||||
__common_start__ = . ;
|
|
||||||
*(COMMON)
|
|
||||||
__bss_end__ = . ;
|
|
||||||
}
|
|
||||||
.edata :
|
|
||||||
{
|
|
||||||
*(.edata)
|
|
||||||
end = . ;
|
|
||||||
}
|
|
||||||
.stab :
|
|
||||||
{
|
|
||||||
*(.stab)
|
|
||||||
}
|
|
||||||
.stabstr :
|
|
||||||
{
|
|
||||||
*(.stabstr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT("__rdata_end__"=="edata", ".pdata not empty")
|
|
||||||
ASSERT("__bss_end__" =="end" , ".edata not empty")
|
|
||||||
|
|
||||||
@@ -1,373 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
|
||||||
pxeboot.img
|
|
||||||
|
|
||||||
# For boot.img.
|
|
||||||
boot_img_SOURCES = boot/i386/pc/boot.S
|
|
||||||
boot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
|
|
||||||
boot_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For pxeboot.img
|
|
||||||
pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
|
|
||||||
pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
|
|
||||||
pxeboot_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For diskboot.img.
|
|
||||||
diskboot_img_SOURCES = boot/i386/pc/diskboot.S
|
|
||||||
diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8000
|
|
||||||
diskboot_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For lnxboot.img.
|
|
||||||
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
|
|
||||||
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x6000
|
|
||||||
lnxboot_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For cdboot.img.
|
|
||||||
cdboot_img_SOURCES = boot/i386/pc/cdboot.S
|
|
||||||
cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
|
|
||||||
cdboot_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For kernel.img.
|
|
||||||
kernel_img_SOURCES = kern/i386/pc/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
|
||||||
kern/parser.c kern/partition.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/env.c \
|
|
||||||
term/i386/pc/console.c term/i386/vga_common.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
|
|
||||||
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h \
|
|
||||||
i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
sbin_UTILITIES = grub-setup
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
|
||||||
grub_setup_SOURCES = gnulib/progname.c \
|
|
||||||
util/i386/pc/grub-setup.c util/hostdisk.c \
|
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
|
||||||
\
|
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
|
||||||
partmap/msdos.c partmap/gpt.c \
|
|
||||||
\
|
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
|
||||||
util/raid.c util/lvm.c \
|
|
||||||
grub_setup_init.c
|
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
|
||||||
grub_install_SOURCES = util/grub-install.in
|
|
||||||
|
|
||||||
bin_SCRIPTS += grub-mkrescue
|
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
|
||||||
|
|
||||||
pkglib_MODULES = biosdisk.mod chain.mod \
|
|
||||||
reboot.mod halt.mod \
|
|
||||||
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
|
|
||||||
vga.mod memdisk.mod pci.mod lspci.mod \
|
|
||||||
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
|
||||||
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
|
|
||||||
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
|
|
||||||
efiemu.mod mmap.mod acpi.mod drivemap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For drivemap.mod.
|
|
||||||
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
|
|
||||||
commands/i386/pc/drivemap_int13h.S
|
|
||||||
drivemap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
drivemap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
drivemap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For efiemu.mod.
|
|
||||||
efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
|
|
||||||
efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \
|
|
||||||
efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \
|
|
||||||
efiemu/loadcore32.c efiemu/loadcore64.c \
|
|
||||||
efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \
|
|
||||||
efiemu/i386/coredetect.c
|
|
||||||
efiemu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
|
|
||||||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
|
||||||
mmap/i386/pc/mmap.c mmap/i386/pc/mmap_helper.S
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For biosdisk.mod.
|
|
||||||
biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
|
|
||||||
biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += linux16.mod
|
|
||||||
linux16_mod_SOURCES = loader/i386/pc/linux.c
|
|
||||||
linux16_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux16_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += linux.mod
|
|
||||||
linux_mod_SOURCES = loader/i386/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
|
|
||||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/i386/pc/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vbe.mod.
|
|
||||||
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
|
||||||
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vbeinfo.mod.
|
|
||||||
vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
|
|
||||||
vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vbetest.mod.
|
|
||||||
vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
|
|
||||||
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vga.mod.
|
|
||||||
vga_mod_SOURCES = term/i386/pc/vga.c
|
|
||||||
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod
|
|
||||||
aout_mod_SOURCES = loader/aout.c
|
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For bsd.mod
|
|
||||||
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
|
||||||
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For usb.mod
|
|
||||||
usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
|
|
||||||
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For usbtest.mod
|
|
||||||
usbtest_mod_SOURCES = commands/usbtest.c
|
|
||||||
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For uhci.mod
|
|
||||||
uhci_mod_SOURCES = bus/usb/uhci.c
|
|
||||||
uhci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
uhci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ohci.mod
|
|
||||||
ohci_mod_SOURCES = bus/usb/ohci.c
|
|
||||||
ohci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For usbms.mod
|
|
||||||
usbms_mod_SOURCES = disk/usbms.c
|
|
||||||
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For usb_keyboard.mod
|
|
||||||
usb_keyboard_mod_SOURCES = term/usb_keyboard.c
|
|
||||||
usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pxe.mod
|
|
||||||
pxe_mod_SOURCES = fs/i386/pc/pxe.c
|
|
||||||
pxe_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pxe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pxecmd.mod
|
|
||||||
pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
|
|
||||||
pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ata_pthru.mod.
|
|
||||||
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
|
||||||
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For hdparm.mod.
|
|
||||||
hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
|
|
||||||
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
ifeq ($(enable_efiemu), yes)
|
|
||||||
|
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
|
||||||
-rm -f $@
|
|
||||||
ifeq ($(TARGET_APPLE_CC), 1)
|
|
||||||
-rm -f $@.bin
|
|
||||||
$(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
$(OBJCONV) -felf32 -nu -nd $@.bin $@
|
|
||||||
-rm -f $@.bin
|
|
||||||
else
|
|
||||||
$(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
|
||||||
endif
|
|
||||||
|
|
||||||
efiemu64_c.o: efiemu/runtime/efiemu.c
|
|
||||||
ifeq ($(TARGET_APPLE_CC), 1)
|
|
||||||
$(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
else
|
|
||||||
$(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
endif
|
|
||||||
|
|
||||||
efiemu64_s.o: efiemu/runtime/efiemu.S
|
|
||||||
-rm -f $@
|
|
||||||
ifeq ($(TARGET_APPLE_CC), 1)
|
|
||||||
$(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
else
|
|
||||||
$(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
|
|
||||||
endif
|
|
||||||
|
|
||||||
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF)
|
|
||||||
-rm -f $@
|
|
||||||
ifeq ($(TARGET_APPLE_CC), 1)
|
|
||||||
-rm -f $@.bin
|
|
||||||
$(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib
|
|
||||||
$(OBJCONV) -felf64 -nu -nd $@.bin $@
|
|
||||||
-rm -f $@.bin
|
|
||||||
else
|
|
||||||
$(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib
|
|
||||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
|
||||||
endif
|
|
||||||
|
|
||||||
CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
|
|
||||||
pkglib_DATA += efiemu32.o efiemu64.o
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
include $(srcdir)/conf/i386-coreboot.mk
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
pkglib_MODULES += cpuid.mod
|
|
||||||
cpuid_mod_SOURCES = commands/i386/cpuid.c
|
|
||||||
cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += at_keyboard.mod
|
|
||||||
at_keyboard_mod_SOURCES = term/at_keyboard.c
|
|
||||||
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += vga_text.mod
|
|
||||||
vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
|
|
||||||
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += relocator.mod
|
|
||||||
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
|
|
||||||
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += ata.mod
|
|
||||||
ata_mod_SOURCES = disk/ata.c
|
|
||||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For setpci.mod
|
|
||||||
pkglib_MODULES += setpci.mod
|
|
||||||
setpci_mod_SOURCES = commands/setpci.c
|
|
||||||
setpci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
setpci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += multiboot.mod
|
|
||||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
|
||||||
loader/i386/multiboot_mbi.c \
|
|
||||||
loader/multiboot_loader.c
|
|
||||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += multiboot2.mod
|
|
||||||
multiboot2_mod_SOURCES = loader/i386/multiboot.c \
|
|
||||||
loader/i386/multiboot_mbi.c \
|
|
||||||
loader/multiboot_loader.c
|
|
||||||
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
|
||||||
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
LINK_BASE = 0x80010000
|
|
||||||
target_machine=qemu-mips
|
|
||||||
COMMON_CFLAGS += -march=mips3
|
|
||||||
COMMON_ASFLAGS += -march=mips3
|
|
||||||
include $(srcdir)/conf/mips.mk
|
|
||||||
|
|
||||||
pkglib_IMAGES = kernel.img
|
|
||||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|
||||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
|
||||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
|
||||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
LINK_BASE = 0x80200000
|
|
||||||
target_machine=yeeloong
|
|
||||||
COMMON_CFLAGS += -march=mips3
|
|
||||||
COMMON_ASFLAGS += -march=mips3
|
|
||||||
|
|
||||||
kernel_img_HEADERS += bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
|
|
||||||
|
|
||||||
include $(srcdir)/conf/mips.mk
|
|
||||||
|
|
||||||
pkglib_IMAGES = kernel.img
|
|
||||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|
||||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
|
||||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
|
||||||
kern/$(target_cpu)/cache.S \
|
|
||||||
\
|
|
||||||
term/at_keyboard.c \
|
|
||||||
font/font_cmd.c font/font.c io/bufio.c \
|
|
||||||
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
|
|
||||||
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
|
|
||||||
video/bitmap_scale.c video/sm712.c bus/pci.c bus/bonito.c \
|
|
||||||
term/gfxterm.c commands/extcmd.c lib/arg.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
|
||||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For ata.mod.
|
|
||||||
pkglib_MODULES += ata.mod
|
|
||||||
ata_mod_SOURCES = disk/ata.c
|
|
||||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
pkglib_MODULES += lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ata_pthru.mod.
|
|
||||||
pkglib_MODULES += ata_pthru.mod
|
|
||||||
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
|
||||||
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
pkglib_MODULES += mmap.mod
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/mips/yeeloong/uppermem.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
pkglib_MODULES += datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
pkglib_MODULES += date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
pkglib_MODULES += datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += linux.mod
|
|
||||||
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
|
||||||
grub_install_SOURCES = util/grub-install.in
|
|
||||||
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
|
|
||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS += -nostdinc
|
|
||||||
COMMON_CFLAGS += -ffreestanding -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
|
||||||
COMMON_LDFLAGS += -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
|
||||||
symbol.h term.h time.h types.h loader.h partition.h \
|
|
||||||
msdos_partition.h machine/kernel.h handler.h list.h \
|
|
||||||
command.h machine/memory.h cpu/libgcc.h cpu/cache.h i18n.h env_private.h
|
|
||||||
|
|
||||||
ifeq ($(platform), yeeloong)
|
|
||||||
kernel_img_HEADERS += pci.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS =
|
|
||||||
bin_SCRIPTS =
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
bin_UTILITIES += grub-mkimage
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = memdisk.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
pkglib_MODULES += serial.mod
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For relocator.mod.
|
|
||||||
pkglib_MODULES += relocator.mod
|
|
||||||
relocator_mod_SOURCES = lib/$(target_cpu)/relocator.c lib/$(target_cpu)/relocator_asm.S
|
|
||||||
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -D__ASSEMBLY__
|
|
||||||
COMMON_CFLAGS = -ffreestanding
|
|
||||||
COMMON_LDFLAGS += -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
|
||||||
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
|
|
||||||
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
|
|
||||||
command.h i18n.h env_private.h
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Programs
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
|
|
||||||
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
|
||||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/ieee1275/init.c \
|
|
||||||
kern/ieee1275/mmap.c \
|
|
||||||
term/ieee1275/ofconsole.c \
|
|
||||||
kern/ieee1275/openfw.c disk/ieee1275/ofdisk.c \
|
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
|
||||||
kern/generic/millisleep.c kern/time.c \
|
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
|
||||||
-Wl,-N,-S,-Ttext,0x200000,-Bstatic
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
bin_SCRIPTS = grub-mkrescue
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/ieee1275/grub-install.in
|
|
||||||
|
|
||||||
# For grub-mkrescue.
|
|
||||||
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = halt.mod \
|
|
||||||
linux.mod \
|
|
||||||
reboot.mod \
|
|
||||||
suspend.mod \
|
|
||||||
memdisk.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For suspend.mod
|
|
||||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
|
|
||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -m64
|
|
||||||
COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
|
|
||||||
COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
|
||||||
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
|
||||||
|
|
||||||
# For boot.img.
|
|
||||||
boot_img_SOURCES = boot/sparc64/ieee1275/boot.S
|
|
||||||
boot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4000
|
|
||||||
boot_img_FORMAT = a.out-sunos-big
|
|
||||||
|
|
||||||
# For diskboot.img.
|
|
||||||
diskboot_img_SOURCES = boot/sparc64/ieee1275/diskboot.S
|
|
||||||
diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
|
||||||
diskboot_img_FORMAT = binary
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
list.h handler.h command.h i18n.h \
|
|
||||||
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
|
|
||||||
sparc64/ieee1275/ieee1275.h env_private.h
|
|
||||||
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
|
||||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/sparc64/ieee1275/ieee1275.c \
|
|
||||||
kern/sparc64/ieee1275/init.c \
|
|
||||||
kern/ieee1275/mmap.c \
|
|
||||||
term/ieee1275/ofconsole.c \
|
|
||||||
kern/ieee1275/openfw.c disk/ieee1275/ofdisk.c \
|
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
|
||||||
kern/generic/millisleep.c kern/time.c \
|
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic,-melf64_sparc -static-libgcc -lgcc
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
sbin_UTILITIES = grub-setup grub-ofpathname
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
|
||||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
|
||||||
\
|
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
|
||||||
partmap/sun.c partmap/acorn.c \
|
|
||||||
\
|
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
|
||||||
util/raid.c util/lvm.c gnulib/progname.c \
|
|
||||||
grub_setup_init.c
|
|
||||||
|
|
||||||
# For grub-ofpathname.
|
|
||||||
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
|
||||||
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = halt.mod \
|
|
||||||
linux.mod \
|
|
||||||
reboot.mod \
|
|
||||||
memdisk.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
# For grub-shell
|
|
||||||
grub-shell: tests/util/grub-shell.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
check_SCRIPTS += grub-shell
|
|
||||||
CLEANFILES += grub-shell
|
|
||||||
|
|
||||||
# For grub-shell-tester
|
|
||||||
grub-shell-tester: tests/util/grub-shell-tester.in config.status
|
|
||||||
./config.status --file=$@:$<
|
|
||||||
chmod +x $@
|
|
||||||
check_SCRIPTS += grub-shell-tester
|
|
||||||
CLEANFILES += grub-shell-tester
|
|
||||||
|
|
||||||
pkglib_MODULES += functional_test.mod
|
|
||||||
functional_test_mod_SOURCES = tests/lib/functional_test.c tests/lib/test.c
|
|
||||||
functional_test_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Rules for unit tests
|
|
||||||
check_UTILITIES += example_unit_test
|
|
||||||
example_unit_test_SOURCES = tests/example_unit_test.c kern/list.c kern/misc.c tests/lib/test.c tests/lib/unit_test.c
|
|
||||||
example_unit_test_CFLAGS = -Wno-format
|
|
||||||
|
|
||||||
# Rules for functional tests
|
|
||||||
pkglib_MODULES += example_functional_test.mod
|
|
||||||
example_functional_test_mod_SOURCES = tests/example_functional_test.c
|
|
||||||
example_functional_test_mod_CFLAGS = -Wno-format $(COMMON_CFLAGS)
|
|
||||||
example_functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# Rules for scripted tests
|
|
||||||
check_SCRIPTS += example_scripted_test
|
|
||||||
example_scripted_test_SOURCES = tests/example_scripted_test.in
|
|
||||||
|
|
||||||
check_SCRIPTS += example_grub_script_test
|
|
||||||
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
|
|
||||||
|
|
||||||
|
|
||||||
# List of tests to execute on "make check"
|
|
||||||
SCRIPTED_TESTS = example_scripted_test
|
|
||||||
SCRIPTED_TESTS += example_grub_script_test
|
|
||||||
UNIT_TESTS = example_unit_test
|
|
||||||
FUNCTIONAL_TESTS = example_functional_test.mod
|
|
||||||
|
|
||||||
# dependencies between tests and testing-tools
|
|
||||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
|
||||||
$(FUNCTIONAL_TESTS): functional_test.mod
|
|
||||||
|
|
||||||
Loaded 100 of 943 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user