diff --git a/0001-Bump-version-to-2.03.patch b/0001-Bump-version-to-2.03.patch new file mode 100644 index 00000000..c8e4270a --- /dev/null +++ b/0001-Bump-version-to-2.03.patch @@ -0,0 +1,230 @@ +From b0bad6fd9449d3333fe1ab58953c0e6c1ce12c0d Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Wed, 3 May 2017 11:55:52 +0200 +Subject: [PATCH 001/176] Bump version to 2.03 + +--- + configure.ac | 2 +- + grub-core/tests/checksums.h | 196 ++++++++++++++++++++++---------------------- + 2 files changed, 99 insertions(+), 99 deletions(-) + +diff --git a/configure.ac b/configure.ac +index edd184154..d10d8adac 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -31,7 +31,7 @@ dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables + dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are + dnl used for the target type. See INSTALL for full list of variables. + +-AC_INIT([GRUB],[2.02],[bug-grub@gnu.org]) ++AC_INIT([GRUB],[2.03],[bug-grub@gnu.org]) + + AC_CONFIG_AUX_DIR([build-aux]) + +diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h +index 68d8ce7c7..921e57ff4 100644 +--- a/grub-core/tests/checksums.h ++++ b/grub-core/tests/checksums.h +@@ -1,101 +1,101 @@ +- { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xcd5fc34e, 0xcd5fc34e, 0xeabbecab, 0xeabbecab, 0xc9950151, 0xc9950151, 0x2be222b6, 0x2be222b6, 0xe88c769e, 0xe88c769e, 0x6be4910e, 0x6be4910e, 0x1dc1fe4f, 0x1dc1fe4f, 0xd7613e8f, 0xd7613e8f, 0xf8124196, 0xf8124196, 0x130f5935, 0x130f5935, 0x2872330e, 0x2872330e, 0xaa7b7868, 0xaa7b7868, 0x558eaeea, 0x558eaeea, 0x92f7960f, 0x92f7960f, 0xc5bfc709, 0xc5bfc709, 0x699732fe, 0x699732fe, 0xc859125f, 0xc859125f, 0xfc6ac729, 0xfc6ac729, 0xcdab6cd4, 0xcdab6cd4, 0x58a8b7f8, 0x58a8b7f8, 0xc0e73385, 0x6560d6ef, 0x3be8bb5d, 0x3be8bb5d, }, 45 }, +- { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x13029f94, 0x13029f94, 0x7785fdab, 0x7785fdab, 0x95a7c1e8, 0x95a7c1e8, 0x315ab3e3, 0x315ab3e3, 0x6787f012, 0x6787f012, 0x79b1ecdc, 0x79b1ecdc, 0xdbc67810, 0xdbc67810, 0xafaa982e, 0xafaa982e, 0xc5cd0157, 0xc5cd0157, 0x3c50dd64, 0x3c50dd64, 0x1056cac0, 0x1056cac0, 0x1d7a41fa, 0x1d7a41fa, 0x5690b1e8, 0x5690b1e8, 0x616831d6, 0x616831d6, 0xfaf8e726, 0xfaf8e726, 0xd1ec5e26, 0xd1ec5e26, 0x3c269e1f, 0x3c269e1f, 0x1aa7952d, 0x1aa7952d, 0x6e7e2f99, 0x6e7e2f99, 0x98f4c02, 0x98f4c02, 0xc3f1abf2, 0xe348bb73, 0xea53cd60, 0xea53cd60, }, 45 }, +- { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x8fbb4f4c, 0x8fbb4f4c, 0x5dc00167, 0x5dc00167, 0xbc124df8, 0xbc124df8, 0x31cf0f8e, 0x31cf0f8e, 0x798cc4ed, 0x798cc4ed, 0xc5d2a091, 0xc5d2a091, 0xb58a0591, 0xb58a0591, 0x4d118aca, 0x4d118aca, 0xbb06c7ee, 0xbb06c7ee, 0x42179db7, 0x42179db7, 0x65f2d81e, 0x65f2d81e, 0xa2628bcb, 0xa2628bcb, 0xbdb7f4b, 0xbdb7f4b, 0x66b10309, 0x66b10309, 0x1a550ea9, 0x1a550ea9, 0x377a297d, 0x377a297d, 0x2ea99015, 0x2ea99015, 0x4e20d7bc, 0x4e20d7bc, 0x8ecbde02, 0x8ecbde02, 0xdfa2195a, 0xdfa2195a, 0xe113d2a, 0xe204ee5b, 0x734679c1, 0x734679c1, }, 45 }, +- { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe2f6bfe1, 0xe2f6bfe1, 0xf18aee15, 0xf18aee15, 0x5e83b689, 0x5e83b689, 0xb7e8b42c, 0xb7e8b42c, 0x85d78f92, 0x85d78f92, 0xd56fadae, 0xd56fadae, 0x7632f5bf, 0x7632f5bf, 0x2769a748, 0x2769a748, 0x4a6112cd, 0x4a6112cd, 0x4f9b66a4, 0x4f9b66a4, 0x70457d38, 0x70457d38, 0x8cadb1a7, 0x8cadb1a7, 0x451341f, 0x451341f, 0x8a62e741, 0x8a62e741, 0x1b1f9031, 0x1b1f9031, 0x75ab630e, 0x75ab630e, 0xd5ff53ac, 0xd5ff53ac, 0x73a2b3c7, 0x73a2b3c7, 0x7b52acd5, 0x7b52acd5, 0xf6f3e48c, 0xf6f3e48c, 0x8d0db133, 0x8db24310, 0x7aef56d4, 0x7aef56d4, }, 45 }, +- { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x838a3f40, 0x838a3f40, 0x7351ba96, 0x7351ba96, 0x660963bb, 0x660963bb, 0x6f3362a6, 0x6f3362a6, 0x915d35d9, 0x915d35d9, 0xc7edaee9, 0xc7edaee9, 0xbc8ec24c, 0xbc8ec24c, 0xeb120ffd, 0xeb120ffd, 0x8f6d8232, 0x8f6d8232, 0x2de5d515, 0x2de5d515, 0x4f2ecd91, 0x4f2ecd91, 0x555a9b90, 0x555a9b90, 0x8f7b0d77, 0x8f7b0d77, 0x5f9536af, 0x5f9536af, 0x3dd79dbe, 0x3dd79dbe, 0xb555a0, 0xb555a0, 0x75aec882, 0x75aec882, 0xd5da89cb, 0xd5da89cb, 0xb47b3257, 0xb47b3257, 0x7c97c046, 0x7c97c046, 0x726a7abe, 0x4c8b8a56, 0xcffa0854, 0xcffa0854, }, 45 }, +- { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7bf761e, 0x7bf761e, 0xaf0b6dae, 0xaf0b6dae, 0x7db15930, 0x7db15930, 0xc9720d56, 0xc9720d56, 0x55590d6c, 0x55590d6c, 0xa0d193d9, 0xa0d193d9, 0x728987b2, 0x728987b2, 0x28aecde6, 0x28aecde6, 0xa59bb094, 0xa59bb094, 0x2d0b049d, 0x2d0b049d, 0xd8421240, 0xd8421240, 0x51fa339, 0x51fa339, 0xc625cc46, 0xc625cc46, 0x2c9e6fcc, 0x2c9e6fcc, 0x3d06ffd5, 0x3d06ffd5, 0x8dd72816, 0x8dd72816, 0xfcf2a982, 0xfcf2a982, 0x6ef2870f, 0x6ef2870f, 0xba2caab7, 0xba2caab7, 0x8e5a5872, 0x8e5a5872, 0x62b2fedc, 0x2bd3b588, 0x34ebdb15, 0x34ebdb15, }, 45 }, +- { "cmdline_cat", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa133280a, 0xa133280a, 0x1e8f4227, 0x1e8f4227, 0xa01cd911, 0xa01cd911, 0xdcb3d617, 0xdcb3d617, 0x51200351, 0x51200351, 0x609ba305, 0x609ba305, 0x5d96abfd, 0x5d96abfd, 0xd855cc70, 0xd855cc70, 0xdbfaf18d, 0xdbfaf18d, 0x84814843, 0x84814843, 0x4b00e630, 0x4b00e630, 0xd362b0f5, 0xd362b0f5, 0xec863355, 0xec863355, 0x195898d0, 0x195898d0, 0xe8c698c7, 0xe8c698c7, 0x884229e7, 0x884229e7, 0xb41ed3a9, 0xb41ed3a9, 0x2be1ce40, 0x2be1ce40, 0x8c33eb7c, 0x8c33eb7c, 0xbbce1da, 0xbbce1da, 0xef9415fa, 0x22fbc0d, 0xd82c182c, 0xd82c182c, }, 45 }, +- { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbe029c, 0x6671ee1f, 0xbe029c, 0x4348cfdb, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0x4348cfdb, 0x4348cfdb, 0x59c36f00, }, 20 }, +- { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x14e228ef, 0xb0c8af57, 0x14e228ef, 0x3ae7ad90, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0x3ae7ad90, 0x3ae7ad90, 0xaa4593fe, }, 20 }, +- { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x651fb144, 0xdf93ee9c, 0x651fb144, 0x3808dcc0, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0x3808dcc0, 0x3808dcc0, 0xc9cbf769, }, 20 }, +- { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xdfd0119e, 0x6c7018a9, 0xdfd0119e, 0x71865846, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0x71865846, 0x71865846, 0x9813a416, }, 20 }, +- { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x4e4844e0, 0x5ebe5f81, 0x4e4844e0, 0x38ee7153, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x38ee7153, 0x38ee7153, 0x5fcf013d, }, 20 }, +- { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x701427d4, 0x246c830a, 0x701427d4, 0x6b11fdd3, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0x6b11fdd3, 0x6b11fdd3, 0xdd28f52b, }, 20 }, +- { "gfxterm_menu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x7b5bd4c, 0xac246af1, 0x7b5bd4c, 0xf80aa6cc, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0xf80aa6cc, 0xf80aa6cc, 0x43d1f34, }, 20 }, +- { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1027210c, 0x64e51c81, 0x1027210c, 0x45ca4a8a, 0x9a2e0d26, 0x12fd0f21, 0x12fd0f21, 0x12fd0f21, 0x4e25f9e1, 0x4e25f9e1, 0x4e25f9e1, 0x67bd3773, 0x67bd3773, 0x67bd3773, 0x59c36f00, 0x45ca4a8a, 0x45ca4a8a, }, 18 }, +- { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8d12f697, 0xc5b32248, 0x8d12f697, 0x56720aa4, 0xa9d58ccd, 0xf766a14d, 0xf766a14d, 0xf766a14d, 0xa2390b47, 0xa2390b47, 0xa2390b47, 0xcb0ac30e, 0xcb0ac30e, 0xcb0ac30e, 0xaa4593fe, 0x56720aa4, 0x56720aa4, }, 18 }, +- { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa5ec9f45, 0xdb7085d8, 0xa5ec9f45, 0x9caf1d3f, 0x5411be8b, 0xedc0ad83, 0xedc0ad83, 0xedc0ad83, 0x927e0b17, 0x927e0b17, 0x927e0b17, 0xd00a6b6f, 0xd00a6b6f, 0xd00a6b6f, 0xc9cbf769, 0x9caf1d3f, 0x9caf1d3f, }, 18 }, +- { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xce8e83bf, 0xeb96c838, 0xce8e83bf, 0x73cb3bc1, 0x740d78cf, 0xb35c7e64, 0xb35c7e64, 0xb35c7e64, 0x58f99418, 0x58f99418, 0x58f99418, 0x5eb294e8, 0x5eb294e8, 0x5eb294e8, 0x1c3742c9, 0x73cb3bc1, 0x73cb3bc1, }, 18 }, +- { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x56a03e51, 0xee7d8d4b, 0x56a03e51, 0x5bdf9413, 0xbcda144c, 0x220f7a5e, 0x220f7a5e, 0x220f7a5e, 0x4d46a64f, 0x4d46a64f, 0x4d46a64f, 0x40b0384c, 0x40b0384c, 0x40b0384c, 0xcc5a7bed, 0x5bdf9413, 0x5bdf9413, }, 18 }, +- { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0xea8a9cf0, 0x8929e522, 0xea8a9cf0, 0x78f3dfbc, 0x5d55a141, 0x377f1aeb, 0x377f1aeb, 0x377f1aeb, 0xf1cd5ef5, 0xf1cd5ef5, 0xf1cd5ef5, 0xe5a88e4a, 0xe5a88e4a, 0xe5a88e4a, 0xef4a3312, 0x78f3dfbc, 0x78f3dfbc, }, 18 }, +- { "gfxmenu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x54e48d80, 0x6dcf1d57, 0x925a4c8f, 0x6dcf1d57, 0x69005b38, 0x6d6bb4bc, 0x756a36b9, 0x756a36b9, 0x756a36b9, 0xf499c068, 0xf499c068, 0xf499c068, 0x623d7907, 0x623d7907, 0x623d7907, 0x54e48d80, 0x69005b38, 0x69005b38, }, 18 }, +- { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa49d26b0, 0xaa7d9b28, 0xa49d26b0, 0xe76bebf7, 0x59c36f00, 0x59c36f00, 0xea6ab252, 0xea6ab252, 0xea6ab252, 0x94eadf34, 0x94eadf34, 0x94eadf34, 0xf61ccae6, 0xf61ccae6, 0xf61ccae6, 0x59c36f00, 0xe76bebf7, 0xe76bebf7, 0x59c36f00, }, 20 }, +- { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x7a277db, 0xf3bf80f7, 0x7a277db, 0x29a7f2a4, 0xaa4593fe, 0xaa4593fe, 0xf1cd57e3, 0xf1cd57e3, 0xf1cd57e3, 0x57385a84, 0x57385a84, 0x57385a84, 0x7a00f1fc, 0x7a00f1fc, 0x7a00f1fc, 0xaa4593fe, 0x29a7f2a4, 0x29a7f2a4, 0xaa4593fe, }, 20 }, +- { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x631edf85, 0x71926408, 0x631edf85, 0x3e09b201, 0xc9cbf769, 0xc9cbf769, 0xf224ab3, 0xf224ab3, 0xf224ab3, 0xf1fa8b7f, 0xf1fa8b7f, 0xf1fa8b7f, 0x18b03477, 0x18b03477, 0x18b03477, 0xc9cbf769, 0x3e09b201, 0x3e09b201, 0xc9cbf769, }, 20 }, +- { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xfbaf4635, 0xe69ef474, 0xfbaf4635, 0x55f90fed, 0x9813a416, 0x9813a416, 0x3aad8f41, 0x3aad8f41, 0x3aad8f41, 0xab760972, 0xab760972, 0xab760972, 0xb2cc34a2, 0xb2cc34a2, 0xb2cc34a2, 0x9813a416, 0x55f90fed, 0x55f90fed, 0x9813a416, }, 20 }, +- { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xdce50745, 0x1d8009e4, 0xdce50745, 0xaa4332f6, 0x5fcf013d, 0x5fcf013d, 0x354e5749, 0x354e5749, 0x354e5749, 0xe75e4f3f, 0xe75e4f3f, 0xe75e4f3f, 0xf12d70a0, 0xf12d70a0, 0xf12d70a0, 0x5fcf013d, 0xaa4332f6, 0xaa4332f6, 0x5fcf013d, }, 20 }, +- { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x3efebeff, 0xf101dfe2, 0x3efebeff, 0x25fb64f8, 0xdd28f52b, 0xdd28f52b, 0x70c69ebd, 0x70c69ebd, 0x70c69ebd, 0x51fa6759, 0x51fa6759, 0x51fa6759, 0x2c42acd5, 0x2c42acd5, 0x2c42acd5, 0xdd28f52b, 0x25fb64f8, 0x25fb64f8, 0xdd28f52b, }, 20 }, +- { "gfxterm_ar", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x59a34c64, 0x281cca78, 0x59a34c64, 0xa61c57e4, 0x43d1f34, 0x43d1f34, 0x95131d4, 0x95131d4, 0x95131d4, 0x765b987c, 0x765b987c, 0x765b987c, 0xef0a9dfa, 0xef0a9dfa, 0xef0a9dfa, 0x43d1f34, 0xa61c57e4, 0xa61c57e4, 0x43d1f34, }, 20 }, +- { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa37c165, 0x72063383, 0xa37c165, 0x49c10c22, 0x59c36f00, 0x59c36f00, 0x4e53de8e, 0x4e53de8e, 0x4e53de8e, 0x30d3b3e8, 0x30d3b3e8, 0x30d3b3e8, 0x5225a63a, 0x5225a63a, 0x5225a63a, 0x59c36f00, 0x49c10c22, 0x49c10c22, 0x59c36f00, }, 20 }, +- { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x45bba0ba, 0xe60fd0b6, 0x45bba0ba, 0x6bbe25c5, 0xaa4593fe, 0xaa4593fe, 0x28de2b41, 0x28de2b41, 0x28de2b41, 0x8e2b2626, 0x8e2b2626, 0x8e2b2626, 0xa3138d5e, 0xa3138d5e, 0xa3138d5e, 0xaa4593fe, 0x6bbe25c5, 0x6bbe25c5, 0xaa4593fe, }, 20 }, +- { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb43d4e9d, 0x16f88820, 0xb43d4e9d, 0xe92a2319, 0xc9cbf769, 0xc9cbf769, 0xb8959ec7, 0xb8959ec7, 0xb8959ec7, 0x464d5f0b, 0x464d5f0b, 0x464d5f0b, 0xaf07e003, 0xaf07e003, 0xaf07e003, 0xc9cbf769, 0xe92a2319, 0xe92a2319, 0xc9cbf769, }, 20 }, +- { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x46760365, 0x685ae30e, 0x46760365, 0xe8204abd, 0x9813a416, 0x9813a416, 0x8896050a, 0x8896050a, 0x8896050a, 0x194d8339, 0x194d8339, 0x194d8339, 0xf7bee9, 0xf7bee9, 0xf7bee9, 0x9813a416, 0xe8204abd, 0xe8204abd, 0x9813a416, }, 20 }, +- { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6859aa86, 0xf3f11deb, 0x6859aa86, 0x1eff9f35, 0x5fcf013d, 0x5fcf013d, 0xd72b1482, 0xd72b1482, 0xd72b1482, 0x53b0cf4, 0x53b0cf4, 0x53b0cf4, 0x1348336b, 0x1348336b, 0x1348336b, 0x5fcf013d, 0x1eff9f35, 0x1eff9f35, 0x5fcf013d, }, 20 }, +- { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x688451e7, 0xf6936b72, 0x688451e7, 0x73818be0, 0xdd28f52b, 0xdd28f52b, 0xf12a65ac, 0xf12a65ac, 0xf12a65ac, 0xd0169c48, 0xd0169c48, 0xd0169c48, 0xadae57c4, 0xadae57c4, 0xadae57c4, 0xdd28f52b, 0x73818be0, 0x73818be0, 0xdd28f52b, }, 20 }, +- { "gfxterm_cyr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x9616af94, 0xd466be40, 0x9616af94, 0x69a9b414, 0x43d1f34, 0x43d1f34, 0xf3bb3240, 0xf3bb3240, 0xf3bb3240, 0x8cb19be8, 0x8cb19be8, 0x8cb19be8, 0x15e09e6e, 0x15e09e6e, 0x15e09e6e, 0x43d1f34, 0x69a9b414, 0x69a9b414, 0x43d1f34, }, 20 }, +- { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x8708d1bd, 0x85dd5e9c, 0x8708d1bd, 0xc4fe1cfa, 0x59c36f00, 0x59c36f00, 0x7ae8aced, 0x7ae8aced, 0x7ae8aced, 0x468c18b, 0x468c18b, 0x468c18b, 0x669ed459, 0x669ed459, 0x669ed459, 0x59c36f00, 0xc4fe1cfa, 0xc4fe1cfa, 0x59c36f00, }, 20 }, +- { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa72b1043, 0x147d4ce0, 0xa72b1043, 0x892e953c, 0xaa4593fe, 0xaa4593fe, 0xb7b1dd40, 0xb7b1dd40, 0xb7b1dd40, 0x1144d027, 0x1144d027, 0x1144d027, 0x3c7c7b5f, 0x3c7c7b5f, 0x3c7c7b5f, 0xaa4593fe, 0x892e953c, 0x892e953c, 0xaa4593fe, }, 20 }, +- { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xc5fb1817, 0x745fb26c, 0xc5fb1817, 0x98ec7593, 0xc9cbf769, 0xc9cbf769, 0xf5f17e2d, 0xf5f17e2d, 0xf5f17e2d, 0xb29bfe1, 0xb29bfe1, 0xb29bfe1, 0xe26300e9, 0xe26300e9, 0xe26300e9, 0xc9cbf769, 0x98ec7593, 0x98ec7593, 0xc9cbf769, }, 20 }, +- { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4be837e1, 0xbf4963ca, 0x4be837e1, 0xe5be7e39, 0x9813a416, 0x9813a416, 0xd886fca0, 0xd886fca0, 0xd886fca0, 0x495d7a93, 0x495d7a93, 0x495d7a93, 0x50e74743, 0x50e74743, 0x50e74743, 0x9813a416, 0xe5be7e39, 0xe5be7e39, 0x9813a416, }, 20 }, +- { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x21a8ccb8, 0x17719be, 0x21a8ccb8, 0x570ef90b, 0x5fcf013d, 0x5fcf013d, 0x2a7b5333, 0x2a7b5333, 0x2a7b5333, 0xf86b4b45, 0xf86b4b45, 0xf86b4b45, 0xee1874da, 0xee1874da, 0xee1874da, 0x5fcf013d, 0x570ef90b, 0x570ef90b, 0x5fcf013d, }, 20 }, +- { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7001fe50, 0x4798153f, 0x7001fe50, 0x6b042457, 0xdd28f52b, 0xdd28f52b, 0x46489369, 0x46489369, 0x46489369, 0x67746a8d, 0x67746a8d, 0x67746a8d, 0x1acca101, 0x1acca101, 0x1acca101, 0xdd28f52b, 0x6b042457, 0x6b042457, 0xdd28f52b, }, 20 }, +- { "gfxterm_heb", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x6e10591c, 0x48bd926e, 0x6e10591c, 0x91af429c, 0x43d1f34, 0x43d1f34, 0x59cb829, 0x59cb829, 0x59cb829, 0x7a961181, 0x7a961181, 0x7a961181, 0xe3c71407, 0xe3c71407, 0xe3c71407, 0x43d1f34, 0x91af429c, 0x91af429c, 0x43d1f34, }, 20 }, +- { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x67627ed5, 0xdb276cef, 0x67627ed5, 0x2494b392, 0x59c36f00, 0x59c36f00, 0x43f511f3, 0x43f511f3, 0x43f511f3, 0x3d757c95, 0x3d757c95, 0x3d757c95, 0x5f836947, 0x5f836947, 0x5f836947, 0x59c36f00, 0x2494b392, 0x2494b392, 0x59c36f00, }, 20 }, +- { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x987cbf71, 0x6e4c645c, 0x987cbf71, 0xb6793a0e, 0xaa4593fe, 0xaa4593fe, 0xb943d716, 0xb943d716, 0xb943d716, 0x1fb6da71, 0x1fb6da71, 0x1fb6da71, 0x328e7109, 0x328e7109, 0x328e7109, 0xaa4593fe, 0xb6793a0e, 0xb6793a0e, 0xaa4593fe, }, 20 }, +- { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf9987c07, 0x4a92eed9, 0xf9987c07, 0xa48f1183, 0xc9cbf769, 0xc9cbf769, 0x5eb3ddf4, 0x5eb3ddf4, 0x5eb3ddf4, 0xa06b1c38, 0xa06b1c38, 0xa06b1c38, 0x4921a330, 0x4921a330, 0x4921a330, 0xc9cbf769, 0xa48f1183, 0xa48f1183, 0xc9cbf769, }, 20 }, +- { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xccd804e2, 0xb99e8d91, 0xccd804e2, 0x628e4d3a, 0x9813a416, 0x9813a416, 0x5aec5acc, 0x5aec5acc, 0x5aec5acc, 0xcb37dcff, 0xcb37dcff, 0xcb37dcff, 0xd28de12f, 0xd28de12f, 0xd28de12f, 0x9813a416, 0x628e4d3a, 0x628e4d3a, 0x9813a416, }, 20 }, +- { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x4990d896, 0x2b3aa242, 0x4990d896, 0x3f36ed25, 0x5fcf013d, 0x5fcf013d, 0x3cc6048d, 0x3cc6048d, 0x3cc6048d, 0xeed61cfb, 0xeed61cfb, 0xeed61cfb, 0xf8a52364, 0xf8a52364, 0xf8a52364, 0x5fcf013d, 0x3f36ed25, 0x3f36ed25, 0x5fcf013d, }, 20 }, +- { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x4ff5c69f, 0x66586489, 0x4ff5c69f, 0x54f01c98, 0xdd28f52b, 0xdd28f52b, 0xc3ff0bf5, 0xc3ff0bf5, 0xc3ff0bf5, 0xe2c3f211, 0xe2c3f211, 0xe2c3f211, 0x9f7b399d, 0x9f7b399d, 0x9f7b399d, 0xdd28f52b, 0x54f01c98, 0x54f01c98, 0xdd28f52b, }, 20 }, +- { "gfxterm_gre", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x909b7bb4, 0x2bb2a58c, 0x909b7bb4, 0x6f246034, 0x43d1f34, 0x43d1f34, 0x2df40751, 0x2df40751, 0x2df40751, 0x52feaef9, 0x52feaef9, 0x52feaef9, 0xcbafab7f, 0xcbafab7f, 0xcbafab7f, 0x43d1f34, 0x6f246034, 0x6f246034, 0x43d1f34, }, 20 }, +- { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xc77bfcc6, 0xffcdf45d, 0xc77bfcc6, 0x848d3181, 0x59c36f00, 0x59c36f00, 0xd79cd5e, 0xd79cd5e, 0xd79cd5e, 0x73f9a038, 0x73f9a038, 0x73f9a038, 0x110fb5ea, 0x110fb5ea, 0x110fb5ea, 0x59c36f00, 0x848d3181, 0x848d3181, 0x59c36f00, }, 20 }, +- { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5494aa5, 0xa0924ec, 0xd5494aa5, 0xfb4ccfda, 0xaa4593fe, 0xaa4593fe, 0x8692c636, 0x8692c636, 0x8692c636, 0x2067cb51, 0x2067cb51, 0x2067cb51, 0xd5f6029, 0xd5f6029, 0xd5f6029, 0xaa4593fe, 0xfb4ccfda, 0xfb4ccfda, 0xaa4593fe, }, 20 }, +- { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x2436c4f, 0x2cde4e0c, 0x2436c4f, 0x5f5401cb, 0xc9cbf769, 0xc9cbf769, 0x558f50ae, 0x558f50ae, 0x558f50ae, 0xab579162, 0xab579162, 0xab579162, 0x421d2e6a, 0x421d2e6a, 0x421d2e6a, 0xc9cbf769, 0x5f5401cb, 0x5f5401cb, 0xc9cbf769, }, 20 }, +- { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x86f8a68c, 0xf4116451, 0x86f8a68c, 0x28aeef54, 0x9813a416, 0x9813a416, 0x7befbe43, 0x7befbe43, 0x7befbe43, 0xea343870, 0xea343870, 0xea343870, 0xf38e05a0, 0xf38e05a0, 0xf38e05a0, 0x9813a416, 0x28aeef54, 0x28aeef54, 0x9813a416, }, 20 }, +- { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x156c292f, 0x3c8eb473, 0x156c292f, 0x63ca1c9c, 0x5fcf013d, 0x5fcf013d, 0x895ea16b, 0x895ea16b, 0x895ea16b, 0x5b4eb91d, 0x5b4eb91d, 0x5b4eb91d, 0x4d3d8682, 0x4d3d8682, 0x4d3d8682, 0x5fcf013d, 0x63ca1c9c, 0x63ca1c9c, 0x5fcf013d, }, 20 }, +- { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf57ebf12, 0x798b299b, 0xf57ebf12, 0xee7b6515, 0xdd28f52b, 0xdd28f52b, 0x22563fc6, 0x22563fc6, 0x22563fc6, 0x36ac622, 0x36ac622, 0x36ac622, 0x7ed20dae, 0x7ed20dae, 0x7ed20dae, 0xdd28f52b, 0xee7b6515, 0xee7b6515, 0xdd28f52b, }, 20 }, +- { "gfxterm_ru", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x2bc82eb1, 0x94064cc8, 0x2bc82eb1, 0xd4773531, 0x43d1f34, 0x43d1f34, 0x44cbf2f0, 0x44cbf2f0, 0x44cbf2f0, 0x3bc15b58, 0x3bc15b58, 0x3bc15b58, 0xa2905ede, 0xa2905ede, 0xa2905ede, 0x43d1f34, 0xd4773531, 0xd4773531, 0x43d1f34, }, 20 }, +- { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7f6dd146, 0x548af474, 0x7f6dd146, 0x3c9b1c01, 0x59c36f00, 0x59c36f00, 0x7d913e8d, 0x7d913e8d, 0x7d913e8d, 0x31153eb, 0x31153eb, 0x31153eb, 0x61e74639, 0x61e74639, 0x61e74639, 0x59c36f00, 0x3c9b1c01, 0x3c9b1c01, 0x59c36f00, }, 20 }, +- { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xf29ad079, 0x50d47c0, 0xf29ad079, 0xdc9f5506, 0xaa4593fe, 0xaa4593fe, 0x6bcf4c90, 0x6bcf4c90, 0x6bcf4c90, 0xcd3a41f7, 0xcd3a41f7, 0xcd3a41f7, 0xe002ea8f, 0xe002ea8f, 0xe002ea8f, 0xaa4593fe, 0xdc9f5506, 0xdc9f5506, 0xaa4593fe, }, 20 }, +- { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb25e3082, 0x2ed845dd, 0xb25e3082, 0xef495d06, 0xc9cbf769, 0xc9cbf769, 0xd5322575, 0xd5322575, 0xd5322575, 0x2beae4b9, 0x2beae4b9, 0x2beae4b9, 0xc2a05bb1, 0xc2a05bb1, 0xc2a05bb1, 0xc9cbf769, 0xef495d06, 0xef495d06, 0xc9cbf769, }, 20 }, +- { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4cdfcd2e, 0x8bf091f, 0x4cdfcd2e, 0xe28984f6, 0x9813a416, 0x9813a416, 0x8217f630, 0x8217f630, 0x8217f630, 0x13cc7003, 0x13cc7003, 0x13cc7003, 0xa764dd3, 0xa764dd3, 0xa764dd3, 0x9813a416, 0xe28984f6, 0xe28984f6, 0x9813a416, }, 20 }, +- { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf2b49f88, 0x2eff252d, 0xf2b49f88, 0x8412aa3b, 0x5fcf013d, 0x5fcf013d, 0x5d3b9fe7, 0x5d3b9fe7, 0x5d3b9fe7, 0x8f2b8791, 0x8f2b8791, 0x8f2b8791, 0x9958b80e, 0x9958b80e, 0x9958b80e, 0x5fcf013d, 0x8412aa3b, 0x8412aa3b, 0x5fcf013d, }, 20 }, +- { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x786673be, 0x536f1359, 0x786673be, 0x6363a9b9, 0xdd28f52b, 0xdd28f52b, 0x38653b12, 0x38653b12, 0x38653b12, 0x1959c2f6, 0x1959c2f6, 0x1959c2f6, 0x64e1097a, 0x64e1097a, 0x64e1097a, 0xdd28f52b, 0x6363a9b9, 0x6363a9b9, 0xdd28f52b, }, 20 }, +- { "gfxterm_fr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xac4a1127, 0x699c2ad8, 0xac4a1127, 0x53f50aa7, 0x43d1f34, 0x43d1f34, 0xfa47dfba, 0xfa47dfba, 0xfa47dfba, 0x854d7612, 0x854d7612, 0x854d7612, 0x1c1c7394, 0x1c1c7394, 0x1c1c7394, 0x43d1f34, 0x53f50aa7, 0x53f50aa7, 0x43d1f34, }, 20 }, +- { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbc5f6633, 0xda908ab0, 0xbc5f6633, 0xffa9ab74, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0xffa9ab74, 0xffa9ab74, 0x59c36f00, }, 20 }, +- { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xad820d6b, 0x9a88ad3, 0xad820d6b, 0x83878814, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0x83878814, 0x83878814, 0xaa4593fe, }, 20 }, +- { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe5774112, 0x5ffb1eca, 0xe5774112, 0xb8602c96, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0xb8602c96, 0xb8602c96, 0xc9cbf769, }, 20 }, +- { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x6af1a2bc, 0xd951ab8b, 0x6af1a2bc, 0xc4a7eb64, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0xc4a7eb64, 0xc4a7eb64, 0x9813a416, }, 20 }, +- { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xc6baa18, 0x1c9db179, 0xc6baa18, 0x7acd9fab, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x7acd9fab, 0x7acd9fab, 0x5fcf013d, }, 20 }, +- { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xe424a6ab, 0xb05c0275, 0xe424a6ab, 0xff217cac, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0xff217cac, 0xff217cac, 0xdd28f52b, }, 20 }, +- { "gfxterm_quot", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x4a7dff41, 0xe1ec28fc, 0x4a7dff41, 0xb5c2e4c1, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0xb5c2e4c1, 0xb5c2e4c1, 0x43d1f34, }, 20 }, +- { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd3d3e4a2, 0x9c635046, 0xd3d3e4a2, 0x902529e5, 0x59c36f00, 0x59c36f00, 0x85e713, 0x85e713, 0x85e713, 0x7e058a75, 0x7e058a75, 0x7e058a75, 0x1cf39fa7, 0x1cf39fa7, 0x1cf39fa7, 0x59c36f00, 0x902529e5, 0x902529e5, 0x59c36f00, }, 20 }, +- { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd61c80f5, 0xdf78b496, 0xd61c80f5, 0xf819058a, 0xaa4593fe, 0xaa4593fe, 0xefc0f7e7, 0xefc0f7e7, 0xefc0f7e7, 0x4935fa80, 0x4935fa80, 0x4935fa80, 0x640d51f8, 0x640d51f8, 0x640d51f8, 0xaa4593fe, 0xf819058a, 0xf819058a, 0xaa4593fe, }, 20 }, +- { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x936bc89d, 0x523a3e80, 0x936bc89d, 0xce7ca519, 0xc9cbf769, 0xc9cbf769, 0xaa99ffb1, 0xaa99ffb1, 0xaa99ffb1, 0x54413e7d, 0x54413e7d, 0x54413e7d, 0xbd0b8175, 0xbd0b8175, 0xbd0b8175, 0xc9cbf769, 0xce7ca519, 0xce7ca519, 0xc9cbf769, }, 20 }, +- { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4fdd0291, 0x133fa83d, 0x4fdd0291, 0xe18b4b49, 0x9813a416, 0x9813a416, 0x74c38e90, 0x74c38e90, 0x74c38e90, 0xe51808a3, 0xe51808a3, 0xe51808a3, 0xfca23573, 0xfca23573, 0xfca23573, 0x9813a416, 0xe18b4b49, 0xe18b4b49, 0x9813a416, }, 20 }, +- { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x538203b0, 0x2a92e789, 0x538203b0, 0x25243603, 0x5fcf013d, 0x5fcf013d, 0x5e4d3dd8, 0x5e4d3dd8, 0x5e4d3dd8, 0x8c5d25ae, 0x8c5d25ae, 0x8c5d25ae, 0x9a2e1a31, 0x9a2e1a31, 0x9a2e1a31, 0x5fcf013d, 0x25243603, 0x25243603, 0x5fcf013d, }, 20 }, +- { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xcfc85125, 0xa5b0e11b, 0xcfc85125, 0xd4cd8b22, 0xdd28f52b, 0xdd28f52b, 0x1af8cddc, 0x1af8cddc, 0x1af8cddc, 0x3bc43438, 0x3bc43438, 0x3bc43438, 0x467cffb4, 0x467cffb4, 0x467cffb4, 0xdd28f52b, 0xd4cd8b22, 0xd4cd8b22, 0xdd28f52b, }, 20 }, +- { "gfxterm_piglatin", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xf2469ffb, 0x1d0c1d2, 0xf2469ffb, 0xdf9847b, 0x43d1f34, 0x43d1f34, 0xa2837c7a, 0xa2837c7a, 0xa2837c7a, 0xdd89d5d2, 0xdd89d5d2, 0xdd89d5d2, 0x44d8d054, 0x44d8d054, 0x44d8d054, 0x43d1f34, 0xdf9847b, 0xdf9847b, 0x43d1f34, }, 20 }, +- { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x27851cc1, 0x15f731b5, 0x27851cc1, 0x6473d186, 0x59c36f00, 0x59c36f00, 0x125bcddf, 0x125bcddf, 0x125bcddf, 0x6cdba0b9, 0x6cdba0b9, 0x6cdba0b9, 0xe2db56b, 0xe2db56b, 0xe2db56b, 0x59c36f00, 0x6473d186, 0x6473d186, 0x59c36f00, }, 20 }, +- { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xfcb223c, 0x2c2e18b9, 0xfcb223c, 0x21cea743, 0xaa4593fe, 0xaa4593fe, 0xd700be1a, 0xd700be1a, 0xd700be1a, 0x71f5b37d, 0x71f5b37d, 0x71f5b37d, 0x5ccd1805, 0x5ccd1805, 0x5ccd1805, 0xaa4593fe, 0x21cea743, 0x21cea743, 0xaa4593fe, }, 20 }, +- { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x807efaa5, 0xb673036a, 0x807efaa5, 0xdd699721, 0xc9cbf769, 0xc9cbf769, 0xdca3ed4b, 0xdca3ed4b, 0xdca3ed4b, 0x227b2c87, 0x227b2c87, 0x227b2c87, 0xcb31938f, 0xcb31938f, 0xcb31938f, 0xc9cbf769, 0xdd699721, 0xdd699721, 0xc9cbf769, }, 20 }, +- { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x651d0d50, 0xf0dc38fc, 0x651d0d50, 0xcb4b4488, 0x9813a416, 0x9813a416, 0x80d03ee8, 0x80d03ee8, 0x80d03ee8, 0x110bb8db, 0x110bb8db, 0x110bb8db, 0x8b1850b, 0x8b1850b, 0x8b1850b, 0x9813a416, 0xcb4b4488, 0xcb4b4488, 0x9813a416, }, 20 }, +- { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xb9b068f, 0xdc68ac3c, 0xb9b068f, 0x7d3d333c, 0x5fcf013d, 0x5fcf013d, 0xa1f0a6e4, 0xa1f0a6e4, 0xa1f0a6e4, 0x73e0be92, 0x73e0be92, 0x73e0be92, 0x6593810d, 0x6593810d, 0x6593810d, 0x5fcf013d, 0x7d3d333c, 0x7d3d333c, 0x5fcf013d, }, 20 }, +- { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf0789d7e, 0x6f2f2b61, 0xf0789d7e, 0xeb7d4779, 0xdd28f52b, 0xdd28f52b, 0xb995630, 0xb995630, 0xb995630, 0x2aa5afd4, 0x2aa5afd4, 0x2aa5afd4, 0x571d6458, 0x571d6458, 0x571d6458, 0xdd28f52b, 0xeb7d4779, 0xeb7d4779, 0xdd28f52b, }, 20 }, +- { "gfxterm_ch", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x819821ff, 0xdd19128c, 0x819821ff, 0x7e273a7f, 0x43d1f34, 0x43d1f34, 0xf35981d3, 0xf35981d3, 0xf35981d3, 0x8c53287b, 0x8c53287b, 0x8c53287b, 0x15022dfd, 0x15022dfd, 0x15022dfd, 0x43d1f34, 0x7e273a7f, 0x7e273a7f, 0x43d1f34, }, 20 }, +- { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa99604d1, 0xcf59e852, 0xa99604d1, 0xfebbba0f, 0x59c36f00, 0x59c36f00, 0x53767ce3, 0x53767ce3, 0x53767ce3, 0x2df61185, 0x2df61185, 0x2df61185, 0x4f000457, 0x4f000457, 0x4f000457, 0x59c36f00, 0xfebbba0f, 0xfebbba0f, 0x59c36f00, }, 20 }, +- { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x7d0a218, 0xa3fa25a0, 0x7d0a218, 0xb777784e, 0xaa4593fe, 0xaa4593fe, 0x35db26e1, 0x35db26e1, 0x35db26e1, 0x932e2b86, 0x932e2b86, 0x932e2b86, 0xbe1680fe, 0xbe1680fe, 0xbe1680fe, 0xaa4593fe, 0xb777784e, 0xb777784e, 0xaa4593fe, }, 20 }, +- { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x63be90f4, 0xd932cf2c, 0x63be90f4, 0x739b8e5a, 0xc9cbf769, 0xc9cbf769, 0x70a00efe, 0x70a00efe, 0x70a00efe, 0x8e78cf32, 0x8e78cf32, 0x8e78cf32, 0x6732703a, 0x6732703a, 0x6732703a, 0xc9cbf769, 0x739b8e5a, 0x739b8e5a, 0xc9cbf769, }, 20 }, +- { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x53460c90, 0xe0e605a7, 0x53460c90, 0x6337f0bf, 0x9813a416, 0x9813a416, 0x4161864c, 0x4161864c, 0x4161864c, 0xd0ba007f, 0xd0ba007f, 0xd0ba007f, 0xc9003daf, 0xc9003daf, 0xc9003daf, 0x9813a416, 0x6337f0bf, 0x6337f0bf, 0x9813a416, }, 20 }, +- { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf54761a0, 0xe5b17ac1, 0xf54761a0, 0x5b408e55, 0x5fcf013d, 0x5fcf013d, 0x580fda0e, 0x580fda0e, 0x580fda0e, 0x8a1fc278, 0x8a1fc278, 0x8a1fc278, 0x9c6cfde7, 0x9c6cfde7, 0x9c6cfde7, 0x5fcf013d, 0x5b408e55, 0x5b408e55, 0x5fcf013d, }, 20 }, +- { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xec78b0c1, 0xb800141f, 0xec78b0c1, 0x621c7b1b, 0xdd28f52b, 0xdd28f52b, 0x8f60179, 0x8f60179, 0x8f60179, 0x29caf89d, 0x29caf89d, 0x29caf89d, 0x54723311, 0x54723311, 0x54723311, 0xdd28f52b, 0x621c7b1b, 0x621c7b1b, 0xdd28f52b, }, 20 }, +- { "gfxterm_red", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xf209411b, 0x599896a6, 0xf209411b, 0x6551c7bb, 0x43d1f34, 0x43d1f34, 0x5ac6bb4a, 0x5ac6bb4a, 0x5ac6bb4a, 0x25cc12e2, 0x25cc12e2, 0x25cc12e2, 0xbc9d1764, 0xbc9d1764, 0xbc9d1764, 0x43d1f34, 0x6551c7bb, 0x6551c7bb, 0x43d1f34, }, 20 }, +- { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x93b4fcd8, 0xf57b105b, 0x93b4fcd8, 0x2bfe5312, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0x2bfe5312, 0x2bfe5312, 0x59c36f00, }, 20 }, +- { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x656c9044, 0xc14617fc, 0x656c9044, 0xa6ea58cb, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0xa6ea58cb, 0xa6ea58cb, 0xaa4593fe, }, 20 }, +- { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa11479ed, 0x1b982635, 0xa11479ed, 0xe37185d0, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0xe37185d0, 0xe37185d0, 0xc9cbf769, }, 20 }, +- { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x244770a7, 0x97e77990, 0x244770a7, 0x6a54d2ee, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0x6a54d2ee, 0x6a54d2ee, 0x9813a416, }, 20 }, +- { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x8ca34476, 0x9c555f17, 0x8ca34476, 0x1fc54b41, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x1fc54b41, 0x1fc54b41, 0x5fcf013d, }, 20 }, +- { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf19f6af8, 0xa5e7ce26, 0xf19f6af8, 0x1619aea6, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0x1619aea6, 0x1619aea6, 0xdd28f52b, }, 20 }, +- { "gfxterm_high", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x5f75414f, 0xf4e496f2, 0x5f75414f, 0x27fd1fe0, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0x27fd1fe0, 0x27fd1fe0, 0x43d1f34, }, 20 }, ++ { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x8851b0ee, 0x8851b0ee, 0xafb59f0b, 0xafb59f0b, 0x8c9b72f1, 0x8c9b72f1, 0x6eec5116, 0x6eec5116, 0xad82053e, 0xad82053e, 0x2eeae2ae, 0x2eeae2ae, 0x58cf8def, 0x58cf8def, 0x926f4d2f, 0x926f4d2f, 0xbd1c3236, 0xbd1c3236, 0x56012a95, 0x56012a95, 0x6d7c40ae, 0x6d7c40ae, 0xef750bc8, 0xef750bc8, 0x1080dd4a, 0x1080dd4a, 0xd7f9e5af, 0xd7f9e5af, 0x80b1b4a9, 0x80b1b4a9, 0x2c99415e, 0x2c99415e, 0x8d5761ff, 0x8d5761ff, 0xb964b489, 0xb964b489, 0x88a51f74, 0x88a51f74, 0x1da6c458, 0x1da6c458, 0x85e94025, 0x206ea54f, 0x7ee6c8fd, 0x7ee6c8fd, }, 45 }, ++ { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x834b70a0, 0x834b70a0, 0xe7cc129f, 0xe7cc129f, 0x5ee2edc, 0x5ee2edc, 0xa1135cd7, 0xa1135cd7, 0xf7ce1f26, 0xf7ce1f26, 0xe9f803e8, 0xe9f803e8, 0x4b8f9724, 0x4b8f9724, 0x3fe3771a, 0x3fe3771a, 0x5584ee63, 0x5584ee63, 0xac193250, 0xac193250, 0x801f25f4, 0x801f25f4, 0x8d33aece, 0x8d33aece, 0xc6d95edc, 0xc6d95edc, 0xf121dee2, 0xf121dee2, 0x6ab10812, 0x6ab10812, 0x41a5b112, 0x41a5b112, 0xac6f712b, 0xac6f712b, 0x8aee7a19, 0x8aee7a19, 0xfe37c0ad, 0xfe37c0ad, 0x99c6a336, 0x99c6a336, 0x53b844c6, 0x73015447, 0x7a1a2254, 0x7a1a2254, }, 45 }, ++ { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb121c912, 0xb121c912, 0x635a8739, 0x635a8739, 0x8288cba6, 0x8288cba6, 0xf5589d0, 0xf5589d0, 0x471642b3, 0x471642b3, 0xfb4826cf, 0xfb4826cf, 0x8b1083cf, 0x8b1083cf, 0x738b0c94, 0x738b0c94, 0x859c41b0, 0x859c41b0, 0x7c8d1be9, 0x7c8d1be9, 0x5b685e40, 0x5b685e40, 0x9cf80d95, 0x9cf80d95, 0x3541f915, 0x3541f915, 0x582b8557, 0x582b8557, 0x24cf88f7, 0x24cf88f7, 0x9e0af23, 0x9e0af23, 0x1033164b, 0x1033164b, 0x70ba51e2, 0x70ba51e2, 0xb051585c, 0xb051585c, 0xe1389f04, 0xe1389f04, 0x308bbb74, 0xdc9e6805, 0x4ddcff9f, 0x4ddcff9f, }, 45 }, ++ { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xac16e832, 0xac16e832, 0xbf6ab9c6, 0xbf6ab9c6, 0x1063e15a, 0x1063e15a, 0xf908e3ff, 0xf908e3ff, 0xcb37d841, 0xcb37d841, 0x9b8ffa7d, 0x9b8ffa7d, 0x38d2a26c, 0x38d2a26c, 0x6989f09b, 0x6989f09b, 0x481451e, 0x481451e, 0x17b3177, 0x17b3177, 0x3ea52aeb, 0x3ea52aeb, 0xc24de674, 0xc24de674, 0x4ab163cc, 0x4ab163cc, 0xc482b092, 0xc482b092, 0x55ffc7e2, 0x55ffc7e2, 0x3b4b34dd, 0x3b4b34dd, 0x9b1f047f, 0x9b1f047f, 0x3d42e414, 0x3d42e414, 0x35b2fb06, 0x35b2fb06, 0xb813b35f, 0xb813b35f, 0xc3ede6e0, 0xc35214c3, 0x340f0107, 0x340f0107, }, 45 }, ++ { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x9c47caee, 0x9c47caee, 0x6c9c4f38, 0x6c9c4f38, 0x79c49615, 0x79c49615, 0x70fe9708, 0x70fe9708, 0x8e90c077, 0x8e90c077, 0xd8205b47, 0xd8205b47, 0xa34337e2, 0xa34337e2, 0xf4dffa53, 0xf4dffa53, 0x90a0779c, 0x90a0779c, 0x322820bb, 0x322820bb, 0x50e3383f, 0x50e3383f, 0x4a976e3e, 0x4a976e3e, 0x90b6f8d9, 0x90b6f8d9, 0x4058c301, 0x4058c301, 0x221a6810, 0x221a6810, 0x1f78a00e, 0x1f78a00e, 0x6a633d2c, 0x6a633d2c, 0xca177c65, 0xca177c65, 0xabb6c7f9, 0xabb6c7f9, 0x635a35e8, 0x635a35e8, 0x6da78f10, 0x53467ff8, 0xd037fdfa, 0xd037fdfa, }, 45 }, ++ { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x2b6b8225, 0x2b6b8225, 0x83df9995, 0x83df9995, 0x5165ad0b, 0x5165ad0b, 0xe5a6f96d, 0xe5a6f96d, 0x798df957, 0x798df957, 0x8c0567e2, 0x8c0567e2, 0x5e5d7389, 0x5e5d7389, 0x47a39dd, 0x47a39dd, 0x894f44af, 0x894f44af, 0x1dff0a6, 0x1dff0a6, 0xf496e67b, 0xf496e67b, 0x29cb5702, 0x29cb5702, 0xeaf1387d, 0xeaf1387d, 0x4a9bf7, 0x4a9bf7, 0x11d20bee, 0x11d20bee, 0xa103dc2d, 0xa103dc2d, 0xd0265db9, 0xd0265db9, 0x42267334, 0x42267334, 0x96f85e8c, 0x96f85e8c, 0xa28eac49, 0xa28eac49, 0x4e660ae7, 0x70741b3, 0x183f2f2e, 0x183f2f2e, }, 45 }, ++ { "cmdline_cat", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x77b51f44, 0x77b51f44, 0xc8097569, 0xc8097569, 0x769aee5f, 0x769aee5f, 0xa35e159, 0xa35e159, 0x87a6341f, 0x87a6341f, 0xb61d944b, 0xb61d944b, 0x8b109cb3, 0x8b109cb3, 0xed3fb3e, 0xed3fb3e, 0xd7cc6c3, 0xd7cc6c3, 0x52077f0d, 0x52077f0d, 0x9d86d17e, 0x9d86d17e, 0x5e487bb, 0x5e487bb, 0x3a00041b, 0x3a00041b, 0xcfdeaf9e, 0xcfdeaf9e, 0x3e40af89, 0x3e40af89, 0x5ec41ea9, 0x5ec41ea9, 0x6298e4e7, 0x6298e4e7, 0xfd67f90e, 0xfd67f90e, 0x5ab5dc32, 0x5ab5dc32, 0xdd3ad694, 0xdd3ad694, 0x391222b4, 0xd4a98b43, 0xeaa2f62, 0xeaa2f62, }, 45 }, ++ { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x45b0713c, 0x237f9dbf, 0x45b0713c, 0x646bc7b, 0x59c36f00, 0x59c36f00, 0x7fd94135, 0x7fd94135, 0x7fd94135, 0x1592c53, 0x1592c53, 0x1592c53, 0x63af3981, 0x63af3981, 0x63af3981, 0x59c36f00, 0x646bc7b, 0x646bc7b, 0x59c36f00, }, 20 }, ++ { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x84abc7db, 0x20814063, 0x84abc7db, 0xaaae42a4, 0xaa4593fe, 0xaa4593fe, 0x2e88732f, 0x2e88732f, 0x2e88732f, 0x887d7e48, 0x887d7e48, 0x887d7e48, 0xa545d530, 0xa545d530, 0xa545d530, 0xaa4593fe, 0xaaae42a4, 0xaaae42a4, 0xaa4593fe, }, 20 }, ++ { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x5b85371a, 0xe10968c2, 0x5b85371a, 0x6925a9e, 0xc9cbf769, 0xc9cbf769, 0xda1c9f17, 0xda1c9f17, 0xda1c9f17, 0x24c45edb, 0x24c45edb, 0x24c45edb, 0xcd8ee1d3, 0xcd8ee1d3, 0xcd8ee1d3, 0xc9cbf769, 0x6925a9e, 0x6925a9e, 0xc9cbf769, }, 20 }, ++ { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x9130464d, 0x22904f7a, 0x9130464d, 0x3f660f95, 0x9813a416, 0x9813a416, 0xfb08d7cf, 0xfb08d7cf, 0xfb08d7cf, 0x6ad351fc, 0x6ad351fc, 0x6ad351fc, 0x73696c2c, 0x73696c2c, 0x73696c2c, 0x9813a416, 0x3f660f95, 0x3f660f95, 0x9813a416, }, 20 }, ++ { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x5185b14e, 0x4173aa2f, 0x5185b14e, 0x272384fd, 0x5fcf013d, 0x5fcf013d, 0x9e56a9e0, 0x9e56a9e0, 0x9e56a9e0, 0x4c46b196, 0x4c46b196, 0x4c46b196, 0x5a358e09, 0x5a358e09, 0x5a358e09, 0x5fcf013d, 0x272384fd, 0x272384fd, 0x5fcf013d, }, 20 }, ++ { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x5cc0d3ef, 0x8b87731, 0x5cc0d3ef, 0x47c509e8, 0xdd28f52b, 0xdd28f52b, 0xe1579057, 0xe1579057, 0xe1579057, 0xc06b69b3, 0xc06b69b3, 0xc06b69b3, 0xbdd3a23f, 0xbdd3a23f, 0xbdd3a23f, 0xdd28f52b, 0x47c509e8, 0x47c509e8, 0xdd28f52b, }, 20 }, ++ { "gfxterm_menu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xd1338a02, 0x7aa25dbf, 0xd1338a02, 0x2e8c9182, 0x43d1f34, 0x43d1f34, 0x6486f7c4, 0x6486f7c4, 0x6486f7c4, 0x1b8c5e6c, 0x1b8c5e6c, 0x1b8c5e6c, 0x82dd5bea, 0x82dd5bea, 0x82dd5bea, 0x43d1f34, 0x2e8c9182, 0x2e8c9182, 0x43d1f34, }, 20 }, ++ { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1027210c, 0x64e51c81, 0x1027210c, 0x45ca4a8a, 0x9a2e0d26, 0x2b88b6ce, 0x2b88b6ce, 0x2b88b6ce, 0x7750400e, 0x7750400e, 0x7750400e, 0x5ec88e9c, 0x5ec88e9c, 0x5ec88e9c, 0x59c36f00, 0x45ca4a8a, 0x45ca4a8a, }, 18 }, ++ { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8d12f697, 0xc5b32248, 0x8d12f697, 0x56720aa4, 0xa9d58ccd, 0xa1b1a1b5, 0xa1b1a1b5, 0xa1b1a1b5, 0xf4ee0bbf, 0xf4ee0bbf, 0xf4ee0bbf, 0x9dddc3f6, 0x9dddc3f6, 0x9dddc3f6, 0xaa4593fe, 0x56720aa4, 0x56720aa4, }, 18 }, ++ { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa5ec9f45, 0xdb7085d8, 0xa5ec9f45, 0x9caf1d3f, 0x5411be8b, 0xa07e74d3, 0xa07e74d3, 0xa07e74d3, 0xdfc0d247, 0xdfc0d247, 0xdfc0d247, 0x9db4b23f, 0x9db4b23f, 0x9db4b23f, 0xc9cbf769, 0x9caf1d3f, 0x9caf1d3f, }, 18 }, ++ { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xce8e83bf, 0xeb96c838, 0xce8e83bf, 0x73cb3bc1, 0x740d78cf, 0x84312594, 0x84312594, 0x84312594, 0x6f94cfe8, 0x6f94cfe8, 0x6f94cfe8, 0x69dfcf18, 0x69dfcf18, 0x69dfcf18, 0x1c3742c9, 0x73cb3bc1, 0x73cb3bc1, }, 18 }, ++ { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x56a03e51, 0xee7d8d4b, 0x56a03e51, 0x5bdf9413, 0xbcda144c, 0x131c0760, 0x131c0760, 0x131c0760, 0x7c55db71, 0x7c55db71, 0x7c55db71, 0x71a34572, 0x71a34572, 0x71a34572, 0xcc5a7bed, 0x5bdf9413, 0x5bdf9413, }, 18 }, ++ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0xea8a9cf0, 0x8929e522, 0xea8a9cf0, 0x78f3dfbc, 0x5d55a141, 0xb9092e0b, 0xb9092e0b, 0xb9092e0b, 0x7fbb6a15, 0x7fbb6a15, 0x7fbb6a15, 0x6bdebaaa, 0x6bdebaaa, 0x6bdebaaa, 0xef4a3312, 0x78f3dfbc, 0x78f3dfbc, }, 18 }, ++ { "gfxmenu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x54e48d80, 0x6dcf1d57, 0x925a4c8f, 0x6dcf1d57, 0x69005b38, 0x6d6bb4bc, 0x14f7c6b1, 0x14f7c6b1, 0x14f7c6b1, 0x95043060, 0x95043060, 0x95043060, 0x3a0890f, 0x3a0890f, 0x3a0890f, 0x54e48d80, 0x69005b38, 0x69005b38, }, 18 }, ++ { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x77ff5efc, 0x791fe364, 0x77ff5efc, 0x340993bb, 0x59c36f00, 0x59c36f00, 0x3908ca1e, 0x3908ca1e, 0x3908ca1e, 0x4788a778, 0x4788a778, 0x4788a778, 0x257eb2aa, 0x257eb2aa, 0x257eb2aa, 0x59c36f00, 0x340993bb, 0x340993bb, 0x59c36f00, }, 20 }, ++ { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xb2d04b0f, 0x46cdbc23, 0xb2d04b0f, 0x9cd5ce70, 0xaa4593fe, 0xaa4593fe, 0x44bf6b37, 0x44bf6b37, 0x44bf6b37, 0xe24a6650, 0xe24a6650, 0xe24a6650, 0xcf72cd28, 0xcf72cd28, 0xcf72cd28, 0xaa4593fe, 0x9cd5ce70, 0x9cd5ce70, 0xaa4593fe, }, 20 }, ++ { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x4bb823b8, 0x59349835, 0x4bb823b8, 0x16af4e3c, 0xc9cbf769, 0xc9cbf769, 0x2784b68e, 0x2784b68e, 0x2784b68e, 0xd95c7742, 0xd95c7742, 0xd95c7742, 0x3016c84a, 0x3016c84a, 0x3016c84a, 0xc9cbf769, 0x16af4e3c, 0x16af4e3c, 0xc9cbf769, }, 20 }, ++ { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xb821e44, 0x16b3ac05, 0xb821e44, 0xa5d4579c, 0x9813a416, 0x9813a416, 0xca80d730, 0xca80d730, 0xca80d730, 0x5b5b5103, 0x5b5b5103, 0x5b5b5103, 0x42e16cd3, 0x42e16cd3, 0x42e16cd3, 0x9813a416, 0xa5d4579c, 0xa5d4579c, 0x9813a416, }, 20 }, ++ { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xbe0b9671, 0x7f6e98d0, 0xbe0b9671, 0xc8ada3c2, 0x5fcf013d, 0x5fcf013d, 0x57a0c67d, 0x57a0c67d, 0x57a0c67d, 0x85b0de0b, 0x85b0de0b, 0x85b0de0b, 0x93c3e194, 0x93c3e194, 0x93c3e194, 0x5fcf013d, 0xc8ada3c2, 0xc8ada3c2, 0x5fcf013d, }, 20 }, ++ { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x9f18b29e, 0x50e7d383, 0x9f18b29e, 0x841d6899, 0xdd28f52b, 0xdd28f52b, 0xd12092dc, 0xd12092dc, 0xd12092dc, 0xf01c6b38, 0xf01c6b38, 0xf01c6b38, 0x8da4a0b4, 0x8da4a0b4, 0x8da4a0b4, 0xdd28f52b, 0x841d6899, 0x841d6899, 0xdd28f52b, }, 20 }, ++ { "gfxterm_ar", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x4e8d4d8c, 0x3f32cb90, 0x4e8d4d8c, 0xb132560c, 0x43d1f34, 0x43d1f34, 0x1e7f303c, 0x1e7f303c, 0x1e7f303c, 0x61759994, 0x61759994, 0x61759994, 0xf8249c12, 0xf8249c12, 0xf8249c12, 0x43d1f34, 0xb132560c, 0xb132560c, 0x43d1f34, }, 20 }, ++ { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x4f39b2c5, 0x37084023, 0x4f39b2c5, 0xccf7f82, 0x59c36f00, 0x59c36f00, 0xb5dad2e, 0xb5dad2e, 0xb5dad2e, 0x75ddc048, 0x75ddc048, 0x75ddc048, 0x172bd59a, 0x172bd59a, 0x172bd59a, 0x59c36f00, 0xccf7f82, 0xccf7f82, 0x59c36f00, }, 20 }, ++ { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5f24f8e, 0x76463f82, 0xd5f24f8e, 0xfbf7caf1, 0xaa4593fe, 0xaa4593fe, 0xb897c475, 0xb897c475, 0xb897c475, 0x1e62c912, 0x1e62c912, 0x1e62c912, 0x335a626a, 0x335a626a, 0x335a626a, 0xaa4593fe, 0xfbf7caf1, 0xfbf7caf1, 0xaa4593fe, }, 20 }, ++ { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x8aa7c8c3, 0x28620e7e, 0x8aa7c8c3, 0xd7b0a547, 0xc9cbf769, 0xc9cbf769, 0x860f1899, 0x860f1899, 0x860f1899, 0x78d7d955, 0x78d7d955, 0x78d7d955, 0x919d665d, 0x919d665d, 0x919d665d, 0xc9cbf769, 0xd7b0a547, 0xd7b0a547, 0xc9cbf769, }, 20 }, ++ { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x89654b6, 0x26bab4dd, 0x89654b6, 0xa6c01d6e, 0x9813a416, 0x9813a416, 0xc67652d9, 0xc67652d9, 0xc67652d9, 0x57add4ea, 0x57add4ea, 0x57add4ea, 0x4e17e93a, 0x4e17e93a, 0x4e17e93a, 0x9813a416, 0xa6c01d6e, 0xa6c01d6e, 0x9813a416, }, 20 }, ++ { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x77945f28, 0xec3ce845, 0x77945f28, 0x1326a9b, 0x5fcf013d, 0x5fcf013d, 0xc8e6e12c, 0xc8e6e12c, 0xc8e6e12c, 0x1af6f95a, 0x1af6f95a, 0x1af6f95a, 0xc85c6c5, 0xc85c6c5, 0xc85c6c5, 0x5fcf013d, 0x1326a9b, 0x1326a9b, 0x5fcf013d, }, 20 }, ++ { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x4450a5dc, 0xda479f49, 0x4450a5dc, 0x5f557fdb, 0xdd28f52b, 0xdd28f52b, 0xddfe9197, 0xddfe9197, 0xddfe9197, 0xfcc26873, 0xfcc26873, 0xfcc26873, 0x817aa3ff, 0x817aa3ff, 0x817aa3ff, 0xdd28f52b, 0x5f557fdb, 0x5f557fdb, 0xdd28f52b, }, 20 }, ++ { "gfxterm_cyr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x409098da, 0x2e0890e, 0x409098da, 0xbf2f835a, 0x43d1f34, 0x43d1f34, 0x253d050e, 0x253d050e, 0x253d050e, 0x5a37aca6, 0x5a37aca6, 0x5a37aca6, 0xc366a920, 0xc366a920, 0xc366a920, 0x43d1f34, 0xbf2f835a, 0xbf2f835a, 0x43d1f34, }, 20 }, ++ { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x546aa9f1, 0x56bf26d0, 0x546aa9f1, 0x179c64b6, 0x59c36f00, 0x59c36f00, 0xa98ad4a1, 0xa98ad4a1, 0xa98ad4a1, 0xd70ab9c7, 0xd70ab9c7, 0xd70ab9c7, 0xb5fcac15, 0xb5fcac15, 0xb5fcac15, 0x59c36f00, 0x179c64b6, 0x179c64b6, 0x59c36f00, }, 20 }, ++ { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x12592c97, 0xa10f7034, 0x12592c97, 0x3c5ca9e8, 0xaa4593fe, 0xaa4593fe, 0x2c3e194, 0x2c3e194, 0x2c3e194, 0xa436ecf3, 0xa436ecf3, 0xa436ecf3, 0x890e478b, 0x890e478b, 0x890e478b, 0xaa4593fe, 0x3c5ca9e8, 0x3c5ca9e8, 0xaa4593fe, }, 20 }, ++ { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xed5de42a, 0x5cf94e51, 0xed5de42a, 0xb04a89ae, 0xc9cbf769, 0xc9cbf769, 0xdd578210, 0xdd578210, 0xdd578210, 0x238f43dc, 0x238f43dc, 0x238f43dc, 0xcac5fcd4, 0xcac5fcd4, 0xcac5fcd4, 0xc9cbf769, 0xb04a89ae, 0xb04a89ae, 0xc9cbf769, }, 20 }, ++ { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xbbc56f90, 0x4f643bbb, 0xbbc56f90, 0x15932648, 0x9813a416, 0x9813a416, 0x28aba4d1, 0x28aba4d1, 0x28aba4d1, 0xb97022e2, 0xb97022e2, 0xb97022e2, 0xa0ca1f32, 0xa0ca1f32, 0xa0ca1f32, 0x9813a416, 0x15932648, 0x15932648, 0x9813a416, }, 20 }, ++ { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x43465d8c, 0x6399888a, 0x43465d8c, 0x35e0683f, 0x5fcf013d, 0x5fcf013d, 0x4895c207, 0x4895c207, 0x4895c207, 0x9a85da71, 0x9a85da71, 0x9a85da71, 0x8cf6e5ee, 0x8cf6e5ee, 0x8cf6e5ee, 0x5fcf013d, 0x35e0683f, 0x35e0683f, 0x5fcf013d, }, 20 }, ++ { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd1e7f231, 0xe67e195e, 0xd1e7f231, 0xcae22836, 0xdd28f52b, 0xdd28f52b, 0xe7ae9f08, 0xe7ae9f08, 0xe7ae9f08, 0xc69266ec, 0xc69266ec, 0xc69266ec, 0xbb2aad60, 0xbb2aad60, 0xbb2aad60, 0xdd28f52b, 0xcae22836, 0xcae22836, 0xdd28f52b, }, 20 }, ++ { "gfxterm_heb", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x793e58f4, 0x5f939386, 0x793e58f4, 0x86814374, 0x43d1f34, 0x43d1f34, 0x12b2b9c1, 0x12b2b9c1, 0x12b2b9c1, 0x6db81069, 0x6db81069, 0x6db81069, 0xf4e915ef, 0xf4e915ef, 0xf4e915ef, 0x43d1f34, 0x86814374, 0x86814374, 0x43d1f34, }, 20 }, ++ { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x226c0d75, 0x9e291f4f, 0x226c0d75, 0x619ac032, 0x59c36f00, 0x59c36f00, 0x6fb6253, 0x6fb6253, 0x6fb6253, 0x787b0f35, 0x787b0f35, 0x787b0f35, 0x1a8d1ae7, 0x1a8d1ae7, 0x1a8d1ae7, 0x59c36f00, 0x619ac032, 0x619ac032, 0x59c36f00, }, 20 }, ++ { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8355045, 0xfe058b68, 0x8355045, 0x2630d53a, 0xaa4593fe, 0xaa4593fe, 0x290a3822, 0x290a3822, 0x290a3822, 0x8fff3545, 0x8fff3545, 0x8fff3545, 0xa2c79e3d, 0xa2c79e3d, 0xa2c79e3d, 0xaa4593fe, 0x2630d53a, 0x2630d53a, 0xaa4593fe, }, 20 }, ++ { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xc702fa59, 0x74086887, 0xc702fa59, 0x9a1597dd, 0xc9cbf769, 0xc9cbf769, 0x60295baa, 0x60295baa, 0x60295baa, 0x9ef19a66, 0x9ef19a66, 0x9ef19a66, 0x77bb256e, 0x77bb256e, 0x77bb256e, 0xc9cbf769, 0x9a1597dd, 0x9a1597dd, 0xc9cbf769, }, 20 }, ++ { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x82385331, 0xf77eda42, 0x82385331, 0x2c6e1ae9, 0x9813a416, 0x9813a416, 0x140c0d1f, 0x140c0d1f, 0x140c0d1f, 0x85d78b2c, 0x85d78b2c, 0x85d78b2c, 0x9c6db6fc, 0x9c6db6fc, 0x9c6db6fc, 0x9813a416, 0x2c6e1ae9, 0x2c6e1ae9, 0x9813a416, }, 20 }, ++ { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x565d2d38, 0x34f757ec, 0x565d2d38, 0x20fb188b, 0x5fcf013d, 0x5fcf013d, 0x230bf123, 0x230bf123, 0x230bf123, 0xf11be955, 0xf11be955, 0xf11be955, 0xe768d6ca, 0xe768d6ca, 0xe768d6ca, 0x5fcf013d, 0x20fb188b, 0x20fb188b, 0x5fcf013d, }, 20 }, ++ { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x632132a4, 0x4a8c90b2, 0x632132a4, 0x7824e8a3, 0xdd28f52b, 0xdd28f52b, 0xef2bffce, 0xef2bffce, 0xef2bffce, 0xce17062a, 0xce17062a, 0xce17062a, 0xb3afcda6, 0xb3afcda6, 0xb3afcda6, 0xdd28f52b, 0x7824e8a3, 0x7824e8a3, 0xdd28f52b, }, 20 }, ++ { "gfxterm_gre", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x461d4cfa, 0xfd3492c2, 0x461d4cfa, 0xb9a2577a, 0x43d1f34, 0x43d1f34, 0xfb72301f, 0xfb72301f, 0xfb72301f, 0x847899b7, 0x847899b7, 0x847899b7, 0x1d299c31, 0x1d299c31, 0x1d299c31, 0x43d1f34, 0xb9a2577a, 0xb9a2577a, 0x43d1f34, }, 20 }, ++ { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x82758f66, 0xbac387fd, 0x82758f66, 0xc1834221, 0x59c36f00, 0x59c36f00, 0x4877befe, 0x4877befe, 0x4877befe, 0x36f7d398, 0x36f7d398, 0x36f7d398, 0x5401c64a, 0x5401c64a, 0x5401c64a, 0x59c36f00, 0xc1834221, 0xc1834221, 0x59c36f00, }, 20 }, ++ { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x4500a591, 0x9a40cbd8, 0x4500a591, 0x6b0520ee, 0xaa4593fe, 0xaa4593fe, 0x16db2902, 0x16db2902, 0x16db2902, 0xb02e2465, 0xb02e2465, 0xb02e2465, 0x9d168f1d, 0x9d168f1d, 0x9d168f1d, 0xaa4593fe, 0x6b0520ee, 0x6b0520ee, 0xaa4593fe, }, 20 }, ++ { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x3cd9ea11, 0x1244c852, 0x3cd9ea11, 0x61ce8795, 0xc9cbf769, 0xc9cbf769, 0x6b15d6f0, 0x6b15d6f0, 0x6b15d6f0, 0x95cd173c, 0x95cd173c, 0x95cd173c, 0x7c87a834, 0x7c87a834, 0x7c87a834, 0xc9cbf769, 0x61ce8795, 0x61ce8795, 0xc9cbf769, }, 20 }, ++ { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xc818f15f, 0xbaf13382, 0xc818f15f, 0x664eb887, 0x9813a416, 0x9813a416, 0x350fe990, 0x350fe990, 0x350fe990, 0xa4d46fa3, 0xa4d46fa3, 0xa4d46fa3, 0xbd6e5273, 0xbd6e5273, 0xbd6e5273, 0x9813a416, 0x664eb887, 0x664eb887, 0x9813a416, }, 20 }, ++ { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xaa1dc81, 0x234341dd, 0xaa1dc81, 0x7c07e932, 0x5fcf013d, 0x5fcf013d, 0x969354c5, 0x969354c5, 0x969354c5, 0x44834cb3, 0x44834cb3, 0x44834cb3, 0x52f0732c, 0x52f0732c, 0x52f0732c, 0x5fcf013d, 0x7c07e932, 0x7c07e932, 0x5fcf013d, }, 20 }, ++ { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd9aa4b29, 0x555fdda0, 0xd9aa4b29, 0xc2af912e, 0xdd28f52b, 0xdd28f52b, 0xe82cbfd, 0xe82cbfd, 0xe82cbfd, 0x2fbe3219, 0x2fbe3219, 0x2fbe3219, 0x5206f995, 0x5206f995, 0x5206f995, 0xdd28f52b, 0xc2af912e, 0xc2af912e, 0xdd28f52b, }, 20 }, ++ { "gfxterm_ru", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xfd4e19ff, 0x42807b86, 0xfd4e19ff, 0x2f1027f, 0x43d1f34, 0x43d1f34, 0x924dc5be, 0x924dc5be, 0x924dc5be, 0xed476c16, 0xed476c16, 0xed476c16, 0x74166990, 0x74166990, 0x74166990, 0x43d1f34, 0x2f1027f, 0x2f1027f, 0x43d1f34, }, 20 }, ++ { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x3a63a2e6, 0x118487d4, 0x3a63a2e6, 0x79956fa1, 0x59c36f00, 0x59c36f00, 0x389f4d2d, 0x389f4d2d, 0x389f4d2d, 0x461f204b, 0x461f204b, 0x461f204b, 0x24e93599, 0x24e93599, 0x24e93599, 0x59c36f00, 0x79956fa1, 0x79956fa1, 0x59c36f00, }, 20 }, ++ { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x62d33f4d, 0x9544a8f4, 0x62d33f4d, 0x4cd6ba32, 0xaa4593fe, 0xaa4593fe, 0xfb86a3a4, 0xfb86a3a4, 0xfb86a3a4, 0x5d73aec3, 0x5d73aec3, 0x5d73aec3, 0x704b05bb, 0x704b05bb, 0x704b05bb, 0xaa4593fe, 0x4cd6ba32, 0x4cd6ba32, 0xaa4593fe, }, 20 }, ++ { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x8cc4b6dc, 0x1042c383, 0x8cc4b6dc, 0xd1d3db58, 0xc9cbf769, 0xc9cbf769, 0xeba8a32b, 0xeba8a32b, 0xeba8a32b, 0x157062e7, 0x157062e7, 0x157062e7, 0xfc3addef, 0xfc3addef, 0xfc3addef, 0xc9cbf769, 0xd1d3db58, 0xd1d3db58, 0xc9cbf769, }, 20 }, ++ { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x23f9afd, 0x465f5ecc, 0x23f9afd, 0xac69d325, 0x9813a416, 0x9813a416, 0xccf7a1e3, 0xccf7a1e3, 0xccf7a1e3, 0x5d2c27d0, 0x5d2c27d0, 0x5d2c27d0, 0x44961a00, 0x44961a00, 0x44961a00, 0x9813a416, 0xac69d325, 0xac69d325, 0x9813a416, }, 20 }, ++ { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xed796a26, 0x3132d083, 0xed796a26, 0x9bdf5f95, 0x5fcf013d, 0x5fcf013d, 0x42f66a49, 0x42f66a49, 0x42f66a49, 0x90e6723f, 0x90e6723f, 0x90e6723f, 0x86954da0, 0x86954da0, 0x86954da0, 0x5fcf013d, 0x9bdf5f95, 0x9bdf5f95, 0x5fcf013d, }, 20 }, ++ { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x54b28785, 0x7fbbe762, 0x54b28785, 0x4fb75d82, 0xdd28f52b, 0xdd28f52b, 0x14b1cf29, 0x14b1cf29, 0x14b1cf29, 0x358d36cd, 0x358d36cd, 0x358d36cd, 0x4835fd41, 0x4835fd41, 0x4835fd41, 0xdd28f52b, 0x4fb75d82, 0x4fb75d82, 0xdd28f52b, }, 20 }, ++ { "gfxterm_fr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x7acc2669, 0xbf1a1d96, 0x7acc2669, 0x85733de9, 0x43d1f34, 0x43d1f34, 0x2cc1e8f4, 0x2cc1e8f4, 0x2cc1e8f4, 0x53cb415c, 0x53cb415c, 0x53cb415c, 0xca9a44da, 0xca9a44da, 0xca9a44da, 0x43d1f34, 0x85733de9, 0x85733de9, 0x43d1f34, }, 20 }, ++ { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xf9511593, 0x9f9ef910, 0xf9511593, 0xbaa7d8d4, 0x59c36f00, 0x59c36f00, 0x7fd94135, 0x7fd94135, 0x7fd94135, 0x1592c53, 0x1592c53, 0x1592c53, 0x63af3981, 0x63af3981, 0x63af3981, 0x59c36f00, 0xbaa7d8d4, 0xbaa7d8d4, 0x59c36f00, }, 20 }, ++ { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x3dcbe25f, 0x99e165e7, 0x3dcbe25f, 0x13ce6720, 0xaa4593fe, 0xaa4593fe, 0x2e88732f, 0x2e88732f, 0x2e88732f, 0x887d7e48, 0x887d7e48, 0x887d7e48, 0xa545d530, 0xa545d530, 0xa545d530, 0xaa4593fe, 0x13ce6720, 0x13ce6720, 0xaa4593fe, }, 20 }, ++ { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xdbedc74c, 0x61619894, 0xdbedc74c, 0x86faaac8, 0xc9cbf769, 0xc9cbf769, 0xda1c9f17, 0xda1c9f17, 0xda1c9f17, 0x24c45edb, 0x24c45edb, 0x24c45edb, 0xcd8ee1d3, 0xcd8ee1d3, 0xcd8ee1d3, 0xc9cbf769, 0x86faaac8, 0x86faaac8, 0xc9cbf769, }, 20 }, ++ { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x2411f56f, 0x97b1fc58, 0x2411f56f, 0x8a47bcb7, 0x9813a416, 0x9813a416, 0xfb08d7cf, 0xfb08d7cf, 0xfb08d7cf, 0x6ad351fc, 0x6ad351fc, 0x6ad351fc, 0x73696c2c, 0x73696c2c, 0x73696c2c, 0x9813a416, 0x8a47bcb7, 0x8a47bcb7, 0x9813a416, }, 20 }, ++ { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x13a65fb6, 0x35044d7, 0x13a65fb6, 0x65006a05, 0x5fcf013d, 0x5fcf013d, 0x9e56a9e0, 0x9e56a9e0, 0x9e56a9e0, 0x4c46b196, 0x4c46b196, 0x4c46b196, 0x5a358e09, 0x5a358e09, 0x5a358e09, 0x5fcf013d, 0x65006a05, 0x65006a05, 0x5fcf013d, }, 20 }, ++ { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xc8f05290, 0x9c88f64e, 0xc8f05290, 0xd3f58897, 0xdd28f52b, 0xdd28f52b, 0xe1579057, 0xe1579057, 0xe1579057, 0xc06b69b3, 0xc06b69b3, 0xc06b69b3, 0xbdd3a23f, 0xbdd3a23f, 0xbdd3a23f, 0xdd28f52b, 0xd3f58897, 0xd3f58897, 0xdd28f52b, }, 20 }, ++ { "gfxterm_quot", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x9cfbc80f, 0x376a1fb2, 0x9cfbc80f, 0x6344d38f, 0x43d1f34, 0x43d1f34, 0x6486f7c4, 0x6486f7c4, 0x6486f7c4, 0x1b8c5e6c, 0x1b8c5e6c, 0x1b8c5e6c, 0x82dd5bea, 0x82dd5bea, 0x82dd5bea, 0x43d1f34, 0x6344d38f, 0x6344d38f, 0x43d1f34, }, 20 }, ++ { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd327ca68, 0x9c977e8c, 0xd327ca68, 0x90d1072f, 0x59c36f00, 0x59c36f00, 0x71c9d9, 0x71c9d9, 0x71c9d9, 0x7ef1a4bf, 0x7ef1a4bf, 0x7ef1a4bf, 0x1c07b16d, 0x1c07b16d, 0x1c07b16d, 0x59c36f00, 0x90d1072f, 0x90d1072f, 0x59c36f00, }, 20 }, ++ { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2da3855b, 0x24c7b138, 0x2da3855b, 0x3a60024, 0xaa4593fe, 0xaa4593fe, 0x147ff249, 0x147ff249, 0x147ff249, 0xb28aff2e, 0xb28aff2e, 0xb28aff2e, 0x9fb25456, 0x9fb25456, 0x9fb25456, 0xaa4593fe, 0x3a60024, 0x3a60024, 0xaa4593fe, }, 20 }, ++ { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x660ab3d9, 0xa75b45c4, 0x660ab3d9, 0x3b1dde5d, 0xc9cbf769, 0xc9cbf769, 0x5ff884f5, 0x5ff884f5, 0x5ff884f5, 0xa1204539, 0xa1204539, 0xa1204539, 0x486afa31, 0x486afa31, 0x486afa31, 0xc9cbf769, 0x3b1dde5d, 0x3b1dde5d, 0xc9cbf769, }, 20 }, ++ { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x920957ee, 0xceebfd42, 0x920957ee, 0x3c5f1e36, 0x9813a416, 0x9813a416, 0xa917dbef, 0xa917dbef, 0xa917dbef, 0x38cc5ddc, 0x38cc5ddc, 0x38cc5ddc, 0x2176600c, 0x2176600c, 0x2176600c, 0x9813a416, 0x3c5f1e36, 0x3c5f1e36, 0x9813a416, }, 20 }, ++ { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x8298cd03, 0xfb88293a, 0x8298cd03, 0xf43ef8b0, 0x5fcf013d, 0x5fcf013d, 0x8f57f36b, 0x8f57f36b, 0x8f57f36b, 0x5d47eb1d, 0x5d47eb1d, 0x5d47eb1d, 0x4b34d482, 0x4b34d482, 0x4b34d482, 0x5fcf013d, 0xf43ef8b0, 0xf43ef8b0, 0x5fcf013d, }, 20 }, ++ { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd8bbc577, 0xb2c37549, 0xd8bbc577, 0xc3be1f70, 0xdd28f52b, 0xdd28f52b, 0xd8b598e, 0xd8b598e, 0xd8b598e, 0x2cb7a06a, 0x2cb7a06a, 0x2cb7a06a, 0x510f6be6, 0x510f6be6, 0x510f6be6, 0xdd28f52b, 0xc3be1f70, 0xc3be1f70, 0xdd28f52b, }, 20 }, ++ { "gfxterm_piglatin", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x4d7993a1, 0xbeefcd88, 0x4d7993a1, 0xb2c68821, 0x43d1f34, 0x43d1f34, 0x1dbc7020, 0x1dbc7020, 0x1dbc7020, 0x62b6d988, 0x62b6d988, 0x62b6d988, 0xfbe7dc0e, 0xfbe7dc0e, 0xfbe7dc0e, 0x43d1f34, 0xb2c68821, 0xb2c68821, 0x43d1f34, }, 20 }, ++ { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x628b6f61, 0x50f94215, 0x628b6f61, 0x217da226, 0x59c36f00, 0x59c36f00, 0x5755be7f, 0x5755be7f, 0x5755be7f, 0x29d5d319, 0x29d5d319, 0x29d5d319, 0x4b23c6cb, 0x4b23c6cb, 0x4b23c6cb, 0x59c36f00, 0x217da226, 0x217da226, 0x59c36f00, }, 20 }, ++ { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x9f82cd08, 0xbc67f78d, 0x9f82cd08, 0xb1874877, 0xaa4593fe, 0xaa4593fe, 0x4749512e, 0x4749512e, 0x4749512e, 0xe1bc5c49, 0xe1bc5c49, 0xe1bc5c49, 0xcc84f731, 0xcc84f731, 0xcc84f731, 0xaa4593fe, 0xb1874877, 0xb1874877, 0xaa4593fe, }, 20 }, ++ { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xbee47cfb, 0x88e98534, 0xbee47cfb, 0xe3f3117f, 0xc9cbf769, 0xc9cbf769, 0xe2396b15, 0xe2396b15, 0xe2396b15, 0x1ce1aad9, 0x1ce1aad9, 0x1ce1aad9, 0xf5ab15d1, 0xf5ab15d1, 0xf5ab15d1, 0xc9cbf769, 0xe3f3117f, 0xe3f3117f, 0xc9cbf769, }, 20 }, ++ { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x2bfd5a83, 0xbe3c6f2f, 0x2bfd5a83, 0x85ab135b, 0x9813a416, 0x9813a416, 0xce30693b, 0xce30693b, 0xce30693b, 0x5febef08, 0x5febef08, 0x5febef08, 0x4651d2d8, 0x4651d2d8, 0x4651d2d8, 0x9813a416, 0x85ab135b, 0x85ab135b, 0x9813a416, }, 20 }, ++ { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x1456f321, 0xc3a55992, 0x1456f321, 0x62f0c692, 0x5fcf013d, 0x5fcf013d, 0xbe3d534a, 0xbe3d534a, 0xbe3d534a, 0x6c2d4b3c, 0x6c2d4b3c, 0x6c2d4b3c, 0x7a5e74a3, 0x7a5e74a3, 0x7a5e74a3, 0x5fcf013d, 0x62f0c692, 0x62f0c692, 0x5fcf013d, }, 20 }, ++ { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xdcac6945, 0x43fbdf5a, 0xdcac6945, 0xc7a9b342, 0xdd28f52b, 0xdd28f52b, 0x274da20b, 0x274da20b, 0x274da20b, 0x6715bef, 0x6715bef, 0x6715bef, 0x7bc99063, 0x7bc99063, 0x7bc99063, 0xdd28f52b, 0xc7a9b342, 0xc7a9b342, 0xdd28f52b, }, 20 }, ++ { "gfxterm_ch", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x571e16b1, 0xb9f25c2, 0x571e16b1, 0xa8a10d31, 0x43d1f34, 0x43d1f34, 0x25dfb69d, 0x25dfb69d, 0x25dfb69d, 0x5ad51f35, 0x5ad51f35, 0x5ad51f35, 0xc3841ab3, 0xc3841ab3, 0xc3841ab3, 0x43d1f34, 0xa8a10d31, 0xa8a10d31, 0x43d1f34, }, 20 }, ++ { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xec987771, 0x8a579bf2, 0xec987771, 0xbbb5c9af, 0x59c36f00, 0x59c36f00, 0x16780f43, 0x16780f43, 0x16780f43, 0x68f86225, 0x68f86225, 0x68f86225, 0xa0e77f7, 0xa0e77f7, 0xa0e77f7, 0x59c36f00, 0xbbb5c9af, 0xbbb5c9af, 0x59c36f00, }, 20 }, ++ { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x97994d2c, 0x33b3ca94, 0x97994d2c, 0x273e977a, 0xaa4593fe, 0xaa4593fe, 0xa592c9d5, 0xa592c9d5, 0xa592c9d5, 0x367c4b2, 0x367c4b2, 0x367c4b2, 0x2e5f6fca, 0x2e5f6fca, 0x2e5f6fca, 0xaa4593fe, 0x273e977a, 0x273e977a, 0xaa4593fe, }, 20 }, ++ { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x5d2416aa, 0xe7a84972, 0x5d2416aa, 0x4d010804, 0xc9cbf769, 0xc9cbf769, 0x4e3a88a0, 0x4e3a88a0, 0x4e3a88a0, 0xb0e2496c, 0xb0e2496c, 0xb0e2496c, 0x59a8f664, 0x59a8f664, 0x59a8f664, 0xc9cbf769, 0x4d010804, 0x4d010804, 0xc9cbf769, }, 20 }, ++ { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x1da65b43, 0xae065274, 0x1da65b43, 0x2dd7a76c, 0x9813a416, 0x9813a416, 0xf81d19f, 0xf81d19f, 0xf81d19f, 0x9e5a57ac, 0x9e5a57ac, 0x9e5a57ac, 0x87e06a7c, 0x87e06a7c, 0x87e06a7c, 0x9813a416, 0x2dd7a76c, 0x2dd7a76c, 0x9813a416, }, 20 }, ++ { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xea8a940e, 0xfa7c8f6f, 0xea8a940e, 0x448d7bfb, 0x5fcf013d, 0x5fcf013d, 0x47c22fa0, 0x47c22fa0, 0x47c22fa0, 0x95d237d6, 0x95d237d6, 0x95d237d6, 0x83a10849, 0x83a10849, 0x83a10849, 0x5fcf013d, 0x448d7bfb, 0x448d7bfb, 0x5fcf013d, }, 20 }, ++ { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xc0ac44fa, 0x94d4e024, 0xc0ac44fa, 0x4ec88f20, 0xdd28f52b, 0xdd28f52b, 0x2422f542, 0x2422f542, 0x2422f542, 0x51e0ca6, 0x51e0ca6, 0x51e0ca6, 0x78a6c72a, 0x78a6c72a, 0x78a6c72a, 0xdd28f52b, 0x4ec88f20, 0x4ec88f20, 0xdd28f52b, }, 20 }, ++ { "gfxterm_red", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x248f7655, 0x8f1ea1e8, 0x248f7655, 0xb3d7f0f5, 0x43d1f34, 0x43d1f34, 0x8c408c04, 0x8c408c04, 0x8c408c04, 0xf34a25ac, 0xf34a25ac, 0xf34a25ac, 0x6a1b202a, 0x6a1b202a, 0x6a1b202a, 0x43d1f34, 0xb3d7f0f5, 0xb3d7f0f5, 0x43d1f34, }, 20 }, ++ { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd6ba8f78, 0xb07563fb, 0xd6ba8f78, 0x6ef020b2, 0x59c36f00, 0x59c36f00, 0x7fd94135, 0x7fd94135, 0x7fd94135, 0x1592c53, 0x1592c53, 0x1592c53, 0x63af3981, 0x63af3981, 0x63af3981, 0x59c36f00, 0x6ef020b2, 0x6ef020b2, 0x59c36f00, }, 20 }, ++ { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xf5257f70, 0x510ff8c8, 0xf5257f70, 0x36a3b7ff, 0xaa4593fe, 0xaa4593fe, 0x2e88732f, 0x2e88732f, 0x2e88732f, 0x887d7e48, 0x887d7e48, 0x887d7e48, 0xa545d530, 0xa545d530, 0xa545d530, 0xaa4593fe, 0x36a3b7ff, 0x36a3b7ff, 0xaa4593fe, }, 20 }, ++ { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x9f8effb3, 0x2502a06b, 0x9f8effb3, 0xddeb038e, 0xc9cbf769, 0xc9cbf769, 0xda1c9f17, 0xda1c9f17, 0xda1c9f17, 0x24c45edb, 0x24c45edb, 0x24c45edb, 0xcd8ee1d3, 0xcd8ee1d3, 0xcd8ee1d3, 0xc9cbf769, 0xddeb038e, 0xddeb038e, 0xc9cbf769, }, 20 }, ++ { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x6aa72774, 0xd9072e43, 0x6aa72774, 0x24b4853d, 0x9813a416, 0x9813a416, 0xfb08d7cf, 0xfb08d7cf, 0xfb08d7cf, 0x6ad351fc, 0x6ad351fc, 0x6ad351fc, 0x73696c2c, 0x73696c2c, 0x73696c2c, 0x9813a416, 0x24b4853d, 0x24b4853d, 0x9813a416, }, 20 }, ++ { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x936eb1d8, 0x8398aab9, 0x936eb1d8, 0x8beef, 0x5fcf013d, 0x5fcf013d, 0x9e56a9e0, 0x9e56a9e0, 0x9e56a9e0, 0x4c46b196, 0x4c46b196, 0x4c46b196, 0x5a358e09, 0x5a358e09, 0x5a358e09, 0x5fcf013d, 0x8beef, 0x8beef, 0x5fcf013d, }, 20 }, ++ { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xdd4b9ec3, 0x89333a1d, 0xdd4b9ec3, 0x3acd5a9d, 0xdd28f52b, 0xdd28f52b, 0xe1579057, 0xe1579057, 0xe1579057, 0xc06b69b3, 0xc06b69b3, 0xc06b69b3, 0xbdd3a23f, 0xbdd3a23f, 0xbdd3a23f, 0xdd28f52b, 0x3acd5a9d, 0x3acd5a9d, 0xdd28f52b, }, 20 }, ++ { "gfxterm_high", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x89f37601, 0x2262a1bc, 0x89f37601, 0xf17b28ae, 0x43d1f34, 0x43d1f34, 0x6486f7c4, 0x6486f7c4, 0x6486f7c4, 0x1b8c5e6c, 0x1b8c5e6c, 0x1b8c5e6c, 0x82dd5bea, 0x82dd5bea, 0x82dd5bea, 0x43d1f34, 0xf17b28ae, 0xf17b28ae, 0x43d1f34, }, 20 }, + { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x1368a483, 0x1368a483, 0x1368a483, 0x1368a483, 0x1368a483, }, 5 }, + { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, }, 5 }, + { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, }, 5 }, +-- +2.13.0 + diff --git a/0002-Remove-bashisms-from-tests.patch b/0002-Remove-bashisms-from-tests.patch new file mode 100644 index 00000000..48d27515 --- /dev/null +++ b/0002-Remove-bashisms-from-tests.patch @@ -0,0 +1,133 @@ +From 5a0c548ba388b343b0bb6d2a38888e7eac5bbb96 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 03:47:13 +0300 +Subject: [PATCH 002/176] Remove bashisms from tests. + +Those tests don't actually need bash. Just use common shebang. +--- + tests/grub_cmd_date.in | 2 +- + tests/grub_cmd_regexp.in | 2 +- + tests/grub_cmd_set_date.in | 2 +- + tests/grub_cmd_sleep.in | 2 +- + tests/grub_cmd_test.in | 2 +- + tests/grub_cmd_tr.in | 2 +- + tests/grub_func_test.in | 2 +- + tests/grub_script_blockarg.in | 2 +- + tests/grub_script_expansion.in | 2 +- + tests/help_test.in | 2 +- + tests/test_sha512sum.in | 2 +- + 11 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in +index a459353e8..0d8162e98 100644 +--- a/tests/grub_cmd_date.in ++++ b/tests/grub_cmd_date.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_regexp.in b/tests/grub_cmd_regexp.in +index e7e625701..7e9ab86aa 100644 +--- a/tests/grub_cmd_regexp.in ++++ b/tests/grub_cmd_regexp.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + # Run GRUB script in a Qemu instance +diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in +index c594ae3fc..2f518dd9e 100644 +--- a/tests/grub_cmd_set_date.in ++++ b/tests/grub_cmd_set_date.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in +index eb362aa24..05b8f6b73 100644 +--- a/tests/grub_cmd_sleep.in ++++ b/tests/grub_cmd_sleep.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in +index 6269891c9..49ae8a9c8 100644 +--- a/tests/grub_cmd_test.in ++++ b/tests/grub_cmd_test.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + + # create a randome file + empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +diff --git a/tests/grub_cmd_tr.in b/tests/grub_cmd_tr.in +index 3fb15e35c..0e8d645eb 100644 +--- a/tests/grub_cmd_tr.in ++++ b/tests/grub_cmd_tr.in +@@ -1,4 +1,4 @@ +-#! /bin/bash -e ++#! /bin/sh -e + + # Run GRUB script in a Qemu instance + # Copyright (C) 2010 Free Software Foundation, Inc. +diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in +index c8cc26376..b32f24466 100644 +--- a/tests/grub_func_test.in ++++ b/tests/grub_func_test.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in +index 2765b61ac..63b60a2ea 100644 +--- a/tests/grub_script_blockarg.in ++++ b/tests/grub_script_blockarg.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + + # Run GRUB script in a Qemu instance + # Copyright (C) 2010 Free Software Foundation, Inc. +diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in +index e46401c4c..2b7829568 100644 +--- a/tests/grub_script_expansion.in ++++ b/tests/grub_script_expansion.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + # Run GRUB script in a Qemu instance +diff --git a/tests/help_test.in b/tests/help_test.in +index e780924ef..aa9645835 100644 +--- a/tests/help_test.in ++++ b/tests/help_test.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in +index d5ef7f9ea..80ebdc59f 100644 +--- a/tests/test_sha512sum.in ++++ b/tests/test_sha512sum.in +@@ -1,4 +1,4 @@ +-#! /bin/bash ++#! /bin/sh + + # create a randome file + file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +-- +2.13.0 + diff --git a/0003-fs-tester-make-sh-compatible.patch b/0003-fs-tester-make-sh-compatible.patch new file mode 100644 index 00000000..b9c7ff44 --- /dev/null +++ b/0003-fs-tester-make-sh-compatible.patch @@ -0,0 +1,746 @@ +From 37865c2c4ad26cd5e947b08abf1fde8145699919 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 14:35:59 +0300 +Subject: [PATCH 003/176] fs-tester: make sh-compatible + +--- + tests/util/grub-fs-tester.in | 306 ++++++++++++++++++++++++------------------- + 1 file changed, 169 insertions(+), 137 deletions(-) + +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index 2337771a1..4515d165e 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + set -e + +@@ -13,8 +13,29 @@ run_it () { + LC_ALL=C "$GRUBFSTEST" "$@" + } + ++range() { ++ range_counter="$1" ++ while test "$range_counter" -le "$2"; do ++ echo "$range_counter" ++ range_counter="$((range_counter + $3))" ++ done ++} ++ ++powrange() { ++ range_counter="$1" ++ while test "$range_counter" -le "$2"; do ++ echo "$range_counter" ++ range_counter="$((range_counter * 2))" ++ done ++} ++ + run_grubfstest () { +- run_it -c $NEED_IMAGES_N "${NEED_IMAGES[@]}" "$@" ++ need_images= ++ for i in $(range 0 $((NEED_IMAGES_N-1)) 1); do ++ need_images="$need_images $FSIMAGEP${i}.img"; ++ done ++ ++ run_it -c $NEED_IMAGES_N $need_images "$@" + } + + # OS LIMITATION: GNU/Linux has no AFS support, so we use a premade image and a reference tar file. I.a. no multiblocksize test +@@ -51,7 +72,7 @@ case x"$fs" in + # OS limitation: zfs-fuse always uses ashift=9 with loop devices + MAXLOGSECSIZE=9;; + esac +-for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + 1)); do ++for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + SECSIZE="$((1 << LOGSECSIZE))" + MINBLKSIZE=512 + MAXBLKSIZE=512 +@@ -169,7 +190,12 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + MINBLKSIZE=1024 + MAXBLKSIZE=4096;; + esac +- for ((BLKSIZE=MINBLKSIZE;BLKSIZE<=MAXBLKSIZE;BLKSIZE=BLKSTEP?BLKSIZE+BLKSTEP:2*BLKSIZE)); do ++ if test "$BLKSTEP" -eq 0; then ++ blksizes="$(powrange "$MINBLKSIZE" "$MAXBLKSIZE")" ++ else ++ blksizes="$(range "$MINBLKSIZE" "$MAXBLKSIZE" "$BLKSTEP")" ++ fi ++ for BLKSIZE in $blksizes; do + MAXDEVICES=1 + MINDEVICES=1 + export fs +@@ -199,13 +225,11 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + MAXDEVICES=7;; + esac + +- for ((NDEVICES=MINDEVICES; NDEVICES <= MAXDEVICES; NDEVICES++)); do ++ for NDEVICES in $(range "$MINDEVICES" "$MAXDEVICES" 1); do + export NDEVICES +- unset FSIMAGES +- for ((i=0; i < NDEVICES; i++)); do +- FSIMAGES[i]="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_$i.img" +- done +- export FSIMAGES ++ unset FSIMAGEP ++ FSIMAGEP="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_" ++ export FSIMAGEP + unset NEED_IMAGES; + + case x$fs in +@@ -226,11 +250,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + *) + NEED_IMAGES_N=$NDEVICES;; + esac +- for ((i=0;i < NEED_IMAGES_N; i++)); do +- NEED_IMAGES[i]="${FSIMAGES[i]}"; +- done + export NEED_IMAGES_N +- export NEED_IMAGES + + MNTPOINTRO="${tempdir}/${fs}_ro" + MNTPOINTRW="${tempdir}/${fs}_rw" +@@ -238,20 +258,25 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + MOUNTFS="$fs" + MASTER="${tempdir}/master" + FSLABEL="grub_;/testé莭莽茝😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewrewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfew" +- CFILESN=1 +- if test -f /usr/share/dict/american-english; then +- CFILESSRC[0]="/usr/share/dict/american-english" +- else +- CFILESSRC[0]="/usr/share/dict/linux.words" ++ CFILESRC= ++ for cand in /usr/share/dict/american-english /usr/share/dict/linux.words; do ++ if test -f "$cand" ; then ++ CFILESRC="$cand" ++ break ++ fi ++ done ++ if test "$CFILESRC" = "" ; then ++ echo "Couldn't find compressible file" >&2 ++ exit 1 + fi + case x"$fs" in + # FS LIMITATION: 8.3 names + xmsdos*) +- CFILES[0]="american.eng";; ++ CFILE="american.eng";; + xiso9660) +- CFILES[0]="american_english";; ++ CFILE="american_english";; + *) +- CFILES[0]="american-english";; ++ CFILE="american-english";; + esac + # OS LIMITATION: Limited by NAME_MAX (usually 255) in GNU/Linux + LONGNAME="qwertzuiopasdfghjklyxcvbnm1234567890qwertzuiopasdfghjklyxcvbnm1234567890oiewqfiewioqoiqoiurqruewqoiuwoieoiiuewqroreqiufieiuwrnureweriuvceoiroiewqoiricdsalkcndsakfirefoiwqeoircorejwoijfreoijojoiewjfwnfcoirenfoirefnreoifenoiwfnoi" +@@ -388,8 +413,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + ;; + x"vfat16" | xmsdos16) + BIGBLOCKCNT=$((25000 * BLKSIZE)) +- if [ $BIGBLOCKCNT -gt $((16#ffffffff)) ]; then +- BIGBLOCKCNT=$((16#ffffffff)) ++ if [ $BIGBLOCKCNT -gt 4294967295 ]; then ++ BIGBLOCKCNT=4294967295 + fi + ;; + x"minix") +@@ -410,7 +435,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + BIGBLOCKCNT=$((4000 * 1048576));; + # FS LIMITATION: These FS have uint32 as file size field + x"vfat"* | xmsdos* | x"cpio_crc" | x"cpio_newc" | x"cpio_bin" | x"cpio_hpbin" | xsfs*) +- BIGBLOCKCNT=$((16#ffffffff));; ++ BIGBLOCKCNT=4294967295;; + # FS LIMITATION: These FS have int32 as file size field + # FIXME: not so sure about AFFS + # OS LIMITATION: minix2/minix3 could be formatted in a way to permit more. +@@ -543,18 +568,18 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + + PDIR="" + # OS LIMITATION: Limited by PATH_MAX (usually 1024) +- for ((i=0;i /dev/null +- LODEVICES[i]=`losetup -f` +- losetup "${LODEVICES[i]}" "${FSIMAGES[i]}" ++ for i in $(range 0 $((NDEVICES-1)) 1); do ++ dd if=/dev/zero of="$FSIMAGEP${i}.img" count=1 bs=1 seek=$((DISKSIZE-1)) &> /dev/null ++ LODEVICE="$(losetup -f)" ++ LODEVICES="$LODEVICES $LODEVICE" ++ losetup "$LODEVICE" "$FSIMAGEP${i}.img" ++ if test "$i" = 0; then ++ MOUNTDEVICE="$LODEVICE" ++ fi + done ;; + esac + +- MOUNTDEVICE="${LODEVICES[0]}" + case x"$fs" in + x"afs") + ;; + x"btrfs") +- "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" ;; ++ "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" ;; + x"btrfs_zlib" | x"btrfs_lzo") +- "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" ++ "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" + MOUNTOPTS="compress=${fs/btrfs_/}," + MOUNTFS="btrfs" + ;; + x"btrfs_raid0") +- "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" "${LODEVICES[@]}" ++ "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" $LODEVICES + MOUNTFS="btrfs" + ;; + x"btrfs_raid1") +- "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" "${LODEVICES[@]}" ++ "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" $LODEVICES + MOUNTFS="btrfs" + ;; + x"btrfs_raid10") +- "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" "${LODEVICES[@]}" ++ "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" $LODEVICES + MOUNTFS="btrfs" + ;; + x"btrfs_single") +- "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" "${LODEVICES[@]}" ++ "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" $LODEVICES + MOUNTFS="btrfs" + ;; + x"exfat") +- "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${LODEVICES[0]}" ++ "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${MOUNTDEVICE}" + MOUNTOPTS="iocharset=utf8," + MOUNTFS="exfat-fuse";; + x"minix") +- "mkfs.minix" "${LODEVICES[0]}" ++ "mkfs.minix" "${MOUNTDEVICE}" + ;; + # mkfs.hfs and mkfs.hfsplus don't fill UUID. + x"hfsplus") +- "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" +- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; ++ "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" ++ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; + x"hfsplus_wrap") +- "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" +- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 ++ "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" ++ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 + MOUNTFS="hfsplus";; + x"hfsplus_casesens") +- "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" +- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 ++ "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" ++ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 + MOUNTFS="hfsplus";; + x"hfs") +- "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${LODEVICES[0]}" +- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#474)) conv=notrunc count=8 ++ "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${MOUNTDEVICE}" ++ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#474)) conv=notrunc count=8 + MOUNTOPTS="iocharset=utf8,codepage=macroman," + ;; + x"vfat"*|xmsdos*) +@@ -643,98 +673,98 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + A= + fi +- "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${FSIMAGES[0]}" ++ "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${MOUNTDEVICE}" + MOUNTOPTS="iocharset=utf8,codepage=437," + MOUNTFS="$(echo "$fs"|sed 's,[0-9]*a\?$,,')";; + x"minix2") +- "mkfs.minix" -v "${LODEVICES[0]}" ++ "mkfs.minix" -v "${MOUNTDEVICE}" + MOUNTFS="minix";; + x"minix3") +- "mkfs.minix" -B $BLKSIZE -3 "${LODEVICES[0]}" ++ "mkfs.minix" -B $BLKSIZE -3 "${MOUNTDEVICE}" + MOUNTFS="minix";; + x"ntfs"*) +- "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${LODEVICES[0]}" ++ "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${MOUNTDEVICE}" + MOUNTOPTS="iocharset=utf8,compression," + MOUNTFS="ntfs-3g";; + x"udf") +- "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${LODEVICES[0]}" ++ "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${MOUNTDEVICE}" + MOUNTOPTS="iocharset=utf8,bs=$BLKSIZE,";; + x"ufs2") +- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${LODEVICES[0]}" ++ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${MOUNTDEVICE}" + MOUNTOPTS="ufstype=ufs2," + MOUNTFS="ufs";; + x"ufs1") +- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" ++ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" + MOUNTOPTS="ufstype=44bsd," + MOUNTFS="ufs";; + x"ufs1_sun") +- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" ++ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" + MOUNTOPTS="ufstype=sun," + MOUNTFS="ufs";; + x"zfs") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_caseins") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" + sleep 1 + "zfs" create -o casesensitivity=insensitive "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_lzjb" | xzfs_gzip | xzfs_zle) +- "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" ++ "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" + sleep 1 + "zfs" create -o compression=${fs/zfs_/} "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_raidz") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 "${LODEVICES[@]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 $LODEVICES + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_raidz2") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 "${LODEVICES[@]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 $LODEVICES + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_raidz3") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 "${LODEVICES[@]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 $LODEVICES + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_mirror") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror "${LODEVICES[@]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror $LODEVICES + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"zfs_stripe") +- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[@]}" ++ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" $LODEVICES + sleep 1 + "zfs" create "$FSLABEL"/"grub fs" + sleep 1;; + x"tarfs" | x"cpio_"* | x"iso9660" | xjoliet | xrockridge | xrockridge_joliet | x"iso9660_1999" | xjoliet_1999 | xrockridge_1999 | xrockridge_joliet_1999 | x"ziso9660" | x"romfs" | x"squash4_"*) + INSTDEVICE=/dev/null;; + x"reiserfs") +- "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" ;; ++ "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" ;; + x"reiserfs_old") +- "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" ++ "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" + MOUNTFS=reiserfs;; + x"jfs") +- "mkfs.jfs" -L "$FSLABEL" -q "${LODEVICES[0]}" ++ "mkfs.jfs" -L "$FSLABEL" -q "${MOUNTDEVICE}" + MOUNTOPTS="iocharset=utf8,";; + x"jfs_caseins") +- "mkfs.jfs" -O -L "$FSLABEL" -q "${LODEVICES[0]}" ++ "mkfs.jfs" -O -L "$FSLABEL" -q "${MOUNTDEVICE}" + MOUNTFS=jfs + MOUNTOPTS="iocharset=utf8,";; + x"mdraid"*) +- mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" "${LODEVICES[@]}" ++ mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" $LODEVICES + MOUNTDEVICE="/dev/md/${fs}_${NDEVICES}" + MOUNTFS=ext2 + "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; + x"lvm"*) +- for ((i=0;i /dev/null; ++ cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}" &> /dev/null; + else +- for ((i=0;i<$CFILESN;i++)); do +- cp "${CFILESSRC[i]}" "$MNTPOINTRW/$OSDIR/${CFILES[i]}"; +- done ++ ++ cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}"; ++ + fi + + if [ x$NOSYMLINK != xy ]; then +@@ -968,48 +1000,48 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + sleep 2 + ;; + x"tarfs") +- (cd "$MASTER"; tar cf "${FSIMAGES[0]}" .) ;; ++ (cd "$MASTER"; tar cf "${FSIMAGEP}0.img" .) ;; + x"cpio_"*) +- (cd "$MASTER"; find . | cpio -o -H "${fs/cpio_/}" > "${FSIMAGES[0]}" ) ;; ++ (cd "$MASTER"; find . | cpio -o -H "$(echo ${fs} | sed 's@^cpio_@@')" > "${FSIMAGEP}0.img" ) ;; + x"ziso9660") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; ++ xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; + x"iso9660") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"joliet") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"rockridge") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"rockridge_joliet") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"iso9660_1999") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"joliet_1999") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"rockridge_1999") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"rockridge_joliet_1999") + FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); +- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; ++ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; + x"romfs") +- genromfs -V "$FSLABEL" -f "${FSIMAGES[0]}" -d "$MASTER" ;; ++ genromfs -V "$FSLABEL" -f "${FSIMAGEP}0.img" -d "$MASTER" ;; + xsquash4_*) +- echo mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE +- mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; ++ echo mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ++ mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; + x"bfs") + sleep 1 + fusermount -u "$MNTPOINTRW" + ;; + xlvm*) + sleep 1 +- for ((try=0;try < 20; try++)); do ++ for try in $(range 0 20 1); do + if umount "$MNTPOINTRW" ; then + break; + fi +@@ -1021,7 +1053,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + ;; + xmdraid*) + sleep 1 +- for ((try=0;try < 20; try++)); do ++ for try in $(range 0 20 1); do + if umount "$MNTPOINTRW" ; then + break; + fi +@@ -1033,7 +1065,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + ;; + *) + sleep 1 +- for ((try=0;try < 20; try++)); do ++ for try in $(range 0 20 1); do + if umount "$MNTPOINTRW" ; then + break; + fi +@@ -1066,7 +1098,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + sleep 1 + mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; + xmdraid*) +- mdadm --assemble /dev/md/"${fs}_$NDEVICES" "${LODEVICES[@]}" ++ mdadm --assemble /dev/md/"${fs}_$NDEVICES" $LODEVICES + sleep 1 + mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; + *) +@@ -1085,7 +1117,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo LIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + +@@ -1094,7 +1126,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo NLIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" ++ TZ=UTC ls -lA "$MNTPOINTRO" + exit 1 + fi + +@@ -1103,7 +1135,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo ILIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + +@@ -1112,7 +1144,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo LONG LIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + +@@ -1123,7 +1155,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo TIME FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + +@@ -1133,7 +1165,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo LONG TIME FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + fi +@@ -1149,7 +1181,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo DOT IN ROOTDIR FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + +@@ -1163,7 +1195,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo DOTDOT IN ROOTDIR FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" ++ TZ=UTC ls -l "$MNTPOINTRO" + exit 1 + fi + ;; +@@ -1180,7 +1212,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo SLIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/sdir" ++ TZ=UTC ls -l "$MNTPOINTRO/sdir" + exit 1 + fi + +@@ -1195,7 +1227,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo PLIST FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$PDIR" ++ TZ=UTC ls -l "$MNTPOINTRO/$PDIR" + exit 1 + fi + +@@ -1210,7 +1242,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo DOT IN SUBDIR FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/sdir" ++ TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/sdir" + exit 1 + fi + +@@ -1225,7 +1257,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + else + echo DOTDOT IN SUBDIR FAIL + echo "$LSROUT" +- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/ssdir" ++ TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/ssdir" + exit 1 + fi + +@@ -1245,8 +1277,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + case x"$fs" in + x"iso9660" | x"ziso9660" | xrockridge | xjoliet | xrockridge_joliet | x"iso9660_1999" | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ;; + x"zfs"*) +- for ((i=0;i +Date: Mon, 23 Jan 2017 14:31:36 +0300 +Subject: [PATCH 004/176] support busybox date. + +Busybox date doesn't understand weekdays in -d input, +so strip them beforehand. +--- + tests/grub_cmd_date.in | 2 +- + tests/grub_cmd_sleep.in | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in +index 0d8162e98..60f039ebc 100644 +--- a/tests/grub_cmd_date.in ++++ b/tests/grub_cmd_date.in +@@ -9,7 +9,7 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; + fi + + pdt="$(date -u +%s)" +-dt=`echo date | @builddir@/grub-shell` ++dt=`echo date | @builddir@/grub-shell | sed 's, [A-Z][a-z]*$,,'` + dtg="$(date -u -d "$dt" +%s)" + ndt="$(date -u +%s)" + +diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in +index 05b8f6b73..ac51d4209 100644 +--- a/tests/grub_cmd_sleep.in ++++ b/tests/grub_cmd_sleep.in +@@ -11,8 +11,8 @@ fi + # Compare RTC with interval timer. + # Not 100% proper but should check that timer is running ok + dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell` +-dt1="$(date -u -d "$(echo "$dt" | head -n 1)" +%s)" +-dt2="$(date -u -d "$(echo "$dt" | tail -n 1)" +%s)" ++dt1="$(date -u -d "$(echo "$dt" | head -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" ++dt2="$(date -u -d "$(echo "$dt" | tail -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" + + # Ignore QEMU bug + if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then +-- +2.13.0 + diff --git a/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch b/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch new file mode 100644 index 00000000..55f7186d --- /dev/null +++ b/0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch @@ -0,0 +1,72 @@ +From 6dec3a26b37e128ded5d912e08abc5cee1592499 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 21:24:05 +0300 +Subject: [PATCH 005/176] Don't retrieve fstime when it's not useful. + +--- + tests/util/grub-fs-tester.in | 48 ++++++++++++++++++++++---------------------- + 1 file changed, 24 insertions(+), 24 deletions(-) + +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index 4515d165e..bf47305f3 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -1328,31 +1328,31 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + ;; + esac + +- case x$fs in +- xiso9660 | xziso9660 | xrockridge | xjoliet | xrockridge_joliet | xiso9660_1999 | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) +- FSTIME="$(date -d "$(echo ${FSUUID} | awk -F - '{ print $1"-"$2"-"$3" "$4":"$5":"$6 ;}')" '+%Y-%m-%d %H:%M:%S')";; +- xlvm*|xmdraid*) +- # With some abstractions like mdraid flushing to disk +- # may be delayed for a long time. +- FSTIME="$UMOUNT_TIME";; +- *) +- FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGEP}0.img"|awk '{print $6; }'|sed 's,_, ,g')";; +- esac +- # With some abstractions like mdraid computing of UMOUNT_TIME +- # is not precise. Account for small difference here. +- FSTIMEM1="$(date -d "$FSTIME UTC -1 second" -u "+%Y-%m-%d %H:%M:%S")" +- FSTIMEM2="$(date -d "$FSTIME UTC -2 second" -u "+%Y-%m-%d %H:%M:%S")" +- FSTIMEM3="$(date -d "$FSTIME UTC -3 second" -u "+%Y-%m-%d %H:%M:%S")" ++ if [ x$NOFSTIME != xy ]; then ++ case x$fs in ++ xiso9660 | xziso9660 | xrockridge | xjoliet | xrockridge_joliet | xiso9660_1999 | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ++ FSTIME="$(date -d "$(echo ${FSUUID} | awk -F - '{ print $1"-"$2"-"$3" "$4":"$5":"$6 ;}')" '+%Y-%m-%d %H:%M:%S')";; ++ xlvm*|xmdraid*) ++ # With some abstractions like mdraid flushing to disk ++ # may be delayed for a long time. ++ FSTIME="$UMOUNT_TIME";; ++ *) ++ FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGEP}0.img"|awk '{print $6; }'|sed 's,_, ,g')";; ++ esac ++ # With some abstractions like mdraid computing of UMOUNT_TIME ++ # is not precise. Account for small difference here. ++ FSTIMEM1="$(date -d "$FSTIME UTC -1 second" -u "+%Y-%m-%d %H:%M:%S")" ++ FSTIMEM2="$(date -d "$FSTIME UTC -2 second" -u "+%Y-%m-%d %H:%M:%S")" ++ FSTIMEM3="$(date -d "$FSTIME UTC -3 second" -u "+%Y-%m-%d %H:%M:%S")" + +- if [ x$NOFSTIME = xy ]; then +- : +- elif echo "$LSOUT" | grep -F 'Last modification time '"$FSTIME" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM1" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM2" || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM3" > /dev/null; then +- : +- else +- echo FSTIME FAIL +- echo "$FSTIME" +- echo "$LSOUT" +- exit 1 ++ if echo "$LSOUT" | grep -F 'Last modification time '"$FSTIME" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM1" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM2" || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM3" > /dev/null; then ++ : ++ else ++ echo FSTIME FAIL ++ echo "$FSTIME" ++ echo "$LSOUT" ++ exit 1 ++ fi + fi + + if [ x$NOHARDLINK != xy ]; then +-- +2.13.0 + diff --git a/0006-Support-lseek64.patch b/0006-Support-lseek64.patch new file mode 100644 index 00000000..5cddc26a --- /dev/null +++ b/0006-Support-lseek64.patch @@ -0,0 +1,54 @@ +From 608bec51128008afb81c9e3f297283e9f830a146 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 20:21:05 +0300 +Subject: [PATCH 006/176] Support lseek64. + +Android doesn't have 64-bit off_t, so use off64_t instead. +--- + configure.ac | 5 ++++- + grub-core/osdep/unix/hostdisk.c | 8 ++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index d10d8adac..e0262e159 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -373,7 +373,10 @@ case "$host_os" in + ;; + *) + AC_CHECK_SIZEOF(off_t) +- test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);; ++ if test x"$ac_cv_sizeof_off_t" != x8 ; then ++ AC_CHECK_SIZEOF(off64_t) ++ test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required]) ++ fi;; + esac + + if test x$USE_NLS = xno; then +diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c +index 2a8c5882e..5450cf416 100644 +--- a/grub-core/osdep/unix/hostdisk.c ++++ b/grub-core/osdep/unix/hostdisk.c +@@ -77,11 +77,19 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz + int + grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) + { ++#if SIZEOF_OFF_T == 8 + off_t offset = (off_t) off; + + if (lseek (fd, offset, SEEK_SET) != offset) + return -1; ++#elif SIZEOF_OFF64_T == 8 ++ off64_t offset = (off64_t) off; + ++ if (lseek64 (fd, offset, SEEK_SET) != offset) ++ return -1; ++#else ++#error "No large file support" ++#endif + return 0; + } + +-- +2.13.0 + diff --git a/0007-Use-SHELL-rather-than-bin-sh.patch b/0007-Use-SHELL-rather-than-bin-sh.patch new file mode 100644 index 00000000..409f3437 --- /dev/null +++ b/0007-Use-SHELL-rather-than-bin-sh.patch @@ -0,0 +1,26 @@ +From c2ea443446b7feea868e54f94a87781f69820375 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 00:55:30 +0300 +Subject: [PATCH 007/176] Use $(SHELL) rather than /bin/sh. + +/bin/sh doesn't exist under termux. +--- + grub-core/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 04e9395fd..809a8aa26 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -278,7 +278,7 @@ BUILT_SOURCES += symlist.h + + symlist.c: symlist.h gensymlist.sh + $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) +- cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) ++ cat symlist.p | $(SHELL) $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) + rm -f symlist.p + CLEANFILES += symlist.c + BUILT_SOURCES += symlist.c +-- +2.13.0 + diff --git a/0008-Add-vlan-tag-support-on-IBM-PPC-machines.patch b/0008-Add-vlan-tag-support-on-IBM-PPC-machines.patch deleted file mode 100644 index 05af50c8..00000000 --- a/0008-Add-vlan-tag-support-on-IBM-PPC-machines.patch +++ /dev/null @@ -1,186 +0,0 @@ -From de423b22780b0fd225a1ee476166777af29d53d0 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 30 Oct 2012 15:19:39 -0200 -Subject: [PATCH 08/90] Add vlan-tag support on IBM PPC machines - -This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows -multiple VLANs in a bridged network to share the same physical network link but -maintain isolation: - -http://en.wikipedia.org/wiki/IEEE_802.1Q - -This patch should fix this bugzilla: -https://bugzilla.redhat.com/show_bug.cgi?id=871563 ---- - grub-core/kern/ieee1275/init.c | 1 + - grub-core/kern/ieee1275/openfw.c | 30 ++++++++++++++++++++++++++++ - grub-core/net/ethernet.c | 42 +++++++++++++++++++++++++++++++++++++--- - include/grub/ieee1275/ieee1275.h | 1 + - include/grub/net.h | 2 ++ - 5 files changed, 73 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 1259022..5fa26e1 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -125,6 +125,7 @@ grub_machine_get_bootlocation (char **device, char **path) - char *dev, *canon; - char *ptr; - dev = grub_ieee1275_get_aliasdevname (bootpath); -+ grub_ieee1275_parse_net_options (bootpath); - canon = grub_ieee1275_canonicalise_devname (dev); - ptr = canon + grub_strlen (canon) - 1; - while (ptr > canon && (*ptr == ',' || *ptr == ':')) -diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 6db8b98..81276fa 100644 ---- a/grub-core/kern/ieee1275/openfw.c -+++ b/grub-core/kern/ieee1275/openfw.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - enum grub_ieee1275_parse_type - { -@@ -451,6 +452,35 @@ fail: - return ret; - } - -+int -+grub_ieee1275_parse_net_options (const char *path) -+{ -+ char *comma; -+ char *args; -+ char *option = 0; -+ -+ args = grub_ieee1275_get_devargs (path); -+ if (!args) -+ /* There is no option. */ -+ return -1; -+ -+ do -+ { -+ comma = grub_strchr (args, ','); -+ if (! comma) -+ option = grub_strdup (args); -+ else -+ option = grub_strndup (args, (grub_size_t)(comma - args)); -+ args = comma + 1; -+ -+ if (! grub_strncmp(option, "vtag", 4)) -+ grub_env_set ("vlan-tag", option + grub_strlen("vtag=")); -+ -+ } while (comma); -+ -+ return 0; -+} -+ - char * - grub_ieee1275_get_device_type (const char *path) - { -diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index c397b1b..faaca67 100644 ---- a/grub-core/net/ethernet.c -+++ b/grub-core/net/ethernet.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, - { - struct etherhdr *eth; - grub_err_t err; -+ grub_uint32_t vlantag = 0; -+ grub_uint8_t etherhdr_size; - -- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE); -+ etherhdr_size = sizeof (*eth); -+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE); - -- err = grub_netbuff_push (nb, sizeof (*eth)); -+ const char *vlantag_text = grub_env_get ("vlan-tag"); -+ if (vlantag_text != 0) { -+ etherhdr_size += 4; -+ vlantag = grub_strtoul (vlantag_text, 0, 16); -+ } -+ -+ err = grub_netbuff_push (nb, etherhdr_size); - if (err) - return err; - eth = (struct etherhdr *) nb->data; -@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, - return err; - inf->card->opened = 1; - } -+ -+ /* Check if a vlan-tag is needed. */ -+ if (vlantag != 0) -+ { -+ /* Move eth type to the right */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 2, -+ (char *) nb->data + etherhdr_size - 6, 2); -+ -+ /* Add the tag in the middle */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ &vlantag, 4); -+ } -+ - return inf->card->driver->send (inf->card, nb); - } - -@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, - grub_net_link_level_address_t hwaddress; - grub_net_link_level_address_t src_hwaddress; - grub_err_t err; -+ grub_uint8_t etherhdr_size = sizeof (*eth); -+ -+ grub_uint16_t vlantag_identifier = 0; -+ grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2); -+ -+ /* Check if a vlan-tag is present. */ -+ if (vlantag_identifier == VLANTAG_IDENTIFIER) -+ { -+ etherhdr_size += 4; -+ /* Move eth type to the original position */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ (char *) nb->data + etherhdr_size - 2, 2); -+ } - - eth = (struct etherhdr *) nb->data; - type = grub_be_to_cpu16 (eth->type); -- err = grub_netbuff_pull (nb, sizeof (*eth)); -+ err = grub_netbuff_pull (nb, etherhdr_size); - if (err) - return err; - -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index ab4f284..663935d 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -238,6 +238,7 @@ void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, - struct grub_ieee1275_devalias *alias); - int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script); - int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text); -+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path); - - #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) - -diff --git a/include/grub/net.h b/include/grub/net.h -index 2192fa1..6ac9d72 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -561,4 +561,6 @@ extern char *grub_net_default_server; - #define GRUB_NET_INTERVAL 400 - #define GRUB_NET_INTERVAL_ADDITION 20 - -+#define VLANTAG_IDENTIFIER 0x8100 -+ - #endif /* ! GRUB_NET_HEADER */ --- -2.9.3 - diff --git a/0008-po-Use-SHELL-rather-than-bin-sh.patch b/0008-po-Use-SHELL-rather-than-bin-sh.patch new file mode 100644 index 00000000..2b159855 --- /dev/null +++ b/0008-po-Use-SHELL-rather-than-bin-sh.patch @@ -0,0 +1,26 @@ +From 4341f82af0b61d3dfbe675670d4105dc759c0df3 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 14:54:03 +0300 +Subject: [PATCH 008/176] po: Use @SHELL@ rather than /bin/sh. + +/bin/sh might not exist. +--- + po/Makefile.in.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/po/Makefile.in.in b/po/Makefile.in.in +index 3619458e8..e68e9da84 100644 +--- a/po/Makefile.in.in ++++ b/po/Makefile.in.in +@@ -15,7 +15,7 @@ PACKAGE = @PACKAGE@ + VERSION = @VERSION@ + PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +-SHELL = /bin/sh ++SHELL = @SHELL@ + @SET_MAKE@ + + srcdir = @srcdir@ +-- +2.13.0 + diff --git a/0009-Add-termux-path-to-dict.patch b/0009-Add-termux-path-to-dict.patch new file mode 100644 index 00000000..57ab2b30 --- /dev/null +++ b/0009-Add-termux-path-to-dict.patch @@ -0,0 +1,25 @@ +From 1073ddb12078f3c8edbdb74bb8f5afc674983f40 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 23 Jan 2017 14:52:48 +0300 +Subject: [PATCH 009/176] Add termux path to dict. + +--- + tests/util/grub-fs-tester.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index bf47305f3..468d9e785 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -259,7 +259,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + MASTER="${tempdir}/master" + FSLABEL="grub_;/testé莭莽茝😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewrewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfew" + CFILESRC= +- for cand in /usr/share/dict/american-english /usr/share/dict/linux.words; do ++ for cand in /usr/share/dict/american-english /usr/share/dict/linux.words /data/data/com.termux/files/usr/share/hunspell/en_US.dic; do + if test -f "$cand" ; then + CFILESRC="$cand" + break +-- +2.13.0 + diff --git a/0010-Fix-shebang-for-termux.patch b/0010-Fix-shebang-for-termux.patch new file mode 100644 index 00000000..c5d49554 --- /dev/null +++ b/0010-Fix-shebang-for-termux.patch @@ -0,0 +1,684 @@ +From a827807a1330d5ad619faa103bc7f12d89fc8bee Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Sun, 22 Jan 2017 20:22:34 +0300 +Subject: [PATCH 010/176] Fix shebang for termux. + +Termux doesn't have a /bin/sh. So we needto use $SHELL. +Keep /bin/sh as much as possible. +--- + configure.ac | 10 ++++++++++ + grub-core/genmod.sh.in | 2 +- + grub-core/gensyminfo.sh.in | 2 +- + grub-core/modinfo.sh.in | 2 +- + tests/ahci_test.in | 2 +- + tests/btrfs_test.in | 2 +- + tests/cdboot_test.in | 2 +- + tests/core_compress_test.in | 2 +- + tests/cpio_test.in | 2 +- + tests/ehci_test.in | 2 +- + tests/example_scripted_test.in | 2 +- + tests/exfat_test.in | 2 +- + tests/ext234_test.in | 2 +- + tests/fat_test.in | 2 +- + tests/fddboot_test.in | 2 +- + tests/file_filter_test.in | 2 +- + tests/gettext_strings_test.in | 2 +- + tests/grub_cmd_date.in | 2 +- + tests/grub_cmd_regexp.in | 2 +- + tests/grub_cmd_set_date.in | 2 +- + tests/grub_cmd_sleep.in | 2 +- + tests/grub_cmd_test.in | 2 +- + tests/grub_cmd_tr.in | 2 +- + tests/grub_func_test.in | 2 +- + tests/grub_script_blanklines.in | 2 +- + tests/grub_script_blockarg.in | 2 +- + tests/grub_script_dollar.in | 2 +- + tests/grub_script_expansion.in | 2 +- + tests/grub_script_final_semicolon.in | 2 +- + tests/grub_script_no_commands.in | 2 +- + tests/gzcompress_test.in | 2 +- + tests/hddboot_test.in | 2 +- + tests/help_test.in | 2 +- + tests/hfs_test.in | 2 +- + tests/hfsplus_test.in | 2 +- + tests/iso9660_test.in | 2 +- + tests/jfs_test.in | 2 +- + tests/lzocompress_test.in | 2 +- + tests/minixfs_test.in | 2 +- + tests/netboot_test.in | 2 +- + tests/nilfs2_test.in | 2 +- + tests/ntfs_test.in | 2 +- + tests/ohci_test.in | 2 +- + tests/partmap_test.in | 2 +- + tests/pata_test.in | 2 +- + tests/pseries_test.in | 2 +- + tests/reiserfs_test.in | 2 +- + tests/romfs_test.in | 2 +- + tests/squashfs_test.in | 2 +- + tests/syslinux_test.in | 2 +- + tests/tar_test.in | 2 +- + tests/test_sha512sum.in | 2 +- + tests/udf_test.in | 2 +- + tests/uhci_test.in | 2 +- + tests/util/grub-fs-tester.in | 2 +- + tests/util/grub-shell-tester.in | 2 +- + tests/util/grub-shell.in | 2 +- + tests/xfs_test.in | 2 +- + tests/xzcompress_test.in | 2 +- + tests/zfs_test.in | 2 +- + 60 files changed, 69 insertions(+), 59 deletions(-) + +diff --git a/configure.ac b/configure.ac +index e0262e159..ee2c86537 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -459,6 +459,16 @@ case "$build_os" in + esac + AC_SUBST(BUILD_EXEEXT) + ++# In some build environments like termux /bin/sh is not a valid ++# shebang. Use $SHELL instead if it's executable and /bin/sh isn't ++BUILD_SHEBANG=/bin/sh ++for she in /bin/sh "$SHELL"; do ++ if test -x "$she" ; then ++ BUILD_SHEBANG="$she" ++ fi ++done ++AC_SUBST(BUILD_SHEBANG) ++ + # For gnulib. + gl_INIT + +diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in +index 03cc3b7f6..3de06ee01 100644 +--- a/grub-core/genmod.sh.in ++++ b/grub-core/genmod.sh.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + # Copyright (C) 2010 Free Software Foundation, Inc. +diff --git a/grub-core/gensyminfo.sh.in b/grub-core/gensyminfo.sh.in +index 2e8716b42..9bc767532 100644 +--- a/grub-core/gensyminfo.sh.in ++++ b/grub-core/gensyminfo.sh.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + # Copyright (C) 2010 Free Software Foundation, Inc. +diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in +index faf0ad30e..f6cd657ce 100644 +--- a/grub-core/modinfo.sh.in ++++ b/grub-core/modinfo.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + # User-controllable options + grub_modinfo_target_cpu=@target_cpu@ +diff --git a/tests/ahci_test.in b/tests/ahci_test.in +index 1d01d1f59..7df560462 100644 +--- a/tests/ahci_test.in ++++ b/tests/ahci_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2013 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/btrfs_test.in b/tests/btrfs_test.in +index c55d9477f..2b37ddd33 100644 +--- a/tests/btrfs_test.in ++++ b/tests/btrfs_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + set -e + +diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in +index 1cc901977..75acdfedb 100644 +--- a/tests/cdboot_test.in ++++ b/tests/cdboot_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2013 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in +index 1003587cc..9d216ebcf 100644 +--- a/tests/core_compress_test.in ++++ b/tests/core_compress_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2013 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/cpio_test.in b/tests/cpio_test.in +index 0b09db549..5742cf17b 100644 +--- a/tests/cpio_test.in ++++ b/tests/cpio_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + set -e + +diff --git a/tests/ehci_test.in b/tests/ehci_test.in +index 7dd8d3e8f..b197f8cdc 100644 +--- a/tests/ehci_test.in ++++ b/tests/ehci_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2013 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/example_scripted_test.in b/tests/example_scripted_test.in +index 09633e893..783b7f138 100644 +--- a/tests/example_scripted_test.in ++++ b/tests/example_scripted_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + set -e + + true +diff --git a/tests/exfat_test.in b/tests/exfat_test.in +index fc1a0fe5e..cd3cd4cb2 100644 +--- a/tests/exfat_test.in ++++ b/tests/exfat_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + set -e + +diff --git a/tests/ext234_test.in b/tests/ext234_test.in +index c986960a8..892b99cbd 100644 +--- a/tests/ext234_test.in ++++ b/tests/ext234_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + set -e + +diff --git a/tests/fat_test.in b/tests/fat_test.in +index 1d132b517..b6b4748ca 100644 +--- a/tests/fat_test.in ++++ b/tests/fat_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + set -e + +diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in +index a59645b7f..2d7dfc889 100644 +--- a/tests/fddboot_test.in ++++ b/tests/fddboot_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2013 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/file_filter_test.in b/tests/file_filter_test.in +index 8909e4021..bfb638227 100644 +--- a/tests/file_filter_test.in ++++ b/tests/file_filter_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + # Copyright (C) 2014 Free Software Foundation, Inc. + # + # GRUB is free software: you can redistribute it and/or modify +diff --git a/tests/gettext_strings_test.in b/tests/gettext_strings_test.in +index 5c305e75b..813999ebe 100644 +--- a/tests/gettext_strings_test.in ++++ b/tests/gettext_strings_test.in +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!@BUILD_SHEBANG@ + + cd '@srcdir@' + +diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in +index 60f039ebc..f7c9ca004 100644 +--- a/tests/grub_cmd_date.in ++++ b/tests/grub_cmd_date.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_regexp.in b/tests/grub_cmd_regexp.in +index 7e9ab86aa..6520bd6d7 100644 +--- a/tests/grub_cmd_regexp.in ++++ b/tests/grub_cmd_regexp.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + # Run GRUB script in a Qemu instance +diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in +index 2f518dd9e..aac120a6c 100644 +--- a/tests/grub_cmd_set_date.in ++++ b/tests/grub_cmd_set_date.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in +index ac51d4209..8797f6632 100644 +--- a/tests/grub_cmd_sleep.in ++++ b/tests/grub_cmd_sleep.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in +index 49ae8a9c8..3399eb292 100644 +--- a/tests/grub_cmd_test.in ++++ b/tests/grub_cmd_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + + # create a randome file + empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +diff --git a/tests/grub_cmd_tr.in b/tests/grub_cmd_tr.in +index 0e8d645eb..bed469c03 100644 +--- a/tests/grub_cmd_tr.in ++++ b/tests/grub_cmd_tr.in +@@ -1,4 +1,4 @@ +-#! /bin/sh -e ++#! @BUILD_SHEBANG@ -e + + # Run GRUB script in a Qemu instance + # Copyright (C) 2010 Free Software Foundation, Inc. +diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in +index b32f24466..c67f9e422 100644 +--- a/tests/grub_func_test.in ++++ b/tests/grub_func_test.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + . "@builddir@/grub-core/modinfo.sh" +diff --git a/tests/grub_script_blanklines.in b/tests/grub_script_blanklines.in +index 89ed763d3..bd8735491 100644 +--- a/tests/grub_script_blanklines.in ++++ b/tests/grub_script_blanklines.in +@@ -1,4 +1,4 @@ +-#! /bin/sh ++#! @BUILD_SHEBANG@ + set -e + + @builddir@/grub-script-check < +Date: Wed, 3 May 2017 12:58:15 +0200 +Subject: [PATCH 011/176] Add strtoull test. + +--- + grub-core/Makefile.core.def | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 2dfa22a92..8dcd0e5a9 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1962,6 +1962,11 @@ module = { + }; + + module = { ++ name = strtoull_test; ++ common = tests/strtoull_test.c; ++}; ++ ++module = { + name = setjmp_test; + common = tests/setjmp_test.c; + }; +-- +2.13.0 + diff --git a/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch b/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch new file mode 100644 index 00000000..a5f993be --- /dev/null +++ b/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch @@ -0,0 +1,68 @@ +From dc6e1b5af83eb1c4290baf97c2d221c0865127be Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Wed, 10 Aug 2016 17:49:42 +0200 +Subject: [PATCH 012/176] strtoull: Fix behaviour on chars between '9' and 'a'. + +Reported by: Aaron Miller +--- + grub-core/kern/misc.c | 13 +++++++------ + grub-core/tests/lib/functional_test.c | 13 +++++++++++-- + 2 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index d1a54df6c..3b633d51f 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -391,12 +391,13 @@ grub_strtoull (const char *str, char **end, int base) + unsigned long digit; + + digit = grub_tolower (*str) - '0'; +- if (digit > 9) +- { +- digit += '0' - 'a' + 10; +- if (digit >= (unsigned long) base) +- break; +- } ++ if (digit >= 'a' - '0') ++ digit += '0' - 'a' + 10; ++ else if (digit > 9) ++ break; ++ ++ if (digit >= (unsigned long) base) ++ break; + + found = 1; + +diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c +index d4822a124..96781fb39 100644 +--- a/grub-core/tests/lib/functional_test.c ++++ b/grub-core/tests/lib/functional_test.c +@@ -26,14 +26,23 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_err_t + grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)), +- int argc __attribute__ ((unused)), +- char **args __attribute__ ((unused))) ++ int argc, ++ char **args) + { + grub_test_t test; + int ok = 1; ++ int i; + + FOR_LIST_ELEMENTS (test, grub_test_list) + { ++ if (argc != 0) ++ { ++ for (i = 0; i < argc; i++) ++ if (grub_strcmp(args[i], test->name) == 0) ++ break; ++ if (i == argc) ++ continue; ++ } + grub_errno = 0; + ok = ok && !grub_test_run (test); + grub_errno = 0; +-- +2.13.0 + diff --git a/0013-Add-Virtual-LAN-support.patch b/0013-Add-Virtual-LAN-support.patch new file mode 100644 index 00000000..566f3de5 --- /dev/null +++ b/0013-Add-Virtual-LAN-support.patch @@ -0,0 +1,349 @@ +From d9f7de0ae3c0c09cff7257c55418450261f3e082 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Mon, 23 Dec 2013 12:32:02 -0200 +Subject: [PATCH 013/176] Add Virtual LAN support. + +This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows +multiple VLANs in a bridged network to share the same physical network link +but maintain isolation: + +http://en.wikipedia.org/wiki/IEEE_802.1Q + +* grub-core/net/ethernet.c: Add check, get, and set vlan tag id. +* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs. +* grub-core/net/arp.c: Add check. +* grub-core/net/ip.c: Likewise. +* include/grub/net/arp.h: Add vlantag attribute. +* include/grub/net/ip.h: Likewise. +--- + grub-core/net/arp.c | 12 +++++++-- + grub-core/net/drivers/ieee1275/ofnet.c | 9 ++++++- + grub-core/net/ethernet.c | 47 ++++++++++++++++++++++++++++++---- + grub-core/net/ip.c | 33 +++++++++++++++++------- + include/grub/net.h | 3 +++ + include/grub/net/arp.h | 5 ++-- + include/grub/net/ip.h | 3 ++- + 7 files changed, 92 insertions(+), 20 deletions(-) + +diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c +index 4b68c4151..54306e3b1 100644 +--- a/grub-core/net/arp.c ++++ b/grub-core/net/arp.c +@@ -111,8 +111,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, + } + + grub_err_t +-grub_net_arp_receive (struct grub_net_buff *nb, +- struct grub_net_card *card) ++grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, ++ grub_uint16_t *vlantag) + { + struct arppkt *arp_packet = (struct arppkt *) nb->data; + grub_net_network_level_address_t sender_addr, target_addr; +@@ -138,6 +138,14 @@ grub_net_arp_receive (struct grub_net_buff *nb, + + FOR_NET_NETWORK_LEVEL_INTERFACES (inf) + { ++ /* Verify vlantag id */ ++ if (inf->card == card && inf->vlantag != *vlantag) ++ { ++ grub_dprintf ("net", "invalid vlantag! %x != %x\n", ++ inf->vlantag, *vlantag); ++ break; ++ } ++ + /* Am I the protocol address target? */ + if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 + && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) +diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c +index a78d164db..002446be1 100644 +--- a/grub-core/net/drivers/ieee1275/ofnet.c ++++ b/grub-core/net/drivers/ieee1275/ofnet.c +@@ -153,11 +153,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, + char *comma_char = 0; + char *equal_char = 0; + grub_size_t field_counter = 0; +- + grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; + grub_net_link_level_address_t hw_addr; + grub_net_interface_flags_t flags = 0; + struct grub_net_network_level_interface *inter = NULL; ++ grub_uint16_t vlantag = 0; + + hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; + +@@ -175,6 +175,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, + *equal_char = 0; + grub_env_set_net_property ((*card)->name, args, equal_char + 1, + grub_strlen(equal_char + 1)); ++ ++ if ((grub_strcmp (args, "vtag") == 0) && ++ (grub_strlen (equal_char + 1) == 8)) ++ vlantag = grub_strtoul (equal_char + 1 + 4, 0, 16); ++ + *equal_char = '='; + } + else +@@ -213,8 +218,10 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, + hw_addr.mac, sizeof(hw_addr.mac), 0); + inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr, + flags); ++ inter->vlantag = vlantag; + grub_net_add_ipv4_local (inter, + __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); ++ + } + + if (gateway_addr.ipv4 != 0) +diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c +index c397b1b34..4d7ceed6f 100644 +--- a/grub-core/net/ethernet.c ++++ b/grub-core/net/ethernet.c +@@ -18,6 +18,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -56,10 +57,17 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, + { + struct etherhdr *eth; + grub_err_t err; ++ grub_uint8_t etherhdr_size; ++ grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER; + +- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE); ++ etherhdr_size = sizeof (*eth); ++ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE); + +- err = grub_netbuff_push (nb, sizeof (*eth)); ++ /* Increase ethernet header in case of vlantag */ ++ if (inf->vlantag != 0) ++ etherhdr_size += 4; ++ ++ err = grub_netbuff_push (nb, etherhdr_size); + if (err) + return err; + eth = (struct etherhdr *) nb->data; +@@ -76,6 +84,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, + return err; + inf->card->opened = 1; + } ++ ++ /* Check and add a vlan-tag if needed. */ ++ if (inf->vlantag != 0) ++ { ++ /* Move eth type to the right */ ++ grub_memcpy ((char *) nb->data + etherhdr_size - 2, ++ (char *) nb->data + etherhdr_size - 6, 2); ++ ++ /* Add the tag in the middle */ ++ grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2); ++ grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2); ++ } ++ + return inf->card->driver->send (inf->card, nb); + } + +@@ -90,10 +111,25 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, + grub_net_link_level_address_t hwaddress; + grub_net_link_level_address_t src_hwaddress; + grub_err_t err; ++ grub_uint8_t etherhdr_size = sizeof (*eth); ++ grub_uint16_t vlantag = 0; ++ ++ ++ /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */ ++ /* longer than the original one. The vlantag id is extracted and the header */ ++ /* is reseted to the original size. */ ++ if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER) ++ { ++ vlantag = grub_get_unaligned16 (nb->data + etherhdr_size); ++ etherhdr_size += 4; ++ /* Move eth type to the original position */ ++ grub_memcpy((char *) nb->data + etherhdr_size - 6, ++ (char *) nb->data + etherhdr_size - 2, 2); ++ } + + eth = (struct etherhdr *) nb->data; + type = grub_be_to_cpu16 (eth->type); +- err = grub_netbuff_pull (nb, sizeof (*eth)); ++ err = grub_netbuff_pull (nb, etherhdr_size); + if (err) + return err; + +@@ -121,13 +157,14 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, + { + /* ARP packet. */ + case GRUB_NET_ETHERTYPE_ARP: +- grub_net_arp_receive (nb, card); ++ grub_net_arp_receive (nb, card, &vlantag); + grub_netbuff_free (nb); + return GRUB_ERR_NONE; + /* IP packet. */ + case GRUB_NET_ETHERTYPE_IP: + case GRUB_NET_ETHERTYPE_IP6: +- return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress); ++ return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress, ++ &vlantag); + } + grub_netbuff_free (nb); + return GRUB_ERR_NONE; +diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c +index aba4f8908..7c95cc746 100644 +--- a/grub-core/net/ip.c ++++ b/grub-core/net/ip.c +@@ -228,12 +228,13 @@ handle_dgram (struct grub_net_buff *nb, + grub_net_ip_protocol_t proto, + const grub_net_network_level_address_t *source, + const grub_net_network_level_address_t *dest, ++ grub_uint16_t *vlantag, + grub_uint8_t ttl) + { + struct grub_net_network_level_interface *inf = NULL; + grub_err_t err; + int multicast = 0; +- ++ + /* DHCP needs special treatment since we don't know IP yet. */ + { + struct udphdr *udph; +@@ -293,6 +294,15 @@ handle_dgram (struct grub_net_buff *nb, + && grub_net_addr_cmp (&inf->address, dest) == 0 + && grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0) + break; ++ ++ /* Verify vlantag id */ ++ if (inf->card == card && inf->vlantag != *vlantag) ++ { ++ grub_dprintf ("net", "invalid vlantag! %x != %x\n", ++ inf->vlantag, *vlantag); ++ break; ++ } ++ + /* Solicited node multicast. */ + if (inf->card == card + && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6 +@@ -383,7 +393,8 @@ static grub_err_t + grub_net_recv_ip4_packets (struct grub_net_buff *nb, + struct grub_net_card *card, + const grub_net_link_level_address_t *hwaddress, +- const grub_net_link_level_address_t *src_hwaddress) ++ const grub_net_link_level_address_t *src_hwaddress, ++ grub_uint16_t *vlantag) + { + struct iphdr *iph = (struct iphdr *) nb->data; + grub_err_t err; +@@ -458,7 +469,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, + dest.ipv4 = iph->dest; + + return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, +- &source, &dest, iph->ttl); ++ &source, &dest, vlantag, iph->ttl); + } + + for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev) +@@ -594,7 +605,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, + dest.ipv4 = dst; + + return handle_dgram (ret, card, src_hwaddress, +- hwaddress, proto, &source, &dest, ++ hwaddress, proto, &source, &dest, vlantag, + ttl); + } + } +@@ -652,7 +663,8 @@ static grub_err_t + grub_net_recv_ip6_packets (struct grub_net_buff *nb, + struct grub_net_card *card, + const grub_net_link_level_address_t *hwaddress, +- const grub_net_link_level_address_t *src_hwaddress) ++ const grub_net_link_level_address_t *src_hwaddress, ++ grub_uint16_t *vlantag) + { + struct ip6hdr *iph = (struct ip6hdr *) nb->data; + grub_err_t err; +@@ -703,21 +715,24 @@ grub_net_recv_ip6_packets (struct grub_net_buff *nb, + grub_memcpy (dest.ipv6, &iph->dest, sizeof (dest.ipv6)); + + return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, +- &source, &dest, iph->ttl); ++ &source, &dest, vlantag, iph->ttl); + } + + grub_err_t + grub_net_recv_ip_packets (struct grub_net_buff *nb, + struct grub_net_card *card, + const grub_net_link_level_address_t *hwaddress, +- const grub_net_link_level_address_t *src_hwaddress) ++ const grub_net_link_level_address_t *src_hwaddress, ++ grub_uint16_t *vlantag) + { + struct iphdr *iph = (struct iphdr *) nb->data; + + if ((iph->verhdrlen >> 4) == 4) +- return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress); ++ return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress, ++ vlantag); + if ((iph->verhdrlen >> 4) == 6) +- return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress); ++ return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress, ++ vlantag); + grub_dprintf ("net", "Bad IP version: %d\n", (iph->verhdrlen >> 4)); + grub_netbuff_free (nb); + return GRUB_ERR_NONE; +diff --git a/include/grub/net.h b/include/grub/net.h +index 2192fa186..1096b2432 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -291,6 +291,7 @@ struct grub_net_network_level_interface + grub_net_interface_flags_t flags; + struct grub_net_bootp_packet *dhcp_ack; + grub_size_t dhcp_acklen; ++ grub_uint16_t vlantag; + void *data; + }; + +@@ -561,4 +562,6 @@ extern char *grub_net_default_server; + #define GRUB_NET_INTERVAL 400 + #define GRUB_NET_INTERVAL_ADDITION 20 + ++#define VLANTAG_IDENTIFIER 0x8100 ++ + #endif /* ! GRUB_NET_HEADER */ +diff --git a/include/grub/net/arp.h b/include/grub/net/arp.h +index bb1703622..8d9d08113 100644 +--- a/include/grub/net/arp.h ++++ b/include/grub/net/arp.h +@@ -22,10 +22,11 @@ + #include + + extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb, +- struct grub_net_card *card); ++ struct grub_net_card *card, ++ grub_uint16_t *vlantag); + + grub_err_t + grub_net_arp_send_request (struct grub_net_network_level_interface *inf, +- const grub_net_network_level_address_t *proto_addr); ++ const grub_net_network_level_address_t *proto_addr); + + #endif +diff --git a/include/grub/net/ip.h b/include/grub/net/ip.h +index dcceaa568..ab9d68f98 100644 +--- a/include/grub/net/ip.h ++++ b/include/grub/net/ip.h +@@ -48,7 +48,8 @@ grub_err_t + grub_net_recv_ip_packets (struct grub_net_buff *nb, + struct grub_net_card *card, + const grub_net_link_level_address_t *hwaddress, +- const grub_net_link_level_address_t *src_hwaddress); ++ const grub_net_link_level_address_t *src_hwaddress, ++ grub_uint16_t *vlantag); + + grub_err_t + grub_net_send_ip_packet (struct grub_net_network_level_interface *inf, +-- +2.13.0 + diff --git a/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch b/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch new file mode 100644 index 00000000..ac15af10 --- /dev/null +++ b/0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch @@ -0,0 +1,168 @@ +From a35ac854308b0af7c86c2c7b199f6abdfa2110b0 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 17:32:15 +0200 +Subject: [PATCH 014/176] mkimage: Pass layout to mkimage_generate_elfXX rather + than some fields. + +This allows easier extension of this function without having too long of +arguments list. +--- + include/grub/util/mkimage.h | 8 ++++---- + util/grub-mkimagexx.c | 35 ++++++++++++++++++----------------- + util/mkimage.c | 4 ++-- + 3 files changed, 24 insertions(+), 23 deletions(-) + +diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h +index 1a18708a8..b3a5ca132 100644 +--- a/include/grub/util/mkimage.h ++++ b/include/grub/util/mkimage.h +@@ -51,13 +51,13 @@ grub_mkimage_load_image64 (const char *kernel_path, + void + grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target, + int note, char **core_img, size_t *core_size, +- Elf32_Addr target_addr, grub_size_t align, +- size_t kernel_size, size_t bss_size); ++ Elf32_Addr target_addr, ++ struct grub_mkimage_layout *layout); + void + grub_mkimage_generate_elf64 (const struct grub_install_image_target_desc *image_target, + int note, char **core_img, size_t *core_size, +- Elf64_Addr target_addr, grub_size_t align, +- size_t kernel_size, size_t bss_size); ++ Elf64_Addr target_addr, ++ struct grub_mkimage_layout *layout); + + struct grub_install_image_target_desc + { +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index e63f148e4..3fab93e20 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -185,8 +185,8 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) + void + SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc *image_target, + int note, char **core_img, size_t *core_size, +- Elf_Addr target_addr, grub_size_t align, +- size_t kernel_size, size_t bss_size) ++ Elf_Addr target_addr, ++ struct grub_mkimage_layout *layout) + { + char *elf_img; + size_t program_size; +@@ -214,7 +214,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + footer_size += XEN_NOTE_SIZE; + } + header_size = ALIGN_UP (sizeof (*ehdr) + phnum * sizeof (*phdr) +- + shnum * sizeof (*shdr) + string_size, align); ++ + shnum * sizeof (*shdr) + string_size, layout->align); + + program_size = ALIGN_ADDR (*core_size); + +@@ -258,7 +258,8 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + ehdr->e_entry = grub_host_to_target32 (target_addr); + phdr->p_vaddr = grub_host_to_target32 (target_addr); + phdr->p_paddr = grub_host_to_target32 (target_addr); +- phdr->p_align = grub_host_to_target32 (align > image_target->link_align ? align : image_target->link_align); ++ phdr->p_align = grub_host_to_target32 (layout->align > image_target->link_align ? ++ layout->align : image_target->link_align); + if (image_target->id == IMAGE_LOONGSON_ELF) + ehdr->e_flags = grub_host_to_target32 (0x1000 | EF_MIPS_NOREORDER + | EF_MIPS_PIC | EF_MIPS_CPIC); +@@ -272,27 +273,27 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + else + { + grub_uint32_t target_addr_mods; +- phdr->p_filesz = grub_host_to_target32 (kernel_size); +- phdr->p_memsz = grub_host_to_target32 (kernel_size + bss_size); ++ phdr->p_filesz = grub_host_to_target32 (layout->kernel_size); ++ phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size); + + phdr++; + phdr->p_type = grub_host_to_target32 (PT_GNU_STACK); +- phdr->p_offset = grub_host_to_target32 (header_size + kernel_size); ++ phdr->p_offset = grub_host_to_target32 (header_size + layout->kernel_size); + phdr->p_paddr = phdr->p_vaddr = phdr->p_filesz = phdr->p_memsz = 0; + phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X); + phdr->p_align = grub_host_to_target32 (image_target->link_align); + + phdr++; + phdr->p_type = grub_host_to_target32 (PT_LOAD); +- phdr->p_offset = grub_host_to_target32 (header_size + kernel_size); ++ phdr->p_offset = grub_host_to_target32 (header_size + layout->kernel_size); + phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X); + phdr->p_filesz = phdr->p_memsz +- = grub_host_to_target32 (*core_size - kernel_size); ++ = grub_host_to_target32 (*core_size - layout->kernel_size); + + if (image_target->id == IMAGE_COREBOOT) + target_addr_mods = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; + else +- target_addr_mods = ALIGN_UP (target_addr + kernel_size + bss_size ++ target_addr_mods = ALIGN_UP (target_addr + layout->kernel_size + layout->bss_size + + image_target->mod_gap, + image_target->mod_align); + phdr->p_vaddr = grub_host_to_target_addr (target_addr_mods); +@@ -434,7 +435,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + shdr->sh_size = grub_host_to_target32 (string_size); + shdr->sh_link = grub_host_to_target32 (0); + shdr->sh_info = grub_host_to_target32 (0); +- shdr->sh_addralign = grub_host_to_target32 (align); ++ shdr->sh_addralign = grub_host_to_target32 (layout->align); + shdr->sh_entsize = grub_host_to_target32 (0); + shdr++; + +@@ -445,10 +446,10 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); + shdr->sh_addr = grub_host_to_target_addr (target_addr); + shdr->sh_offset = grub_host_to_target_addr (header_size); +- shdr->sh_size = grub_host_to_target32 (kernel_size); ++ shdr->sh_size = grub_host_to_target32 (layout->kernel_size); + shdr->sh_link = grub_host_to_target32 (0); + shdr->sh_info = grub_host_to_target32 (0); +- shdr->sh_addralign = grub_host_to_target32 (align); ++ shdr->sh_addralign = grub_host_to_target32 (layout->align); + shdr->sh_entsize = grub_host_to_target32 (0); + shdr++; + +@@ -456,9 +457,9 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + shdr->sh_name = grub_host_to_target32 (ptr - str_start); + ptr += sizeof ("mods"); + shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); +- shdr->sh_addr = grub_host_to_target_addr (target_addr + kernel_size); +- shdr->sh_offset = grub_host_to_target_addr (header_size + kernel_size); +- shdr->sh_size = grub_host_to_target32 (*core_size - kernel_size); ++ shdr->sh_addr = grub_host_to_target_addr (target_addr + layout->kernel_size); ++ shdr->sh_offset = grub_host_to_target_addr (header_size + layout->kernel_size); ++ shdr->sh_size = grub_host_to_target32 (*core_size - layout->kernel_size); + shdr->sh_link = grub_host_to_target32 (0); + shdr->sh_info = grub_host_to_target32 (0); + shdr->sh_addralign = grub_host_to_target32 (image_target->voidp_sizeof); +@@ -471,7 +472,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + shdr->sh_name = grub_host_to_target32 (ptr - str_start); + ptr += sizeof (".xen"); + shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); +- shdr->sh_addr = grub_host_to_target_addr (target_addr + kernel_size); ++ shdr->sh_addr = grub_host_to_target_addr (target_addr + layout->kernel_size); + shdr->sh_offset = grub_host_to_target_addr (program_size + header_size); + shdr->sh_size = grub_host_to_target32 (XEN_NOTE_SIZE); + shdr->sh_link = grub_host_to_target32 (0); +diff --git a/util/mkimage.c b/util/mkimage.c +index 9ad4cfe42..528166c87 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -1638,10 +1638,10 @@ grub_install_generate_image (const char *dir, const char *prefix, + target_addr = image_target->link_addr; + if (image_target->voidp_sizeof == 4) + grub_mkimage_generate_elf32 (image_target, note, &core_img, &core_size, +- target_addr, layout.align, layout.kernel_size, layout.bss_size); ++ target_addr, &layout); + else + grub_mkimage_generate_elf64 (image_target, note, &core_img, &core_size, +- target_addr, layout.align, layout.kernel_size, layout.bss_size); ++ target_addr, &layout); + } + break; + } +-- +2.13.0 + diff --git a/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch b/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch new file mode 100644 index 00000000..d8af8b54 --- /dev/null +++ b/0015-Refactor-arm-uboot-code-to-make-it-genereic.patch @@ -0,0 +1,404 @@ +From d08c9685149e7788001ac9a209baa1d84c3628e0 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 17:47:57 +0200 +Subject: [PATCH 015/176] Refactor arm-uboot code to make it genereic. + +arm-coreboot startup code can be very similar to arm-uboot but current code has +U-Boot specific references. So split U-Boot part from generic part. +--- + grub-core/Makefile.core.def | 4 +- + grub-core/kern/arm/{uboot => }/startup.S | 64 ++++------------------------ + grub-core/kern/arm/uboot/init.c | 70 ++++++++++++++++++++++++++++++ + grub-core/kern/arm/uboot/uboot.S | 73 ++++++++++++++++++++++++++++++++ + grub-core/kern/uboot/init.c | 16 ------- + grub-core/kern/uboot/uboot.c | 35 --------------- + include/grub/arm/startup.h | 16 +++++++ + 7 files changed, 170 insertions(+), 108 deletions(-) + rename grub-core/kern/arm/{uboot => }/startup.S (77%) + create mode 100644 grub-core/kern/arm/uboot/init.c + create mode 100644 grub-core/kern/arm/uboot/uboot.S + create mode 100644 include/grub/arm/startup.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 8dcd0e5a9..fb59a7b1d 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -105,7 +105,7 @@ kernel = { + mips_startup = kern/mips/startup.S; + sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S; + powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S; +- arm_uboot_startup = kern/arm/uboot/startup.S; ++ arm_uboot_startup = kern/arm/startup.S; + arm_efi_startup = kern/arm/efi/startup.S; + arm64_efi_startup = kern/arm64/efi/startup.S; + +@@ -149,6 +149,8 @@ kernel = { + uboot = kern/uboot/init.c; + uboot = kern/uboot/hw.c; + uboot = term/uboot/console.c; ++ arm_uboot = kern/arm/uboot/init.c; ++ arm_uboot = kern/arm/uboot/uboot.S; + + terminfoinkernel = term/terminfo.c; + terminfoinkernel = term/tparm.c; +diff --git a/grub-core/kern/arm/uboot/startup.S b/grub-core/kern/arm/startup.S +similarity index 77% +rename from grub-core/kern/arm/uboot/startup.S +rename to grub-core/kern/arm/startup.S +index 5efaae16e..640837cba 100644 +--- a/grub-core/kern/arm/uboot/startup.S ++++ b/grub-core/kern/arm/startup.S +@@ -86,7 +86,7 @@ FUNCTION(codestart) + @ Stack pointer used as start address for signature probing + mov r12, sp + adr sp, entry_state +- push {r1-r12,lr} @ store U-Boot context (sp in r12) ++ push {r0-r12,lr} @ store U-Boot context (sp in r12) + + adr r1, _start + ldr r0, bss_start_ptr @ src +@@ -153,69 +153,21 @@ reloc_done: + + b EXT_C(grub_main) + +- /* +- * uboot_syscall(): +- * This function is effectively a veneer, so it cannot +- * modify the stack or corrupt any registers other than +- * r12 (ip). Furthermore it needs to restore r8 for +- * U-Boot (Global Data Pointer) and preserve it for Grub. +- */ +-FUNCTION(grub_uboot_syscall) +- str r8, transition_space +- str lr, transition_space + 4 +- str r9, transition_space + 8 +- +- ldr r8, gd_backup +- ldr r9, gd_backup + 4 +- +- bl do_syscall +- +- ldr r8, transition_space +- ldr lr, transition_space + 4 +- ldr r9, transition_space + 8 +- +- bx lr +-do_syscall: +- +- ldr ip, grub_uboot_syscall_ptr +- bx ip +- +-FUNCTION(grub_uboot_return) +- adr sp, entry_state_end +- pop {r4-r12, lr} +- mov sp, r12 +- bx lr +- +- + .align 3 +-@ U-boot context stack space +-entry_state_end: +-VARIABLE(grub_uboot_machine_type) ++@ U-boot/coreboot context stack space ++VARIABLE(grub_arm_saved_registers) ++ .long 0 @ r0 + .long 0 @ r1 +-VARIABLE(grub_uboot_boot_data) + .long 0 @ r2 + .long 0 @ r3 + .long 0 @ r4 + .long 0 @ r5 + .long 0 @ r6 + .long 0 @ r7 +-gd_backup: +- .long 0 @ r8 - U-Boot global data pointer up to 2013-09-21 +- .long 0 @ r9 - U-Boot global data pointer 2013-09-21 onwards ++ .long 0 @ r8 ++ .long 0 @ r9 + .long 0 @ r10 + .long 0 @ r11 +-VARIABLE(grub_uboot_search_hint)@ U-Boot stack pointer - +- .long 0 @ also API signature address hint. +- .long 0 @ lr +-entry_state: @ backup for U-Boot context +- +-@ GRUB context stack space +-transition_space: +- .long 0 @ r8 ++ .long 0 @ sp + .long 0 @ lr +- .long 0 @ r9 +- +-VARIABLE(grub_uboot_syscall_ptr) +- .long 0 @ +- +- END ++entry_state: +diff --git a/grub-core/kern/arm/uboot/init.c b/grub-core/kern/arm/uboot/init.c +new file mode 100644 +index 000000000..2a6aa3fdd +--- /dev/null ++++ b/grub-core/kern/arm/uboot/init.c +@@ -0,0 +1,70 @@ ++/* init.c - generic U-Boot initialization and finalization */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#include ++#include ++#include ++ ++extern int (*grub_uboot_syscall_ptr) (int, int *, ...); ++ ++grub_uint32_t ++grub_uboot_get_machine_type (void) ++{ ++ return grub_arm_saved_registers.r[1]; ++} ++ ++grub_addr_t ++grub_uboot_get_boot_data (void) ++{ ++ return grub_arm_saved_registers.r[2]; ++} ++ ++int ++grub_uboot_api_init (void) ++{ ++ struct api_signature *start, *end; ++ struct api_signature *p; ++ grub_addr_t grub_uboot_search_hint = grub_arm_saved_registers.sp; ++ if (grub_uboot_search_hint) ++ { ++ /* Extended search range to work around Trim Slice U-Boot issue */ ++ start = (struct api_signature *) ((grub_uboot_search_hint & ~0x000fffff) ++ - 0x00500000); ++ end = ++ (struct api_signature *) ((grub_addr_t) start + UBOOT_API_SEARCH_LEN - ++ API_SIG_MAGLEN + 0x00500000); ++ } ++ else ++ { ++ start = 0; ++ end = (struct api_signature *) (256 * 1024 * 1024); ++ } ++ ++ /* Structure alignment is (at least) 8 bytes */ ++ for (p = start; p < end; p = (void *) ((grub_addr_t) p + 8)) ++ { ++ if (grub_memcmp (&(p->magic), API_SIG_MAGIC, API_SIG_MAGLEN) == 0) ++ { ++ grub_uboot_syscall_ptr = p->syscall; ++ return p->version; ++ } ++ } ++ ++ return 0; ++} +diff --git a/grub-core/kern/arm/uboot/uboot.S b/grub-core/kern/arm/uboot/uboot.S +new file mode 100644 +index 000000000..d128775f1 +--- /dev/null ++++ b/grub-core/kern/arm/uboot/uboot.S +@@ -0,0 +1,73 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 . ++ */ ++ ++#include ++#include ++#include ++ ++ /* ++ * uboot_syscall(): ++ * This function is effectively a veneer, so it cannot ++ * modify the stack or corrupt any registers other than ++ * r12 (ip). Furthermore it needs to restore r8 for ++ * U-Boot (Global Data Pointer) and preserve it for Grub. ++ */ ++FUNCTION(grub_uboot_syscall) ++ str r8, transition_space ++ str lr, transition_space + 4 ++ str r9, transition_space + 8 ++ ++ ldr ip, saved_registers_ptr ++ ldr r8, [ip, #4 * 8] ++ ldr r9, [ip, #4 * 9] ++ ++ bl do_syscall ++ ++ ldr r8, transition_space ++ ldr lr, transition_space + 4 ++ ldr r9, transition_space + 8 ++ ++ bx lr ++do_syscall: ++ ++ ldr ip, grub_uboot_syscall_ptr ++ bx ip ++ ++FUNCTION(grub_uboot_return) ++ ldr ip, saved_registers_ptr ++ ldr sp, [ip, #4 * 4] ++ pop {r4-r12, lr} ++ mov sp, r12 ++ bx lr ++ ++ ++ .align 3 ++ ++@ GRUB context stack space ++transition_space: ++ .long 0 @ r8 ++ .long 0 @ lr ++ .long 0 @ r9 ++ ++saved_registers_ptr: ++ .long EXT_C(grub_arm_saved_registers) ++ ++VARIABLE(grub_uboot_syscall_ptr) ++ .long 0 @ ++ ++ END +diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c +index 5dcc106ed..3e338645c 100644 +--- a/grub-core/kern/uboot/init.c ++++ b/grub-core/kern/uboot/init.c +@@ -36,30 +36,14 @@ + extern char __bss_start[]; + extern char _end[]; + extern grub_size_t grub_total_module_size; +-extern int (*grub_uboot_syscall_ptr) (int, int *, ...); + static unsigned long timer_start; + +-extern grub_uint32_t grub_uboot_machine_type; +-extern grub_addr_t grub_uboot_boot_data; +- + void + grub_exit (void) + { + grub_uboot_return (0); + } + +-grub_uint32_t +-grub_uboot_get_machine_type (void) +-{ +- return grub_uboot_machine_type; +-} +- +-grub_addr_t +-grub_uboot_get_boot_data (void) +-{ +- return grub_uboot_boot_data; +-} +- + static grub_uint64_t + uboot_timer_ms (void) + { +diff --git a/grub-core/kern/uboot/uboot.c b/grub-core/kern/uboot/uboot.c +index 6800a4beb..cf0168e62 100644 +--- a/grub-core/kern/uboot/uboot.c ++++ b/grub-core/kern/uboot/uboot.c +@@ -39,48 +39,13 @@ + * returns: 0 if the call not found, 1 if serviced + */ + +-extern int (*grub_uboot_syscall_ptr) (int, int *, ...); + extern int grub_uboot_syscall (int, int *, ...); +-extern grub_addr_t grub_uboot_search_hint; + + static struct sys_info uboot_sys_info; + static struct mem_region uboot_mem_info[5]; + static struct device_info * devices; + static int num_devices; + +-int +-grub_uboot_api_init (void) +-{ +- struct api_signature *start, *end; +- struct api_signature *p; +- +- if (grub_uboot_search_hint) +- { +- /* Extended search range to work around Trim Slice U-Boot issue */ +- start = (struct api_signature *) ((grub_uboot_search_hint & ~0x000fffff) +- - 0x00500000); +- end = +- (struct api_signature *) ((grub_addr_t) start + UBOOT_API_SEARCH_LEN - +- API_SIG_MAGLEN + 0x00500000); +- } +- else +- { +- start = 0; +- end = (struct api_signature *) (256 * 1024 * 1024); +- } +- +- /* Structure alignment is (at least) 8 bytes */ +- for (p = start; p < end; p = (void *) ((grub_addr_t) p + 8)) +- { +- if (grub_memcmp (&(p->magic), API_SIG_MAGIC, API_SIG_MAGLEN) == 0) +- { +- grub_uboot_syscall_ptr = p->syscall; +- return p->version; +- } +- } +- +- return 0; +-} + + /* + * All functions below are wrappers around the grub_uboot_syscall() function +diff --git a/include/grub/arm/startup.h b/include/grub/arm/startup.h +new file mode 100644 +index 000000000..9afb6c57c +--- /dev/null ++++ b/include/grub/arm/startup.h +@@ -0,0 +1,16 @@ ++#ifndef GRUB_STARTUP_CPU_HEADER ++#define GRUB_STARTUP_CPU_HEADER ++ ++struct grub_arm_startup_registers ++{ ++ /* registers 0-11 */ ++ /* for U-boot r[1] is machine type */ ++ /* for U-boot r[2] is boot data */ ++ grub_uint32_t r[12]; ++ grub_uint32_t sp; ++ grub_uint32_t lr; ++}; ++ ++extern struct grub_arm_startup_registers grub_arm_saved_registers; ++ ++#endif +-- +2.13.0 + diff --git a/0016-coreboot-Split-parts-that-are-platform-independent.patch b/0016-coreboot-Split-parts-that-are-platform-independent.patch new file mode 100644 index 00000000..ce8d1511 --- /dev/null +++ b/0016-coreboot-Split-parts-that-are-platform-independent.patch @@ -0,0 +1,344 @@ +From 461bfab7b7e47fd0a76bf6076a438af1b7e2184a Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 19:06:22 +0200 +Subject: [PATCH 016/176] coreboot: Split parts that are platform-independent. + +We currently assume that coreboot is always i386, it's no longer the case, +so split i386-coreboot parts from generic coreboot code. +--- + grub-core/Makefile.am | 2 +- + grub-core/Makefile.core.def | 6 +- + grub-core/commands/i386/coreboot/cb_timestamps.c | 2 +- + grub-core/commands/i386/coreboot/cbls.c | 2 +- + grub-core/kern/coreboot/cbtable.c | 70 ++++++++++++++++++++++++ + grub-core/kern/{i386 => }/coreboot/mmap.c | 6 +- + grub-core/kern/i386/coreboot/cbtable.c | 53 +++--------------- + grub-core/term/i386/coreboot/cbmemc.c | 2 +- + grub-core/video/{i386 => }/coreboot/cbfb.c | 2 +- + include/grub/{i386 => }/coreboot/lbio.h | 9 +++ + 10 files changed, 99 insertions(+), 55 deletions(-) + create mode 100644 grub-core/kern/coreboot/cbtable.c + rename grub-core/kern/{i386 => }/coreboot/mmap.c (97%) + rename grub-core/video/{i386 => }/coreboot/cbfb.c (99%) + rename include/grub/{i386 => }/coreboot/lbio.h (93%) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 809a8aa26..781d0ffbf 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -112,7 +112,7 @@ endif + + if COND_i386_coreboot + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h +-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/coreboot/lbio.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index fb59a7b1d..45ed0fa6b 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -166,7 +166,7 @@ kernel = { + i386_multiboot = kern/i386/coreboot/init.c; + i386_qemu = kern/i386/qemu/init.c; + i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; +- i386_coreboot = video/i386/coreboot/cbfb.c; ++ i386_coreboot = video/coreboot/cbfb.c; + + efi = disk/efi/efidisk.c; + efi = kern/efi/efi.c; +@@ -227,8 +227,9 @@ kernel = { + i386_qemu = kern/vga_init.c; + i386_qemu = kern/i386/qemu/mmap.c; + +- i386_coreboot = kern/i386/coreboot/mmap.c; ++ i386_coreboot = kern/coreboot/mmap.c; + i386_coreboot = kern/i386/coreboot/cbtable.c; ++ i386_coreboot = kern/coreboot/cbtable.c; + + i386_multiboot = kern/i386/multiboot_mmap.c; + +@@ -643,6 +644,7 @@ module = { + module = { + name = cbtable; + common = kern/i386/coreboot/cbtable.c; ++ common = kern/coreboot/cbtable.c; + enable = i386_pc; + enable = i386_efi; + enable = i386_qemu; +diff --git a/grub-core/commands/i386/coreboot/cb_timestamps.c b/grub-core/commands/i386/coreboot/cb_timestamps.c +index e72f38d6e..e97ea6bed 100644 +--- a/grub-core/commands/i386/coreboot/cb_timestamps.c ++++ b/grub-core/commands/i386/coreboot/cb_timestamps.c +@@ -20,7 +20,7 @@ + #include + #include + #include +-#include ++#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +diff --git a/grub-core/commands/i386/coreboot/cbls.c b/grub-core/commands/i386/coreboot/cbls.c +index e0a10596f..102291f42 100644 +--- a/grub-core/commands/i386/coreboot/cbls.c ++++ b/grub-core/commands/i386/coreboot/cbls.c +@@ -20,7 +20,7 @@ + #include + #include + #include +-#include ++#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +diff --git a/grub-core/kern/coreboot/cbtable.c b/grub-core/kern/coreboot/cbtable.c +new file mode 100644 +index 000000000..996d3f407 +--- /dev/null ++++ b/grub-core/kern/coreboot/cbtable.c +@@ -0,0 +1,70 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2007,2008,2013 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Helper for grub_linuxbios_table_iterate. */ ++int ++grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header) ++{ ++ if (! grub_memcmp (tbl_header->signature, "LBIO", 4)) ++ return 1; ++ ++ return 0; ++} ++ ++grub_err_t ++grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, ++ void *), ++ void *hook_data) ++{ ++ grub_linuxbios_table_header_t table_header = grub_linuxbios_get_tables (); ++ grub_linuxbios_table_item_t table_item; ++ ++ if (!table_header) ++ return 0; ++ ++signature_found: ++ ++ table_item = ++ (grub_linuxbios_table_item_t) ((char *) table_header + ++ table_header->header_size); ++ for (; table_item < (grub_linuxbios_table_item_t) ((char *) table_header ++ + table_header->header_size ++ + table_header->table_size); ++ table_item = (grub_linuxbios_table_item_t) ((char *) table_item + table_item->size)) ++ { ++ if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK ++ && grub_linuxbios_check_signature ((grub_linuxbios_table_header_t) (grub_addr_t) ++ *(grub_uint64_t *) (table_item + 1))) ++ { ++ table_header = (grub_linuxbios_table_header_t) (grub_addr_t) ++ *(grub_uint64_t *) (table_item + 1); ++ goto signature_found; ++ } ++ if (hook (table_item, hook_data)) ++ return 1; ++ } ++ ++ return 0; ++} +diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/coreboot/mmap.c +similarity index 97% +rename from grub-core/kern/i386/coreboot/mmap.c +rename to grub-core/kern/coreboot/mmap.c +index 4d29f6b7d..caf8f7cef 100644 +--- a/grub-core/kern/i386/coreboot/mmap.c ++++ b/grub-core/kern/coreboot/mmap.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include +-#include ++#include ++#include + #include + #include + #include +@@ -49,6 +49,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + { + grub_uint64_t start = mem_region->addr; + grub_uint64_t end = mem_region->addr + mem_region->size; ++#ifdef __i386__ + /* Mark region 0xa0000 - 0x100000 as reserved. */ + if (start < 0x100000 && end >= 0xa0000 + && mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE) +@@ -75,6 +76,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + if (end <= start) + continue; + } ++#endif + if (ctx->hook (start, end - start, + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type +diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c +index 1669bc0ca..34a2b59be 100644 +--- a/grub-core/kern/i386/coreboot/cbtable.c ++++ b/grub-core/kern/i386/coreboot/cbtable.c +@@ -17,7 +17,7 @@ + */ + + #include +-#include ++#include + #include + #include + #include +@@ -25,59 +25,20 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-/* Helper for grub_linuxbios_table_iterate. */ +-static int +-check_signature (grub_linuxbios_table_header_t tbl_header) +-{ +- if (! grub_memcmp (tbl_header->signature, "LBIO", 4)) +- return 1; +- +- return 0; +-} +- +-grub_err_t +-grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, +- void *), +- void *hook_data) ++grub_linuxbios_table_header_t ++grub_linuxbios_get_tables (void) + { + grub_linuxbios_table_header_t table_header; +- grub_linuxbios_table_item_t table_item; +- + /* Assuming table_header is aligned to its size (8 bytes). */ +- + for (table_header = (grub_linuxbios_table_header_t) 0x500; + table_header < (grub_linuxbios_table_header_t) 0x1000; table_header++) +- if (check_signature (table_header)) +- goto signature_found; ++ if (grub_linuxbios_check_signature (table_header)) ++ return table_header; + + for (table_header = (grub_linuxbios_table_header_t) 0xf0000; + table_header < (grub_linuxbios_table_header_t) 0x100000; table_header++) +- if (check_signature (table_header)) +- goto signature_found; +- +- return 0; +- +-signature_found: +- +- table_item = +- (grub_linuxbios_table_item_t) ((char *) table_header + +- table_header->header_size); +- for (; table_item < (grub_linuxbios_table_item_t) ((char *) table_header +- + table_header->header_size +- + table_header->table_size); +- table_item = (grub_linuxbios_table_item_t) ((char *) table_item + table_item->size)) +- { +- if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK +- && check_signature ((grub_linuxbios_table_header_t) (grub_addr_t) +- *(grub_uint64_t *) (table_item + 1))) +- { +- table_header = (grub_linuxbios_table_header_t) (grub_addr_t) +- *(grub_uint64_t *) (table_item + 1); +- goto signature_found; +- } +- if (hook (table_item, hook_data)) +- return 1; +- } ++ if (grub_linuxbios_check_signature (table_header)) ++ return table_header; + + return 0; + } +diff --git a/grub-core/term/i386/coreboot/cbmemc.c b/grub-core/term/i386/coreboot/cbmemc.c +index 25e64a05c..129248c7f 100644 +--- a/grub-core/term/i386/coreboot/cbmemc.c ++++ b/grub-core/term/i386/coreboot/cbmemc.c +@@ -23,7 +23,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + +diff --git a/grub-core/video/i386/coreboot/cbfb.c b/grub-core/video/coreboot/cbfb.c +similarity index 99% +rename from grub-core/video/i386/coreboot/cbfb.c +rename to grub-core/video/coreboot/cbfb.c +index dede0c37e..9af81fa5b 100644 +--- a/grub-core/video/i386/coreboot/cbfb.c ++++ b/grub-core/video/coreboot/cbfb.c +@@ -25,7 +25,7 @@ + #include + #include + #include +-#include ++#include + #include + + struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable; +diff --git a/include/grub/i386/coreboot/lbio.h b/include/grub/coreboot/lbio.h +similarity index 93% +rename from include/grub/i386/coreboot/lbio.h +rename to include/grub/coreboot/lbio.h +index 1c3fa6f19..5076d36c7 100644 +--- a/include/grub/i386/coreboot/lbio.h ++++ b/include/grub/coreboot/lbio.h +@@ -20,6 +20,9 @@ + #ifndef _GRUB_MACHINE_LBIO_HEADER + #define _GRUB_MACHINE_LBIO_HEADER 1 + ++#include ++#include ++ + struct grub_linuxbios_table_header + { + grub_uint8_t signature[4]; +@@ -102,4 +105,10 @@ EXPORT_FUNC(grub_linuxbios_table_iterate) (int (*hook) (grub_linuxbios_table_ite + void *), + void *hook_data); + ++grub_linuxbios_table_header_t ++grub_linuxbios_get_tables (void); ++ ++int ++grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header); ++ + #endif +-- +2.13.0 + diff --git a/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch b/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch new file mode 100644 index 00000000..e08d4186 --- /dev/null +++ b/0017-Rename-uboot-halt.c-to-dummy-halt.c.patch @@ -0,0 +1,32 @@ +From 1daa716c7017f1858de117a20a31da66815435c5 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 19:31:55 +0200 +Subject: [PATCH 017/176] Rename uboot/halt.c to dummy/halt.c. + +It's not U-Boot specific and it's a stub. +--- + grub-core/Makefile.core.def | 2 +- + grub-core/lib/{uboot => dummy}/halt.c | 0 + 2 files changed, 1 insertion(+), 1 deletion(-) + rename grub-core/lib/{uboot => dummy}/halt.c (100%) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 45ed0fa6b..2a38bd4bc 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -841,7 +841,7 @@ module = { + efi = lib/efi/halt.c; + ieee1275 = lib/ieee1275/halt.c; + emu = lib/emu/halt.c; +- uboot = lib/uboot/halt.c; ++ uboot = lib/dummy/halt.c; + }; + + module = { +diff --git a/grub-core/lib/uboot/halt.c b/grub-core/lib/dummy/halt.c +similarity index 100% +rename from grub-core/lib/uboot/halt.c +rename to grub-core/lib/dummy/halt.c +-- +2.13.0 + diff --git a/0018-Rename-uboot-datetime-to-dummy-datetime.patch b/0018-Rename-uboot-datetime-to-dummy-datetime.patch new file mode 100644 index 00000000..2f2f43ec --- /dev/null +++ b/0018-Rename-uboot-datetime-to-dummy-datetime.patch @@ -0,0 +1,58 @@ +From 9808c3ef956c6472a96790b60cf74f4eaa742010 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 19:37:29 +0200 +Subject: [PATCH 018/176] Rename uboot/datetime to dummy/datetime. + +It's just a stub and is not UBoot-specific. +--- + grub-core/Makefile.core.def | 2 +- + grub-core/lib/{uboot => dummy}/datetime.c | 5 ++--- + 2 files changed, 3 insertions(+), 4 deletions(-) + rename grub-core/lib/{uboot => dummy}/datetime.c (91%) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 2a38bd4bc..6540dc951 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1552,7 +1552,7 @@ module = { + name = datetime; + cmos = lib/cmos_datetime.c; + efi = lib/efi/datetime.c; +- uboot = lib/uboot/datetime.c; ++ uboot = lib/dummy/datetime.c; + sparc64_ieee1275 = lib/ieee1275/datetime.c; + powerpc_ieee1275 = lib/ieee1275/datetime.c; + sparc64_ieee1275 = lib/ieee1275/cmos.c; +diff --git a/grub-core/lib/uboot/datetime.c b/grub-core/lib/dummy/datetime.c +similarity index 91% +rename from grub-core/lib/uboot/datetime.c +rename to grub-core/lib/dummy/datetime.c +index 4be716928..cf693fc6b 100644 +--- a/grub-core/lib/uboot/datetime.c ++++ b/grub-core/lib/dummy/datetime.c +@@ -18,7 +18,6 @@ + + #include + #include +-#include + #include + #include + +@@ -30,12 +29,12 @@ grub_err_t + grub_get_datetime (struct grub_datetime *datetime __attribute__ ((unused))) + { + return grub_error (GRUB_ERR_INVALID_COMMAND, +- "can\'t get datetime using U-Boot"); ++ "can\'t get datetime on this machine"); + } + + grub_err_t + grub_set_datetime (struct grub_datetime * datetime __attribute__ ((unused))) + { + return grub_error (GRUB_ERR_INVALID_COMMAND, +- "can\'t set datetime using U-Boot"); ++ "can\'t set datetime on this machine"); + } +-- +2.13.0 + diff --git a/0019-arm-coreboot-Start-new-port.patch b/0019-arm-coreboot-Start-new-port.patch new file mode 100644 index 00000000..a9f3e56a --- /dev/null +++ b/0019-arm-coreboot-Start-new-port.patch @@ -0,0 +1,827 @@ +From 24e37a885269bdec9b27babf1da0bba3692d55c0 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 20:53:28 +0200 +Subject: [PATCH 019/176] arm-coreboot: Start new port. + +--- + configure.ac | 2 + + gentpl.py | 8 ++- + grub-core/Makefile.am | 10 +++ + grub-core/Makefile.core.def | 18 ++++- + grub-core/kern/arm/coreboot/cbtable.c | 40 +++++++++++ + grub-core/kern/arm/coreboot/coreboot.S | 44 ++++++++++++ + grub-core/kern/arm/coreboot/init.c | 127 +++++++++++++++++++++++++++++++++ + grub-core/kern/arm/coreboot/timer.c | 65 +++++++++++++++++ + grub-core/kern/arm/startup.S | 4 ++ + grub-core/kern/coreboot/cbtable.c | 2 + + grub-core/lib/dummy/reboot.c | 32 +++++++++ + grub-core/loader/arm/linux.c | 3 + + include/grub/arm/coreboot/console.h | 29 ++++++++ + include/grub/arm/coreboot/kernel.h | 44 ++++++++++++ + include/grub/offsets.h | 6 ++ + util/grub-mkimagexx.c | 19 +++-- + util/mkimage.c | 41 ++++++++++- + 17 files changed, 482 insertions(+), 12 deletions(-) + create mode 100644 grub-core/kern/arm/coreboot/cbtable.c + create mode 100644 grub-core/kern/arm/coreboot/coreboot.S + create mode 100644 grub-core/kern/arm/coreboot/init.c + create mode 100644 grub-core/kern/arm/coreboot/timer.c + create mode 100644 grub-core/lib/dummy/reboot.c + create mode 100644 include/grub/arm/coreboot/console.h + create mode 100644 include/grub/arm/coreboot/kernel.h + +diff --git a/configure.ac b/configure.ac +index ee2c86537..571f7a0b5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -167,6 +167,7 @@ case "$target_cpu"-"$platform" in + mipsel-fuloong) platform=loongson ;; + mipsel-loongson) ;; + arm-uboot) ;; ++ arm-coreboot) ;; + arm-efi) ;; + arm64-efi) ;; + *-emu) ;; +@@ -1918,6 +1919,7 @@ AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel]) + AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips]) + AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ]) + AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot]) ++AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xcoreboot]) + AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) + AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) + AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) +diff --git a/gentpl.py b/gentpl.py +index f08bcc404..ed268178b 100644 +--- a/gentpl.py ++++ b/gentpl.py +@@ -31,7 +31,8 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", + "i386_xen", "x86_64_xen", + "mips_loongson", "sparc64_ieee1275", + "powerpc_ieee1275", "mips_arc", "ia64_efi", +- "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi" ] ++ "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi", ++ "arm_coreboot"] + + GROUPS = {} + +@@ -44,7 +45,7 @@ GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] + GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ] + GROUPS["sparc64"] = [ "sparc64_ieee1275" ] + GROUPS["powerpc"] = [ "powerpc_ieee1275" ] +-GROUPS["arm"] = [ "arm_uboot", "arm_efi" ] ++GROUPS["arm"] = [ "arm_uboot", "arm_efi", "arm_coreboot" ] + GROUPS["arm64"] = [ "arm64_efi" ] + + # Groups based on firmware +@@ -52,6 +53,7 @@ GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi" + GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] + GROUPS["uboot"] = [ "arm_uboot" ] + GROUPS["xen"] = [ "i386_xen", "x86_64_xen" ] ++GROUPS["coreboot"] = [ "i386_coreboot", "arm_coreboot" ] + + # emu is a special case so many core functionality isn't needed on this platform + GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu") +@@ -64,7 +66,7 @@ GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"] + GROUPS["usb"] = GROUPS["pci"] + + # If gfxterm is main output console integrate it into kernel +-GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot" ] ++GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot", "arm_coreboot" ] + GROUPS["videomodules"] = GRUB_PLATFORMS[:]; + for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 781d0ffbf..bec058554 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -239,6 +239,16 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h + endif + ++if COND_arm_coreboot ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h ++endif ++ + if COND_arm_efi + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6540dc951..411dca46b 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -92,6 +92,8 @@ kernel = { + emu_cppflags = '$(CPPFLAGS_GNULIB)'; + arm_uboot_ldflags = '-Wl,-r,-d'; + arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; ++ arm_coreboot_ldflags = '-Wl,-r,-d'; ++ arm_coreboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; + + i386_pc_startup = kern/i386/pc/startup.S; + i386_efi_startup = kern/i386/efi/startup.S; +@@ -106,6 +108,7 @@ kernel = { + sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S; + powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S; + arm_uboot_startup = kern/arm/startup.S; ++ arm_coreboot_startup = kern/arm/startup.S; + arm_efi_startup = kern/arm/efi/startup.S; + arm64_efi_startup = kern/arm64/efi/startup.S; + +@@ -152,6 +155,10 @@ kernel = { + arm_uboot = kern/arm/uboot/init.c; + arm_uboot = kern/arm/uboot/uboot.S; + ++ arm_coreboot = kern/arm/coreboot/init.c; ++ arm_coreboot = kern/arm/coreboot/timer.c; ++ arm_coreboot = kern/arm/coreboot/coreboot.S; ++ + terminfoinkernel = term/terminfo.c; + terminfoinkernel = term/tparm.c; + terminfoinkernel = commands/extcmd.c; +@@ -166,7 +173,7 @@ kernel = { + i386_multiboot = kern/i386/coreboot/init.c; + i386_qemu = kern/i386/qemu/init.c; + i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; +- i386_coreboot = video/coreboot/cbfb.c; ++ coreboot = video/coreboot/cbfb.c; + + efi = disk/efi/efidisk.c; + efi = kern/efi/efi.c; +@@ -227,9 +234,10 @@ kernel = { + i386_qemu = kern/vga_init.c; + i386_qemu = kern/i386/qemu/mmap.c; + +- i386_coreboot = kern/coreboot/mmap.c; ++ coreboot = kern/coreboot/mmap.c; + i386_coreboot = kern/i386/coreboot/cbtable.c; +- i386_coreboot = kern/coreboot/cbtable.c; ++ coreboot = kern/coreboot/cbtable.c; ++ arm_coreboot = kern/arm/coreboot/cbtable.c; + + i386_multiboot = kern/i386/multiboot_mmap.c; + +@@ -758,6 +766,7 @@ module = { + enable = arm_efi; + enable = arm64_efi; + enable = arm_uboot; ++ enable = arm_coreboot; + }; + + module = { +@@ -842,6 +851,7 @@ module = { + ieee1275 = lib/ieee1275/halt.c; + emu = lib/emu/halt.c; + uboot = lib/dummy/halt.c; ++ arm_coreboot = lib/dummy/halt.c; + }; + + module = { +@@ -859,6 +869,7 @@ module = { + mips_qemu_mips = lib/mips/qemu_mips/reboot.c; + xen = lib/xen/reboot.c; + uboot = lib/uboot/reboot.c; ++ arm_coreboot = lib/dummy/reboot.c; + common = commands/reboot.c; + }; + +@@ -1553,6 +1564,7 @@ module = { + cmos = lib/cmos_datetime.c; + efi = lib/efi/datetime.c; + uboot = lib/dummy/datetime.c; ++ arm_coreboot = lib/dummy/datetime.c; + sparc64_ieee1275 = lib/ieee1275/datetime.c; + powerpc_ieee1275 = lib/ieee1275/datetime.c; + sparc64_ieee1275 = lib/ieee1275/cmos.c; +diff --git a/grub-core/kern/arm/coreboot/cbtable.c b/grub-core/kern/arm/coreboot/cbtable.c +new file mode 100644 +index 000000000..8a655bb5c +--- /dev/null ++++ b/grub-core/kern/arm/coreboot/cbtable.c +@@ -0,0 +1,40 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2007,2008,2013 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++#pragma GCC diagnostic ignored "-Wcast-align" ++ ++grub_linuxbios_table_header_t ++grub_linuxbios_get_tables (void) ++{ ++ grub_linuxbios_table_header_t table_header ++ = (grub_linuxbios_table_header_t) grub_arm_saved_registers.r[0]; ++ ++ if (!grub_linuxbios_check_signature (table_header)) ++ return 0; ++ ++ return table_header; ++} +diff --git a/grub-core/kern/arm/coreboot/coreboot.S b/grub-core/kern/arm/coreboot/coreboot.S +new file mode 100644 +index 000000000..a1104526c +--- /dev/null ++++ b/grub-core/kern/arm/coreboot/coreboot.S +@@ -0,0 +1,44 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#include ++ ++ .file "coreboot.S" ++ .text ++ .syntax unified ++#if !defined (__thumb2__) ++ .arch armv7a ++ .arm ++#else ++ .arch armv7 ++ .thumb ++#endif ++ ++FUNCTION(grub_arm_pfr1) ++ mrc p15, 0, r0, c0, c1, 1 ++ bx lr ++ ++FUNCTION(grub_armv7_get_timer_value) ++ isb ++ mrrc p15, 1, r0, r1, c14 ++ bx lr ++ ++FUNCTION(grub_armv7_get_timer_frequency) ++ mrc p15, 0, r0, c14, c0, 0 ++ bx lr ++ +diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c +new file mode 100644 +index 000000000..51ecaceb0 +--- /dev/null ++++ b/grub-core/kern/arm/coreboot/init.c +@@ -0,0 +1,127 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2013 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++extern grub_uint8_t _start[]; ++extern grub_uint8_t _end[]; ++extern grub_uint8_t _edata[]; ++grub_addr_t start_of_ram = ~(grub_addr_t)0; ++ ++void __attribute__ ((noreturn)) ++grub_exit (void) ++{ ++ /* We can't use grub_fatal() in this function. This would create an infinite ++ loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ ++ while (1) ++ grub_cpu_idle (); ++} ++ ++static grub_uint64_t modend; ++static int have_memory = 0; ++ ++/* Helper for grub_machine_init. */ ++static int ++heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, ++ void *data __attribute__ ((unused))) ++{ ++ grub_uint64_t begin = addr, end = addr + size; ++ ++#if GRUB_CPU_SIZEOF_VOID_P == 4 ++ /* Restrict ourselves to 32-bit memory space. */ ++ if (begin > GRUB_ULONG_MAX) ++ return 0; ++ if (end > GRUB_ULONG_MAX) ++ end = GRUB_ULONG_MAX; ++#endif ++ ++ if (start_of_ram > begin) ++ start_of_ram = begin; ++ ++ if (type != GRUB_MEMORY_AVAILABLE) ++ return 0; ++ ++ if (modend && begin < modend) ++ { ++ if (begin < (grub_addr_t)_start) ++ { ++ grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) ((grub_addr_t)_start - begin)); ++ have_memory = 1; ++ } ++ begin = modend; ++ } ++ ++ /* Avoid DMA problems. */ ++ if (end >= 0xfe000000) ++ end = 0xfe000000; ++ ++ if (end <= begin) ++ return 0; ++ ++ grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin)); ++ ++ have_memory = 1; ++ ++ return 0; ++} ++ ++void ++grub_machine_init (void) ++{ ++ modend = grub_modules_get_end (); ++ ++ grub_video_coreboot_fb_early_init (); ++ ++ grub_machine_mmap_iterate (heap_init, NULL); ++ if (!have_memory) ++ grub_fatal ("No memory found"); ++ ++ grub_video_coreboot_fb_late_init (); ++ ++ grub_font_init (); ++ grub_gfxterm_init (); ++ ++ grub_machine_timer_init (); ++} ++ ++void ++grub_machine_get_bootlocation (char **device __attribute__ ((unused)), ++ char **path __attribute__ ((unused))) ++{ ++} ++ ++void ++grub_machine_fini (int flags __attribute__ ((unused))) ++{ ++} +diff --git a/grub-core/kern/arm/coreboot/timer.c b/grub-core/kern/arm/coreboot/timer.c +new file mode 100644 +index 000000000..ebefb99d5 +--- /dev/null ++++ b/grub-core/kern/arm/coreboot/timer.c +@@ -0,0 +1,65 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++grub_uint64_t ++grub_armv7_get_timer_value(void); ++ ++grub_uint32_t ++grub_armv7_get_timer_frequency(void); ++ ++grub_uint32_t ++grub_arm_pfr1(void); ++ ++static int have_timer = 0; ++static grub_uint32_t timer_frequency_in_khz; ++ ++static grub_uint64_t ++generic_get_time_ms (void) ++{ ++ return grub_divmod64 (grub_armv7_get_timer_value(), timer_frequency_in_khz, 0); ++} ++ ++static int ++try_generic_timer (void) ++{ ++ if (((grub_arm_pfr1 () >> 16) & 0xf) != 1) ++ return 0; ++ grub_printf ("freq = %x\n", grub_armv7_get_timer_frequency()); ++ timer_frequency_in_khz = 0x016e3600 / 1000; //grub_armv7_get_timer_frequency() / 1000; ++ if (timer_frequency_in_khz == 0) ++ return 0; ++ grub_install_get_time_ms (generic_get_time_ms); ++ have_timer = 1; ++ return 1; ++} ++ ++void ++grub_machine_timer_init (void) ++{ ++ if (!have_timer) ++ try_generic_timer (); ++ if (!have_timer) ++ grub_fatal ("No timer found"); ++} +diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S +index 640837cba..3946fe8e1 100644 +--- a/grub-core/kern/arm/startup.S ++++ b/grub-core/kern/arm/startup.S +@@ -24,6 +24,7 @@ + * GRUB is called from U-Boot as a Linux Kernel type image, which + * means among other things that it always enters in ARM state. + * ++ * coreboot starts in ARM mode as well. + * + * Overview of GRUB image layout: + * +@@ -127,6 +128,8 @@ reloc_done: + + str r1, EXT_C(grub_modbase) + ++ /* Coreboot already places modules at right place. */ ++#ifndef GRUB_MACHINE_COREBOOT + add r1, r1, r2 + add r0, r0, r2 + sub r1, r1, #4 +@@ -136,6 +139,7 @@ reloc_done: + str r3, [r1], #-4 @ *dst-- = r3 + subs r2, #4 @ remaining -= 4 + bne 1b @ while remaining != 0 ++#endif + + @ Since we _are_ the C run-time, we need to manually zero the BSS + @ region before continuing +diff --git a/grub-core/kern/coreboot/cbtable.c b/grub-core/kern/coreboot/cbtable.c +index 996d3f407..aec63dbd1 100644 +--- a/grub-core/kern/coreboot/cbtable.c ++++ b/grub-core/kern/coreboot/cbtable.c +@@ -23,6 +23,8 @@ + #include + #include + ++#pragma GCC diagnostic ignored "-Wcast-align" ++ + /* Helper for grub_linuxbios_table_iterate. */ + int + grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header) +diff --git a/grub-core/lib/dummy/reboot.c b/grub-core/lib/dummy/reboot.c +new file mode 100644 +index 000000000..b8cbed8f8 +--- /dev/null ++++ b/grub-core/lib/dummy/reboot.c +@@ -0,0 +1,32 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++ ++void ++grub_reboot (void) ++{ ++ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); ++ ++ /* Just stop here */ ++ ++ while (1); ++} +diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c +index 5b39f02bb..01374ee78 100644 +--- a/grub-core/loader/arm/linux.c ++++ b/grub-core/loader/arm/linux.c +@@ -31,6 +31,8 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + ++#ifndef GRUB_MACHINE_COREBOOT ++ + static grub_dl_t my_mod; + + static grub_addr_t initrd_start; +@@ -527,3 +529,4 @@ GRUB_MOD_FINI (linux) + grub_unregister_command (cmd_initrd); + grub_unregister_command (cmd_devicetree); + } ++#endif +diff --git a/include/grub/arm/coreboot/console.h b/include/grub/arm/coreboot/console.h +new file mode 100644 +index 000000000..13a14b783 +--- /dev/null ++++ b/include/grub/arm/coreboot/console.h +@@ -0,0 +1,29 @@ ++/* ++ * 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 . ++ */ ++ ++#ifndef GRUB_MACHINE_CONSOLE_HEADER ++#define GRUB_MACHINE_CONSOLE_HEADER 1 ++ ++void grub_video_coreboot_fb_init (void); ++void grub_video_coreboot_fb_early_init (void); ++void grub_video_coreboot_fb_late_init (void); ++void grub_video_coreboot_fb_fini (void); ++ ++extern struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable; ++ ++#endif /* ! GRUB_MACHINE_CONSOLE_HEADER */ +diff --git a/include/grub/arm/coreboot/kernel.h b/include/grub/arm/coreboot/kernel.h +new file mode 100644 +index 000000000..09cd7fe32 +--- /dev/null ++++ b/include/grub/arm/coreboot/kernel.h +@@ -0,0 +1,44 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 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 . ++ */ ++ ++#ifndef GRUB_KERNEL_MACHINE_HEADER ++#define GRUB_KERNEL_MACHINE_HEADER 1 ++ ++#ifndef ASM_FILE ++ ++#include ++#include ++ ++struct grub_fdt_board ++{ ++ const char *vendor, *part; ++ const grub_uint8_t *dtb; ++ grub_size_t dtb_size; ++}; ++ ++extern struct grub_fdt_board grub_fdt_boards[]; ++void grub_machine_timer_init (void); ++void grub_pl050_init (void); ++void ++grub_cros_init (void); ++extern grub_addr_t EXPORT_VAR (start_of_ram); ++#endif /* ! ASM_FILE */ ++ ++#define GRUB_KERNEL_MACHINE_STACK_SIZE GRUB_KERNEL_ARM_STACK_SIZE ++ ++#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ +diff --git a/include/grub/offsets.h b/include/grub/offsets.h +index c88c86d4d..bf0689fc9 100644 +--- a/include/grub/offsets.h ++++ b/include/grub/offsets.h +@@ -122,6 +122,12 @@ + #define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8 + #define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4 + ++#define GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN 0x8 ++#define GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE 0x4 ++ ++#define GRUB_KERNEL_ARM_STACK_SIZE 0x40000 ++#define GRUB_KERNEL_ARM_COREBOOT_MOD_GAP (GRUB_KERNEL_ARM_STACK_SIZE + 1024) ++ + /* Minimal gap between _end and the start of the modules. It's a hack + for PowerMac to prevent "CLAIM failed" error. The real fix is to + rewrite grub-mkimage to generate valid ELF files. */ +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 3fab93e20..a2bb05439 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -87,7 +87,8 @@ struct fixup_block_list + static int + is_relocatable (const struct grub_install_image_target_desc *image_target) + { +- return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT; ++ return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT ++ || (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM); + } + + #ifdef MKIMAGE_ELF32 +@@ -274,7 +275,10 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + { + grub_uint32_t target_addr_mods; + phdr->p_filesz = grub_host_to_target32 (layout->kernel_size); +- phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size); ++ if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM) ++ phdr->p_memsz = grub_host_to_target32 (layout->kernel_size); ++ else ++ phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size); + + phdr++; + phdr->p_type = grub_host_to_target32 (PT_GNU_STACK); +@@ -290,8 +294,12 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + phdr->p_filesz = phdr->p_memsz + = grub_host_to_target32 (*core_size - layout->kernel_size); + +- if (image_target->id == IMAGE_COREBOOT) ++ if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_386) + target_addr_mods = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; ++ else if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM) ++ target_addr_mods = ALIGN_UP (target_addr + layout->end ++ + image_target->mod_gap, ++ image_target->mod_align); + else + target_addr_mods = ALIGN_UP (target_addr + layout->kernel_size + layout->bss_size + + image_target->mod_gap, +@@ -1876,7 +1884,7 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, + Platforms other than EFI and U-boot shouldn't have .bss in + their binaries as we build with -Wl,-Ttext. + */ +- if (image_target->id != IMAGE_UBOOT) ++ if (image_target->id == IMAGE_EFI || !is_relocatable (image_target)) + layout->kernel_size = layout->end; + + return section_addresses; +@@ -1979,6 +1987,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, + if (image_target->id == IMAGE_SPARC64_AOUT + || image_target->id == IMAGE_SPARC64_RAW + || image_target->id == IMAGE_UBOOT ++ || image_target->id == IMAGE_COREBOOT + || image_target->id == IMAGE_SPARC64_CDCORE) + layout->kernel_size = ALIGN_UP (layout->kernel_size, image_target->mod_align); + +@@ -2084,7 +2093,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, + Platforms other than EFI and U-boot shouldn't have .bss in + their binaries as we build with -Wl,-Ttext. + */ +- || (SUFFIX (is_bss_section) (s, image_target) && (image_target->id != IMAGE_UBOOT)) ++ || (SUFFIX (is_bss_section) (s, image_target) && (image_target->id == IMAGE_EFI || !is_relocatable (image_target))) + || SUFFIX (is_text_section) (s, image_target)) + { + if (grub_target_to_host32 (s->sh_type) == SHT_NOBITS) +diff --git a/util/mkimage.c b/util/mkimage.c +index 528166c87..6aa77ed73 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -533,6 +533,45 @@ static const struct grub_install_image_target_desc image_targets[] = + .mod_align = GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN, + .link_align = 4 + }, ++ /* For coreboot versions that don't support self-relocating images. */ ++ { ++ .dirname = "arm-coreboot-vexpress", ++ .names = { "arm-coreboot-vexpress", NULL }, ++ .voidp_sizeof = 4, ++ .bigendian = 0, ++ .id = IMAGE_COREBOOT, ++ .flags = PLATFORM_FLAGS_NONE, ++ .total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE, ++ .decompressor_compressed_size = TARGET_NO_FIELD, ++ .decompressor_uncompressed_size = TARGET_NO_FIELD, ++ .decompressor_uncompressed_addr = TARGET_NO_FIELD, ++ .section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, ++ .vaddr_offset = 0, ++ .elf_target = EM_ARM, ++ .mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP, ++ .mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, ++ .link_align = 4, ++ .link_addr = 0x62000000, ++ }, ++ { ++ .dirname = "arm-coreboot-veyron", ++ .names = { "arm-coreboot-veyron", NULL }, ++ .voidp_sizeof = 4, ++ .bigendian = 0, ++ .id = IMAGE_COREBOOT, ++ .flags = PLATFORM_FLAGS_NONE, ++ .total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE, ++ .decompressor_compressed_size = TARGET_NO_FIELD, ++ .decompressor_uncompressed_size = TARGET_NO_FIELD, ++ .decompressor_uncompressed_addr = TARGET_NO_FIELD, ++ .section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, ++ .vaddr_offset = 0, ++ .elf_target = EM_ARM, ++ .mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP, ++ .mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, ++ .link_align = 4, ++ .link_addr = 0x43000000, ++ }, + { + .dirname = "arm-efi", + .names = { "arm-efi", NULL }, +@@ -1033,7 +1072,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + /* fallthrough */ + case IMAGE_COREBOOT: + case IMAGE_QEMU: +- if (layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000) ++ if (image_target->elf_target != EM_ARM && layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000) + grub_util_error (_("kernel image is too big (0x%x > 0x%x)"), + (unsigned) layout.kernel_size + (unsigned) layout.bss_size + + GRUB_KERNEL_I386_PC_LINK_ADDR, +-- +2.13.0 + diff --git a/0020-Add-support-for-device-tree-based-drivers.patch b/0020-Add-support-for-device-tree-based-drivers.patch new file mode 100644 index 00000000..34a34013 --- /dev/null +++ b/0020-Add-support-for-device-tree-based-drivers.patch @@ -0,0 +1,851 @@ +From fcbb723d4b1f7ad4687191562621dd0eb25f4d9e Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:19:59 +0200 +Subject: [PATCH 020/176] Add support for device-tree-based drivers. + +--- + conf/Makefile.common | 4 +- + grub-core/Makefile.am | 10 ++ + grub-core/Makefile.core.def | 2 + + grub-core/bus/fdt.c | 255 +++++++++++++++++++++++++++++++++++++ + grub-core/kern/arm/coreboot/init.c | 20 +++ + grub-core/lib/fdt.c | 142 +++++++++++++++------ + include/grub/fdt.h | 23 ++-- + include/grub/fdtbus.h | 73 +++++++++++ + include/grub/kernel.h | 3 +- + include/grub/util/install.h | 2 +- + util/grub-install-common.c | 2 +- + util/grub-mkimage.c | 11 +- + util/mkimage.c | 24 +++- + 13 files changed, 519 insertions(+), 52 deletions(-) + create mode 100644 grub-core/bus/fdt.c + create mode 100644 include/grub/fdtbus.h + +diff --git a/conf/Makefile.common b/conf/Makefile.common +index 11296b550..311da61c6 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -86,9 +86,11 @@ CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST + CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)' + CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)' + CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)' ++CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)' + CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \ + $(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \ +- $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) ++ $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) \ ++ $(CPPFLAGS_FDT_LIST) + + # Define these variables to calm down automake + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index bec058554..fc6ca3051 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -368,6 +368,16 @@ terminal.lst: $(MARKER_FILES) + platform_DATA += terminal.lst + CLEANFILES += terminal.lst + ++fdt.lst: $(MARKER_FILES) ++ (for pp in $^; do \ ++ b=`basename $$pp .marker`; \ ++ sed -n \ ++ -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \ ++ -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \ ++ done) | sort -u > $@ ++platform_DATA += fdt.lst ++CLEANFILES += fdt.lst ++ + parttool.lst: $(MARKER_FILES) + (for pp in $^; do \ + b=`basename $$pp .marker`; \ +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 411dca46b..77d0b019e 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -158,6 +158,8 @@ kernel = { + arm_coreboot = kern/arm/coreboot/init.c; + arm_coreboot = kern/arm/coreboot/timer.c; + arm_coreboot = kern/arm/coreboot/coreboot.S; ++ arm_coreboot = lib/fdt.c; ++ arm_coreboot = bus/fdt.c; + + terminfoinkernel = term/terminfo.c; + terminfoinkernel = term/tparm.c; +diff --git a/grub-core/bus/fdt.c b/grub-core/bus/fdt.c +new file mode 100644 +index 000000000..6fb077000 +--- /dev/null ++++ b/grub-core/bus/fdt.c +@@ -0,0 +1,255 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#include ++#include ++#include ++ ++static const void *dtb; ++static grub_size_t root_address_cells, root_size_cells; ++/* Pointer to this symbol signals invalid mapping. */ ++char grub_fdtbus_invalid_mapping[1]; ++ ++struct grub_fdtbus_dev ++{ ++ struct grub_fdtbus_dev *next; ++ struct grub_fdtbus_dev *parent; ++ int node; ++ struct grub_fdtbus_driver *driver; ++}; ++ ++struct grub_fdtbus_dev *devs; ++struct grub_fdtbus_driver *drivers; ++ ++static int ++is_compatible (struct grub_fdtbus_driver *driver, ++ int node) ++{ ++ grub_size_t compatible_size; ++ const char *compatible = grub_fdt_get_prop (dtb, node, "compatible", ++ &compatible_size); ++ const char *compatible_end = compatible + compatible_size; ++ while (compatible < compatible_end) ++ { ++ if (grub_strcmp (driver->compatible, compatible) == 0) ++ return 1; ++ compatible += grub_strlen (compatible) + 1; ++ } ++ return 0; ++} ++ ++static void ++fdtbus_scan (struct grub_fdtbus_dev *parent) ++{ ++ int node; ++ for (node = grub_fdt_first_node (dtb, parent ? parent->node : 0); node >= 0; ++ node = grub_fdt_next_node (dtb, node)) ++ { ++ struct grub_fdtbus_dev *dev; ++ struct grub_fdtbus_driver *driver; ++ dev = grub_zalloc (sizeof (*dev)); ++ if (!dev) ++ { ++ grub_print_error (); ++ return; ++ } ++ dev->node = node; ++ dev->next = devs; ++ dev->parent = parent; ++ devs = dev; ++ FOR_LIST_ELEMENTS(driver, drivers) ++ if (!dev->driver && is_compatible (driver, node)) ++ { ++ if (driver->attach(dev) == GRUB_ERR_NONE) ++ { ++ dev->driver = driver; ++ break; ++ } ++ grub_print_error (); ++ } ++ fdtbus_scan (dev); ++ } ++} ++ ++void ++grub_fdtbus_register (struct grub_fdtbus_driver *driver) ++{ ++ struct grub_fdtbus_dev *dev; ++ grub_list_push (GRUB_AS_LIST_P (&drivers), ++ GRUB_AS_LIST (driver)); ++ for (dev = devs; dev; dev = dev->next) ++ if (!dev->driver && is_compatible (driver, dev->node)) ++ { ++ if (driver->attach(dev) == GRUB_ERR_NONE) ++ dev->driver = driver; ++ grub_print_error (); ++ } ++} ++ ++void ++grub_fdtbus_unregister (struct grub_fdtbus_driver *driver) ++{ ++ grub_list_remove (GRUB_AS_LIST (driver)); ++ struct grub_fdtbus_dev *dev; ++ for (dev = devs; dev; dev = dev->next) ++ if (dev->driver == driver) ++ { ++ if (driver->detach) ++ driver->detach(dev); ++ dev->driver = 0; ++ } ++} ++ ++void ++grub_fdtbus_init (const void *dtb_in, grub_size_t size) ++{ ++ if (!dtb_in || grub_fdt_check_header (dtb_in, size) < 0) ++ grub_fatal ("invalid FDT"); ++ dtb = dtb_in; ++ const grub_uint32_t *prop = grub_fdt_get_prop (dtb, 0, "#address-cells", 0); ++ if (prop) ++ root_address_cells = grub_be_to_cpu32 (*prop); ++ else ++ root_address_cells = 1; ++ ++ prop = grub_fdt_get_prop (dtb, 0, "#size-cells", 0); ++ if (prop) ++ root_size_cells = grub_be_to_cpu32 (*prop); ++ else ++ root_size_cells = 1; ++ ++ fdtbus_scan (0); ++} ++ ++static int ++get_address_cells (const struct grub_fdtbus_dev *dev) ++{ ++ const grub_uint32_t *prop; ++ if (!dev) ++ return root_address_cells; ++ prop = grub_fdt_get_prop (dtb, dev->node, "#address-cells", 0); ++ if (prop) ++ return grub_be_to_cpu32 (*prop); ++ return 1; ++} ++ ++static int ++get_size_cells (const struct grub_fdtbus_dev *dev) ++{ ++ const grub_uint32_t *prop; ++ if (!dev) ++ return root_size_cells; ++ prop = grub_fdt_get_prop (dtb, dev->node, "#size-cells", 0); ++ if (prop) ++ return grub_be_to_cpu32 (*prop); ++ return 1; ++} ++ ++static grub_uint64_t ++get64 (const grub_uint32_t *reg, grub_size_t cells) ++{ ++ grub_uint64_t val = 0; ++ if (cells >= 1) ++ val = grub_be_to_cpu32 (reg[cells - 1]); ++ if (cells >= 2) ++ val |= ((grub_uint64_t) grub_be_to_cpu32 (reg[cells - 2])) << 32; ++ return val; ++} ++ ++static volatile void * ++translate (const struct grub_fdtbus_dev *dev, const grub_uint32_t *reg) ++{ ++ volatile void *ret; ++ const grub_uint32_t *ranges; ++ grub_size_t ranges_size, cells_per_mapping; ++ grub_size_t parent_address_cells, child_address_cells, child_size_cells; ++ grub_size_t nmappings, i; ++ if (dev == 0) ++ { ++ grub_uint64_t val; ++ val = get64 (reg, root_address_cells); ++ if (sizeof (void *) == 4 && (val >> 32)) ++ return grub_fdtbus_invalid_mapping; ++ return (void *) (grub_addr_t) val; ++ } ++ ranges = grub_fdt_get_prop (dtb, dev->node, "ranges", &ranges_size); ++ if (!ranges) ++ return grub_fdtbus_invalid_mapping; ++ if (ranges_size == 0) ++ return translate (dev->parent, reg); ++ parent_address_cells = get_address_cells (dev->parent); ++ child_address_cells = get_address_cells (dev); ++ child_size_cells = get_size_cells (dev); ++ cells_per_mapping = parent_address_cells + child_address_cells + child_size_cells; ++ nmappings = ranges_size / 4 / cells_per_mapping; ++ for (i = 0; i < nmappings; i++) ++ { ++ const grub_uint32_t *child_addr = &ranges[i * cells_per_mapping]; ++ const grub_uint32_t *parent_addr = child_addr + child_address_cells; ++ grub_uint64_t child_size = get64 (parent_addr + parent_address_cells, child_size_cells); ++ ++ if (child_address_cells > 2 && grub_memcmp (reg, child_addr, (child_address_cells - 2) * 4) != 0) ++ continue; ++ if (get64 (reg, child_address_cells) < get64 (child_addr, child_address_cells)) ++ continue; ++ ++ grub_uint64_t offset = get64 (reg, child_address_cells) - get64 (child_addr, child_address_cells); ++ if (offset >= child_size) ++ continue; ++ ++ ret = translate (dev->parent, parent_addr); ++ if (grub_fdtbus_is_mapping_valid (ret)) ++ ret = (volatile char *) ret + offset; ++ return ret; ++ } ++ return grub_fdtbus_invalid_mapping; ++} ++ ++volatile void * ++grub_fdtbus_map_reg (const struct grub_fdtbus_dev *dev, int regno, grub_size_t *size) ++{ ++ grub_size_t address_cells, size_cells; ++ address_cells = get_address_cells (dev->parent); ++ size_cells = get_size_cells (dev->parent); ++ const grub_uint32_t *reg = grub_fdt_get_prop (dtb, dev->node, "reg", 0); ++ if (size && size_cells) ++ *size = reg[(address_cells + size_cells) * regno + address_cells]; ++ if (size && !size_cells) ++ *size = 0; ++ return translate (dev->parent, reg + (address_cells + size_cells) * regno); ++} ++ ++const char * ++grub_fdtbus_get_name (const struct grub_fdtbus_dev *dev) ++{ ++ return grub_fdt_get_nodename (dtb, dev->node); ++} ++ ++const void * ++grub_fdtbus_get_prop (const struct grub_fdtbus_dev *dev, ++ const char *name, ++ grub_uint32_t *len) ++{ ++ return grub_fdt_get_prop (dtb, dev->node, name, len); ++} ++ ++const void * ++grub_fdtbus_get_fdt (void) ++{ ++ return dtb; ++} +diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c +index 51ecaceb0..aec75c672 100644 +--- a/grub-core/kern/arm/coreboot/init.c ++++ b/grub-core/kern/arm/coreboot/init.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + extern grub_uint8_t _start[]; + extern grub_uint8_t _end[]; +@@ -99,6 +100,10 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + void + grub_machine_init (void) + { ++ struct grub_module_header *header; ++ void *dtb = 0; ++ grub_size_t dtb_size = 0; ++ + modend = grub_modules_get_end (); + + grub_video_coreboot_fb_early_init (); +@@ -112,6 +117,21 @@ grub_machine_init (void) + grub_font_init (); + grub_gfxterm_init (); + ++ FOR_MODULES (header) ++ if (header->type == OBJ_TYPE_DTB) ++ { ++ char *dtb_orig_addr, *dtb_copy; ++ dtb_orig_addr = (char *) header + sizeof (struct grub_module_header); ++ ++ dtb_size = header->size - sizeof (struct grub_module_header); ++ dtb = dtb_copy = grub_malloc (dtb_size); ++ grub_memmove (dtb_copy, dtb_orig_addr, dtb_size); ++ break; ++ } ++ if (!dtb) ++ grub_fatal ("No DTB found"); ++ grub_fdtbus_init (dtb, dtb_size); ++ + grub_machine_timer_init (); + } + +diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c +index b5d520f20..bdc630244 100644 +--- a/grub-core/lib/fdt.c ++++ b/grub-core/lib/fdt.c +@@ -102,13 +102,13 @@ static grub_uint32_t *get_next_node (const void *fdt, char *node_name) + static int get_mem_rsvmap_size (const void *fdt) + { + int size = 0; +- grub_uint64_t *ptr = (void *) ((grub_addr_t) fdt +- + grub_fdt_get_off_mem_rsvmap (fdt)); ++ grub_unaligned_uint64_t *ptr = (void *) ((grub_addr_t) fdt ++ + grub_fdt_get_off_mem_rsvmap (fdt)); + + do + { + size += 2 * sizeof(*ptr); +- if (!*ptr && !*(ptr + 1)) ++ if (!ptr[0].val && !ptr[1].val) + return size; + ptr += 2; + } while ((grub_addr_t) ptr <= (grub_addr_t) fdt + grub_fdt_get_totalsize (fdt) +@@ -229,7 +229,7 @@ static int rearrange_blocks (void *fdt, unsigned int clearance) + return 0; + } + +-static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset, ++static grub_uint32_t *find_prop (const void *fdt, unsigned int nodeoffset, + const char *name) + { + grub_uint32_t *prop = (void *) ((grub_addr_t) fdt +@@ -268,9 +268,9 @@ static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset, + the size allocated for the FDT; if this function is called before the other + functions in this file and returns success, the other functions are + guaranteed not to access memory locations outside the allocated memory. */ +-int grub_fdt_check_header_nosize (void *fdt) ++int grub_fdt_check_header_nosize (const void *fdt) + { +- if (((grub_addr_t) fdt & 0x7) || (grub_fdt_get_magic (fdt) != FDT_MAGIC) ++ if (((grub_addr_t) fdt & 0x3) || (grub_fdt_get_magic (fdt) != FDT_MAGIC) + || (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION) + || (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION) + || (grub_fdt_get_off_dt_struct (fdt) & 0x00000003) +@@ -286,7 +286,7 @@ int grub_fdt_check_header_nosize (void *fdt) + return 0; + } + +-int grub_fdt_check_header (void *fdt, unsigned int size) ++int grub_fdt_check_header (const void *fdt, unsigned int size) + { + if (size < sizeof (grub_fdt_header_t) + || (grub_fdt_get_totalsize (fdt) > size) +@@ -295,41 +295,29 @@ int grub_fdt_check_header (void *fdt, unsigned int size) + return 0; + } + +-/* Find a direct sub-node of a given parent node. */ +-int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, +- const char *name) ++static const grub_uint32_t * ++advance_token (const void *fdt, const grub_uint32_t *token, const grub_uint32_t *end, int skip_current) + { +- grub_uint32_t *token, *end; +- char *node_name; +- +- if (parentoffset & 0x3) +- return -1; +- token = (void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) +- + parentoffset); +- end = (void *) struct_end (fdt); +- if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE)) +- return -1; +- SKIP_NODE_NAME(node_name, token, end); +- while (token < end) ++ for (; token < end; skip_current = 0) + { +- switch (grub_be_to_cpu32(*token)) ++ switch (grub_be_to_cpu32 (*token)) + { + case FDT_BEGIN_NODE: +- node_name = (char *) (token + 1); +- if (node_name + grub_strlen (name) >= (char *) end) +- return -1; +- if (!grub_strcmp (node_name, name)) +- return (int) ((grub_addr_t) token - (grub_addr_t) fdt +- - grub_fdt_get_off_dt_struct (fdt)); +- token = get_next_node (fdt, node_name); +- if (!token) +- return -1; +- break; ++ if (skip_current) ++ { ++ token = get_next_node (fdt, (char *) (token + 1)); ++ continue; ++ } ++ char *ptr; ++ for (ptr = (char *) (token + 1); *ptr && ptr < (char *) end; ptr++); ++ if (ptr >= (char *) end) ++ return 0; ++ return token; + case FDT_PROP: + /* Skip property token and following data (len, nameoff and property + value). */ + if (token >= end - 1) +- return -1; ++ return 0; + token += prop_entry_size(grub_be_to_cpu32(*(token + 1))) + / sizeof(*token); + break; +@@ -337,10 +325,74 @@ int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, + token++; + break; + default: +- return -1; ++ return 0; + } + } +- return -1; ++ return 0; ++} ++ ++int grub_fdt_next_node (const void *fdt, unsigned int currentoffset) ++{ ++ const grub_uint32_t *token = (const grub_uint32_t *) fdt + (currentoffset + grub_fdt_get_off_dt_struct (fdt)) / 4; ++ token = advance_token (fdt, token, (const void *) struct_end (fdt), 1); ++ if (!token) ++ return -1; ++ return (int) ((grub_addr_t) token - (grub_addr_t) fdt ++ - grub_fdt_get_off_dt_struct (fdt)); ++} ++ ++int grub_fdt_first_node (const void *fdt, unsigned int parentoffset) ++{ ++ const grub_uint32_t *token, *end; ++ char *node_name; ++ ++ if (parentoffset & 0x3) ++ return -1; ++ token = (const void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) ++ + parentoffset); ++ end = (const void *) struct_end (fdt); ++ if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE)) ++ return -1; ++ SKIP_NODE_NAME(node_name, token, end); ++ token = advance_token (fdt, token, end, 0); ++ if (!token) ++ return -1; ++ return (int) ((grub_addr_t) token - (grub_addr_t) fdt ++ - grub_fdt_get_off_dt_struct (fdt)); ++} ++ ++/* Find a direct sub-node of a given parent node. */ ++int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, ++ const char *name) ++{ ++ const grub_uint32_t *token, *end; ++ const char *node_name; ++ int skip_current = 0; ++ ++ if (parentoffset & 0x3) ++ return -1; ++ token = (const void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) ++ + parentoffset); ++ end = (const void *) struct_end (fdt); ++ if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE)) ++ return -1; ++ SKIP_NODE_NAME(node_name, token, end); ++ while (1) { ++ token = advance_token (fdt, token, end, skip_current); ++ if (!token) ++ return -1; ++ skip_current = 1; ++ node_name = (const char *) token + 4; ++ if (grub_strcmp (node_name, name) == 0) ++ return (int) ((grub_addr_t) token - (grub_addr_t) fdt ++ - grub_fdt_get_off_dt_struct (fdt)); ++ } ++} ++ ++const char * ++grub_fdt_get_nodename (const void *fdt, unsigned int nodeoffset) ++{ ++ return (const char *) fdt + grub_fdt_get_off_dt_struct(fdt) + nodeoffset + 4; + } + + int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, +@@ -359,6 +411,24 @@ int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, + return add_subnode (fdt, parentoffset, name); + } + ++const void * ++grub_fdt_get_prop (const void *fdt, unsigned int nodeoffset, const char *name, ++ grub_uint32_t *len) ++{ ++ grub_uint32_t *prop; ++ if ((nodeoffset >= grub_fdt_get_size_dt_struct (fdt)) || (nodeoffset & 0x3) ++ || (grub_be_to_cpu32(*(grub_uint32_t *) ((grub_addr_t) fdt ++ + grub_fdt_get_off_dt_struct (fdt) + nodeoffset)) ++ != FDT_BEGIN_NODE)) ++ return 0; ++ prop = find_prop (fdt, nodeoffset, name); ++ if (!prop) ++ return 0; ++ if (len) ++ *len = grub_be_to_cpu32 (*(prop + 1)); ++ return prop + 3; ++} ++ + int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, + const void *val, grub_uint32_t len) + { +diff --git a/include/grub/fdt.h b/include/grub/fdt.h +index fdfca75bf..75525fa31 100644 +--- a/include/grub/fdt.h ++++ b/include/grub/fdt.h +@@ -20,6 +20,7 @@ + #define GRUB_FDT_HEADER 1 + + #include ++#include + + #define FDT_MAGIC 0xD00DFEED + +@@ -95,16 +96,22 @@ struct grub_fdt_empty_tree { + #define grub_fdt_set_size_dt_struct(fdt, value) \ + grub_fdt_set_header(fdt, size_dt_struct, value) + +-int grub_fdt_create_empty_tree (void *fdt, unsigned int size); +-int grub_fdt_check_header (void *fdt, unsigned int size); +-int grub_fdt_check_header_nosize (void *fdt); +-int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, +- const char *name); +-int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, ++int EXPORT_FUNC(grub_fdt_create_empty_tree) (void *fdt, unsigned int size); ++int EXPORT_FUNC(grub_fdt_check_header) (const void *fdt, unsigned int size); ++int EXPORT_FUNC(grub_fdt_check_header_nosize) (const void *fdt); ++int EXPORT_FUNC(grub_fdt_find_subnode) (const void *fdt, unsigned int parentoffset, ++ const char *name); ++int EXPORT_FUNC(grub_fdt_first_node) (const void *fdt, unsigned int parentoffset); ++int EXPORT_FUNC(grub_fdt_next_node) (const void *fdt, unsigned int currentoffset); ++int EXPORT_FUNC(grub_fdt_add_subnode) (void *fdt, unsigned int parentoffset, + const char *name); ++const char * ++EXPORT_FUNC(grub_fdt_get_nodename) (const void *fdt, unsigned int nodeoffset); ++const void *EXPORT_FUNC(grub_fdt_get_prop) (const void *fdt, unsigned int nodeoffset, const char *name, ++ grub_uint32_t *len); + +-int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, +- const void *val, grub_uint32_t len); ++int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const char *name, ++ const void *val, grub_uint32_t len); + #define grub_fdt_set_prop32(fdt, nodeoffset, name, val) \ + ({ \ + grub_uint32_t _val = grub_cpu_to_be32(val); \ +diff --git a/include/grub/fdtbus.h b/include/grub/fdtbus.h +new file mode 100644 +index 000000000..985837e55 +--- /dev/null ++++ b/include/grub/fdtbus.h +@@ -0,0 +1,73 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#ifndef GRUB_FDTBUS_HEADER ++#define GRUB_FDTBUS_HEADER 1 ++ ++#include ++#include ++ ++struct grub_fdtbus_dev; ++ ++struct grub_fdtbus_driver ++{ ++ struct grub_fdtbus_driver *next; ++ struct grub_fdtbus_driver **prev; ++ ++ const char *compatible; ++ ++ grub_err_t (*attach) (const struct grub_fdtbus_dev *dev); ++ void (*detach) (const struct grub_fdtbus_dev *dev); ++}; ++ ++extern char EXPORT_VAR(grub_fdtbus_invalid_mapping)[1]; ++ ++static inline int ++grub_fdtbus_is_mapping_valid (volatile void *m) ++{ ++ return m != grub_fdtbus_invalid_mapping; ++} ++ ++volatile void * ++EXPORT_FUNC(grub_fdtbus_map_reg) (const struct grub_fdtbus_dev *dev, int reg, grub_size_t *size); ++ ++const void * ++EXPORT_FUNC(grub_fdtbus_get_fdt) (void); ++ ++const char * ++EXPORT_FUNC(grub_fdtbus_get_name) (const struct grub_fdtbus_dev *dev); ++ ++const void * ++EXPORT_FUNC(grub_fdtbus_get_prop) (const struct grub_fdtbus_dev *dev, ++ const char *name, ++ grub_uint32_t *len); ++ ++void ++EXPORT_FUNC(grub_fdtbus_register) (struct grub_fdtbus_driver *driver); ++ ++void ++EXPORT_FUNC(grub_fdtbus_unregister) (struct grub_fdtbus_driver *driver); ++ ++/* Must be called before any register(). */ ++/* dtb is assumed to be unfreeable and must remain ++ valid for lifetime of GRUB. ++ */ ++void ++grub_fdtbus_init (const void *dtb, grub_size_t size); ++ ++#endif +diff --git a/include/grub/kernel.h b/include/grub/kernel.h +index 20ddf2da2..ecd88ca72 100644 +--- a/include/grub/kernel.h ++++ b/include/grub/kernel.h +@@ -28,7 +28,8 @@ enum + OBJ_TYPE_MEMDISK, + OBJ_TYPE_CONFIG, + OBJ_TYPE_PREFIX, +- OBJ_TYPE_PUBKEY ++ OBJ_TYPE_PUBKEY, ++ OBJ_TYPE_DTB + }; + + /* The module header. */ +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index 5ca4811cd..6abd288c3 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -176,7 +176,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + char *config_path, + const struct grub_install_image_target_desc *image_target, + int note, +- grub_compression_t comp); ++ grub_compression_t comp, const char *dtb_file); + + const struct grub_install_image_target_desc * + grub_install_get_image_target (const char *arg); +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index 452b230da..8539ff348 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -499,7 +499,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_install_generate_image (dir, prefix, fp, outname, + modules.entries, memdisk_path, + pubkeys, npubkeys, config_path, tgt, +- note, compression); ++ note, compression, 0); + while (dc--) + grub_install_pop_module (); + } +diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c +index aba19d21b..98d24cc06 100644 +--- a/util/grub-mkimage.c ++++ b/util/grub-mkimage.c +@@ -71,6 +71,7 @@ static struct argp_option options[] = { + N_("embed FILE as a memdisk image\n" + "Implies `-p (memdisk)/boot/grub' and overrides any prefix supplied previously," + " but the prefix itself can be overridden by later options"), 0}, ++ {"dtb", 'D', N_("FILE"), 0, N_("embed FILE as a device tree (DTB)\n"), 0}, + /* TRANSLATORS: "embed" is a verb (command description). "*/ + {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0}, + /* TRANSLATORS: "embed" is a verb (command description). "*/ +@@ -117,6 +118,7 @@ struct arguments + char *dir; + char *prefix; + char *memdisk; ++ char *dtb; + char **pubkeys; + size_t npubkeys; + char *font; +@@ -176,6 +178,13 @@ argp_parser (int key, char *arg, struct argp_state *state) + arguments->prefix = xstrdup ("(memdisk)/boot/grub"); + break; + ++ case 'D': ++ if (arguments->dtb) ++ free (arguments->dtb); ++ ++ arguments->dtb = xstrdup (arg); ++ break; ++ + case 'k': + arguments->pubkeys = xrealloc (arguments->pubkeys, + sizeof (arguments->pubkeys[0]) +@@ -300,7 +309,7 @@ main (int argc, char *argv[]) + arguments.memdisk, arguments.pubkeys, + arguments.npubkeys, arguments.config, + arguments.image_target, arguments.note, +- arguments.comp); ++ arguments.comp, arguments.dtb); + + grub_util_file_sync (fp); + fclose (fp); +diff --git a/util/mkimage.c b/util/mkimage.c +index 6aa77ed73..e22d82afa 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -777,13 +777,12 @@ grub_install_generate_image (const char *dir, const char *prefix, + char *memdisk_path, char **pubkey_paths, + size_t npubkeys, char *config_path, + const struct grub_install_image_target_desc *image_target, +- int note, +- grub_compression_t comp) ++ int note, grub_compression_t comp, const char *dtb_path) + { + char *kernel_img, *core_img; + size_t total_module_size, core_size; + size_t memdisk_size = 0, config_size = 0; +- size_t prefix_size = 0; ++ size_t prefix_size = 0, dtb_size = 0; + char *kernel_path; + size_t offset; + struct grub_util_path_list *path_list, *p; +@@ -828,6 +827,12 @@ grub_install_generate_image (const char *dir, const char *prefix, + total_module_size += memdisk_size + sizeof (struct grub_module_header); + } + ++ if (dtb_path) ++ { ++ dtb_size = ALIGN_UP(grub_util_get_image_size (dtb_path), 4); ++ total_module_size += dtb_size + sizeof (struct grub_module_header); ++ } ++ + if (config_path) + { + config_size = ALIGN_ADDR (grub_util_get_image_size (config_path) + 1); +@@ -950,6 +955,19 @@ grub_install_generate_image (const char *dir, const char *prefix, + offset += memdisk_size; + } + ++ if (dtb_path) ++ { ++ struct grub_module_header *header; ++ ++ header = (struct grub_module_header *) (kernel_img + offset); ++ header->type = grub_host_to_target32 (OBJ_TYPE_DTB); ++ header->size = grub_host_to_target32 (dtb_size + sizeof (*header)); ++ offset += sizeof (*header); ++ ++ grub_util_load_image (dtb_path, kernel_img + offset); ++ offset += dtb_size; ++ } ++ + if (config_path) + { + struct grub_module_header *header; +-- +2.13.0 + diff --git a/0021-arm-coreboot-Support-for-vexpress-timer.patch b/0021-arm-coreboot-Support-for-vexpress-timer.patch new file mode 100644 index 00000000..9e01cfb4 --- /dev/null +++ b/0021-arm-coreboot-Support-for-vexpress-timer.patch @@ -0,0 +1,73 @@ +From 5a865b37866ee8cd64c080bc6fb1e537f8e2b3c6 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:26:36 +0200 +Subject: [PATCH 021/176] arm-coreboot: Support for vexpress timer. + +--- + grub-core/kern/arm/coreboot/timer.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/grub-core/kern/arm/coreboot/timer.c b/grub-core/kern/arm/coreboot/timer.c +index ebefb99d5..d97b844f8 100644 +--- a/grub-core/kern/arm/coreboot/timer.c ++++ b/grub-core/kern/arm/coreboot/timer.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + + grub_uint64_t +@@ -33,6 +34,39 @@ grub_uint32_t + grub_arm_pfr1(void); + + static int have_timer = 0; ++static volatile grub_uint32_t *sp804_regs; ++ ++static grub_uint64_t ++sp804_get_time_ms (void) ++{ ++ static grub_uint32_t high, last_low; ++ grub_uint32_t low = ~sp804_regs[1]; ++ if (last_low > low) ++ high++; ++ last_low = low; ++ return grub_divmod64 ((((grub_uint64_t) high) << 32) | low, ++ 1000, 0); ++} ++ ++static grub_err_t ++sp804_attach(const struct grub_fdtbus_dev *dev) ++{ ++ if (have_timer) ++ return GRUB_ERR_NONE; ++ sp804_regs = grub_fdtbus_map_reg (dev, 0, 0); ++ if (!grub_fdtbus_is_mapping_valid (sp804_regs)) ++ return grub_error (GRUB_ERR_IO, "could not map sp804: %p", sp804_regs); ++ grub_install_get_time_ms (sp804_get_time_ms); ++ have_timer = 1; ++ return GRUB_ERR_NONE; ++} ++ ++struct grub_fdtbus_driver sp804 = ++{ ++ .compatible = "arm,sp804", ++ .attach = sp804_attach ++}; ++ + static grub_uint32_t timer_frequency_in_khz; + + static grub_uint64_t +@@ -58,6 +92,8 @@ try_generic_timer (void) + void + grub_machine_timer_init (void) + { ++ grub_fdtbus_register (&sp804); ++ + if (!have_timer) + try_generic_timer (); + if (!have_timer) +-- +2.13.0 + diff --git a/0022-arm-coreboot-Export-FDT-routines.patch b/0022-arm-coreboot-Export-FDT-routines.patch new file mode 100644 index 00000000..d8a44cdf --- /dev/null +++ b/0022-arm-coreboot-Export-FDT-routines.patch @@ -0,0 +1,27 @@ +From ac6b41b89fbb82a3ba843a7ed19115d81432b604 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:29:48 +0200 +Subject: [PATCH 022/176] arm-coreboot: Export FDT routines. + +We need to use them from modules as well. +--- + grub-core/Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index fc6ca3051..147e6959c 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -246,7 +246,9 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h + endif + + if COND_arm_efi +-- +2.13.0 + diff --git a/0023-at_keyboard-Split-protocol-from-controller-code.patch b/0023-at_keyboard-Split-protocol-from-controller-code.patch new file mode 100644 index 00000000..59b1d80f --- /dev/null +++ b/0023-at_keyboard-Split-protocol-from-controller-code.patch @@ -0,0 +1,1027 @@ +From 216950a4eea1a1ead1c28eaca94e34ea2ef2ad19 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:41:22 +0200 +Subject: [PATCH 023/176] at_keyboard: Split protocol from controller code. + +On vexpress controller is different but protocol is the same, so reuse the +code. +--- + grub-core/Makefile.core.def | 3 + + grub-core/term/at_keyboard.c | 426 +++---------------------------------------- + grub-core/term/ps2.c | 387 +++++++++++++++++++++++++++++++++++++++ + include/grub/at_keyboard.h | 4 - + include/grub/ps2.h | 43 +++++ + 5 files changed, 462 insertions(+), 401 deletions(-) + create mode 100644 grub-core/term/ps2.c + create mode 100644 include/grub/ps2.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 77d0b019e..6ade6e950 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -251,6 +251,7 @@ kernel = { + mips_qemu_mips = term/ns8250.c; + mips_qemu_mips = term/serial.c; + mips_qemu_mips = term/at_keyboard.c; ++ mips_qemu_mips = term/ps2.c; + mips_qemu_mips = commands/boot.c; + mips_qemu_mips = commands/keylayouts.c; + mips_qemu_mips = term/i386/pc/vga_text.c; +@@ -266,6 +267,7 @@ kernel = { + mips_loongson = bus/pci.c; + mips_loongson = kern/mips/loongson/init.c; + mips_loongson = term/at_keyboard.c; ++ mips_loongson = term/ps2.c; + mips_loongson = commands/boot.c; + mips_loongson = term/serial.c; + mips_loongson = video/sm712.c; +@@ -1887,6 +1889,7 @@ module = { + module = { + name = at_keyboard; + common = term/at_keyboard.c; ++ common = term/ps2.c; + enable = x86; + }; + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index b4ea9ff7e..3ab4e205f 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -22,212 +22,21 @@ + #include + #include + #include +-#include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +-static short at_keyboard_status = 0; +-static int e0_received = 0; +-static int f0_received = 0; +- +-static grub_uint8_t led_status; +- +-#define KEYBOARD_LED_SCROLL (1 << 0) +-#define KEYBOARD_LED_NUM (1 << 1) +-#define KEYBOARD_LED_CAPS (1 << 2) +- + static grub_uint8_t grub_keyboard_controller_orig; + static grub_uint8_t grub_keyboard_orig_set; +-static grub_uint8_t current_set; ++struct grub_ps2_state ps2_state; ++ ++static int ping_sent; + + static void + grub_keyboard_controller_init (void); + +-static const grub_uint8_t set1_mapping[128] = +- { +- /* 0x00 */ 0 /* Unused */, GRUB_KEYBOARD_KEY_ESCAPE, +- /* 0x02 */ GRUB_KEYBOARD_KEY_1, GRUB_KEYBOARD_KEY_2, +- /* 0x04 */ GRUB_KEYBOARD_KEY_3, GRUB_KEYBOARD_KEY_4, +- /* 0x06 */ GRUB_KEYBOARD_KEY_5, GRUB_KEYBOARD_KEY_6, +- /* 0x08 */ GRUB_KEYBOARD_KEY_7, GRUB_KEYBOARD_KEY_8, +- /* 0x0a */ GRUB_KEYBOARD_KEY_9, GRUB_KEYBOARD_KEY_0, +- /* 0x0c */ GRUB_KEYBOARD_KEY_DASH, GRUB_KEYBOARD_KEY_EQUAL, +- /* 0x0e */ GRUB_KEYBOARD_KEY_BACKSPACE, GRUB_KEYBOARD_KEY_TAB, +- /* 0x10 */ GRUB_KEYBOARD_KEY_Q, GRUB_KEYBOARD_KEY_W, +- /* 0x12 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_R, +- /* 0x14 */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_Y, +- /* 0x16 */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_I, +- /* 0x18 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_P, +- /* 0x1a */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_RBRACKET, +- /* 0x1c */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_LEFT_CTRL, +- /* 0x1e */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_S, +- /* 0x20 */ GRUB_KEYBOARD_KEY_D, GRUB_KEYBOARD_KEY_F, +- /* 0x22 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_H, +- /* 0x24 */ GRUB_KEYBOARD_KEY_J, GRUB_KEYBOARD_KEY_K, +- /* 0x26 */ GRUB_KEYBOARD_KEY_L, GRUB_KEYBOARD_KEY_SEMICOLON, +- /* 0x28 */ GRUB_KEYBOARD_KEY_DQUOTE, GRUB_KEYBOARD_KEY_RQUOTE, +- /* 0x2a */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, GRUB_KEYBOARD_KEY_BACKSLASH, +- /* 0x2c */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_X, +- /* 0x2e */ GRUB_KEYBOARD_KEY_C, GRUB_KEYBOARD_KEY_V, +- /* 0x30 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_N, +- /* 0x32 */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_COMMA, +- /* 0x34 */ GRUB_KEYBOARD_KEY_DOT, GRUB_KEYBOARD_KEY_SLASH, +- /* 0x36 */ GRUB_KEYBOARD_KEY_RIGHT_SHIFT, GRUB_KEYBOARD_KEY_NUMMUL, +- /* 0x38 */ GRUB_KEYBOARD_KEY_LEFT_ALT, GRUB_KEYBOARD_KEY_SPACE, +- /* 0x3a */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_F1, +- /* 0x3c */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F3, +- /* 0x3e */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_F5, +- /* 0x40 */ GRUB_KEYBOARD_KEY_F6, GRUB_KEYBOARD_KEY_F7, +- /* 0x42 */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F9, +- /* 0x44 */ GRUB_KEYBOARD_KEY_F10, GRUB_KEYBOARD_KEY_NUM_LOCK, +- /* 0x46 */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, GRUB_KEYBOARD_KEY_NUM7, +- /* 0x48 */ GRUB_KEYBOARD_KEY_NUM8, GRUB_KEYBOARD_KEY_NUM9, +- /* 0x4a */ GRUB_KEYBOARD_KEY_NUMMINUS, GRUB_KEYBOARD_KEY_NUM4, +- /* 0x4c */ GRUB_KEYBOARD_KEY_NUM5, GRUB_KEYBOARD_KEY_NUM6, +- /* 0x4e */ GRUB_KEYBOARD_KEY_NUMPLUS, GRUB_KEYBOARD_KEY_NUM1, +- /* 0x50 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM3, +- /* 0x52 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, +- /* 0x54 */ 0, 0, +- /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, +- /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, +- /* 0x5a */ 0, 0, +- /* 0x5c */ 0, 0, +- /* 0x5e */ 0, 0, +- /* 0x60 */ 0, 0, +- /* 0x62 */ 0, 0, +- /* OLPC keys. Just mapped to normal keys. */ +- /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, +- /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, +- /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, +- /* 0x6a */ 0, 0, +- /* 0x6c */ 0, 0, +- /* 0x6e */ 0, 0, +- /* 0x70 */ 0, 0, +- /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, +- /* 0x74 */ 0, 0, +- /* 0x76 */ 0, 0, +- /* 0x78 */ 0, 0, +- /* 0x7a */ 0, 0, +- /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, +- /* 0x7e */ GRUB_KEYBOARD_KEY_KPCOMMA +- }; +- +-static const struct +-{ +- grub_uint8_t from, to; +-} set1_e0_mapping[] = +- { +- {0x1c, GRUB_KEYBOARD_KEY_NUMENTER}, +- {0x1d, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, +- {0x35, GRUB_KEYBOARD_KEY_NUMSLASH }, +- {0x38, GRUB_KEYBOARD_KEY_RIGHT_ALT}, +- {0x47, GRUB_KEYBOARD_KEY_HOME}, +- {0x48, GRUB_KEYBOARD_KEY_UP}, +- {0x49, GRUB_KEYBOARD_KEY_PPAGE}, +- {0x4b, GRUB_KEYBOARD_KEY_LEFT}, +- {0x4d, GRUB_KEYBOARD_KEY_RIGHT}, +- {0x4f, GRUB_KEYBOARD_KEY_END}, +- {0x50, GRUB_KEYBOARD_KEY_DOWN}, +- {0x51, GRUB_KEYBOARD_KEY_NPAGE}, +- {0x52, GRUB_KEYBOARD_KEY_INSERT}, +- {0x53, GRUB_KEYBOARD_KEY_DELETE}, +- }; +- +-static const grub_uint8_t set2_mapping[256] = +- { +- /* 0x00 */ 0, GRUB_KEYBOARD_KEY_F9, +- /* 0x02 */ 0, GRUB_KEYBOARD_KEY_F5, +- /* 0x04 */ GRUB_KEYBOARD_KEY_F3, GRUB_KEYBOARD_KEY_F1, +- /* 0x06 */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F12, +- /* 0x08 */ 0, GRUB_KEYBOARD_KEY_F10, +- /* 0x0a */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F6, +- /* 0x0c */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_TAB, +- /* 0x0e */ GRUB_KEYBOARD_KEY_RQUOTE, 0, +- /* 0x10 */ 0, GRUB_KEYBOARD_KEY_LEFT_ALT, +- /* 0x12 */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, 0, +- /* 0x14 */ GRUB_KEYBOARD_KEY_LEFT_CTRL, GRUB_KEYBOARD_KEY_Q, +- /* 0x16 */ GRUB_KEYBOARD_KEY_1, 0, +- /* 0x18 */ 0, 0, +- /* 0x1a */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_S, +- /* 0x1c */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_W, +- /* 0x1e */ GRUB_KEYBOARD_KEY_2, 0, +- /* 0x20 */ 0, GRUB_KEYBOARD_KEY_C, +- /* 0x22 */ GRUB_KEYBOARD_KEY_X, GRUB_KEYBOARD_KEY_D, +- /* 0x24 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_4, +- /* 0x26 */ GRUB_KEYBOARD_KEY_3, 0, +- /* 0x28 */ 0, GRUB_KEYBOARD_KEY_SPACE, +- /* 0x2a */ GRUB_KEYBOARD_KEY_V, GRUB_KEYBOARD_KEY_F, +- /* 0x2c */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_R, +- /* 0x2e */ GRUB_KEYBOARD_KEY_5, 0, +- /* 0x30 */ 0, GRUB_KEYBOARD_KEY_N, +- /* 0x32 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_H, +- /* 0x34 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_Y, +- /* 0x36 */ GRUB_KEYBOARD_KEY_6, 0, +- /* 0x38 */ 0, 0, +- /* 0x3a */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_J, +- /* 0x3c */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_7, +- /* 0x3e */ GRUB_KEYBOARD_KEY_8, 0, +- /* 0x40 */ 0, GRUB_KEYBOARD_KEY_COMMA, +- /* 0x42 */ GRUB_KEYBOARD_KEY_K, GRUB_KEYBOARD_KEY_I, +- /* 0x44 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_0, +- /* 0x46 */ GRUB_KEYBOARD_KEY_9, 0, +- /* 0x48 */ 0, GRUB_KEYBOARD_KEY_DOT, +- /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, +- /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, +- /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, +- /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, +- /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, +- /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, +- /* 0x56 */ 0, 0, +- /* 0x58 */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_RIGHT_SHIFT, +- /* 0x5a */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_RBRACKET, +- /* 0x5c */ 0, GRUB_KEYBOARD_KEY_BACKSLASH, +- /* 0x5e */ 0, 0, +- /* 0x60 */ 0, GRUB_KEYBOARD_KEY_102ND, +- /* 0x62 */ 0, 0, +- /* 0x64 */ 0, 0, +- /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, +- /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, +- /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, +- /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, GRUB_KEYBOARD_KEY_KPCOMMA, +- /* 0x6e */ 0, 0, +- /* 0x70 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, +- /* 0x72 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM5, +- /* 0x74 */ GRUB_KEYBOARD_KEY_NUM6, GRUB_KEYBOARD_KEY_NUM8, +- /* 0x76 */ GRUB_KEYBOARD_KEY_ESCAPE, GRUB_KEYBOARD_KEY_NUM_LOCK, +- /* 0x78 */ GRUB_KEYBOARD_KEY_F11, GRUB_KEYBOARD_KEY_NUMPLUS, +- /* 0x7a */ GRUB_KEYBOARD_KEY_NUM3, GRUB_KEYBOARD_KEY_NUMMINUS, +- /* 0x7c */ GRUB_KEYBOARD_KEY_NUMMUL, GRUB_KEYBOARD_KEY_NUM9, +- /* 0x7e */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, 0, +- /* 0x80 */ 0, 0, +- /* 0x82 */ 0, GRUB_KEYBOARD_KEY_F7, +- }; +- +-static const struct +-{ +- grub_uint8_t from, to; +-} set2_e0_mapping[] = +- { +- {0x11, GRUB_KEYBOARD_KEY_RIGHT_ALT}, +- {0x14, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, +- {0x4a, GRUB_KEYBOARD_KEY_NUMSLASH}, +- {0x5a, GRUB_KEYBOARD_KEY_NUMENTER}, +- {0x69, GRUB_KEYBOARD_KEY_END}, +- {0x6b, GRUB_KEYBOARD_KEY_LEFT}, +- {0x6c, GRUB_KEYBOARD_KEY_HOME}, +- {0x70, GRUB_KEYBOARD_KEY_INSERT}, +- {0x71, GRUB_KEYBOARD_KEY_DELETE}, +- {0x72, GRUB_KEYBOARD_KEY_DOWN}, +- {0x74, GRUB_KEYBOARD_KEY_RIGHT}, +- {0x75, GRUB_KEYBOARD_KEY_UP}, +- {0x7a, GRUB_KEYBOARD_KEY_NPAGE}, +- {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, +- }; +- +-static int ping_sent; +- + static void + keyboard_controller_wait_until_ready (void) + { +@@ -350,12 +159,12 @@ set_scancodes (void) + if (!grub_keyboard_orig_set) + { + grub_dprintf ("atkeyb", "No sets support assumed\n"); +- current_set = 1; ++ ps2_state.current_set = 1; + return; + } + + #if !USE_SCANCODE_SET +- current_set = 1; ++ ps2_state.current_set = 1; + return; + #else + +@@ -363,15 +172,15 @@ set_scancodes (void) + & ~KEYBOARD_AT_TRANSLATE); + + write_mode (2); +- current_set = query_mode (); +- grub_dprintf ("atkeyb", "returned set %d\n", current_set); +- if (current_set == 2) ++ ps2_state.current_set = query_mode (); ++ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); ++ if (ps2_state.current_set == 2) + return; + + write_mode (1); +- current_set = query_mode (); +- grub_dprintf ("atkeyb", "returned set %d\n", current_set); +- if (current_set == 1) ++ ps2_state.current_set = query_mode (); ++ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); ++ if (ps2_state.current_set == 1) + return; + grub_dprintf ("atkeyb", "no supported scancode set found\n"); + #endif +@@ -386,164 +195,10 @@ keyboard_controller_led (grub_uint8_t leds) + grub_outb (leds & 0x7, KEYBOARD_REG_DATA); + } + +-static int +-fetch_key (int *is_break) +-{ +- int was_ext = 0; +- grub_uint8_t at_key; +- int ret = 0; +- +- if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) +- return -1; +- at_key = grub_inb (KEYBOARD_REG_DATA); +- /* May happen if no keyboard is connected. Just ignore this. */ +- if (at_key == 0xff) +- return -1; +- if (at_key == 0xe0) +- { +- e0_received = 1; +- return -1; +- } +- +- if ((current_set == 2 || current_set == 3) && at_key == 0xf0) +- { +- f0_received = 1; +- return -1; +- } +- +- /* Setting LEDs may generate ACKs. */ +- if (at_key == GRUB_AT_ACK) +- return -1; +- +- was_ext = e0_received; +- e0_received = 0; +- +- switch (current_set) +- { +- case 1: +- *is_break = !!(at_key & 0x80); +- if (!was_ext) +- ret = set1_mapping[at_key & 0x7f]; +- else +- { +- unsigned i; +- for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++) +- if (set1_e0_mapping[i].from == (at_key & 0x7f)) +- { +- ret = set1_e0_mapping[i].to; +- break; +- } +- } +- break; +- case 2: +- *is_break = f0_received; +- f0_received = 0; +- if (!was_ext) +- ret = set2_mapping[at_key]; +- else +- { +- unsigned i; +- for (i = 0; i < ARRAY_SIZE (set2_e0_mapping); i++) +- if (set2_e0_mapping[i].from == at_key) +- { +- ret = set2_e0_mapping[i].to; +- break; +- } +- } +- break; +- default: +- return -1; +- } +- if (!ret) +- { +- if (was_ext) +- grub_dprintf ("atkeyb", "Unknown key 0xe0+0x%02x from set %d\n", +- at_key, current_set); +- else +- grub_dprintf ("atkeyb", "Unknown key 0x%02x from set %d\n", +- at_key, current_set); +- return -1; +- } +- return ret; +-} +- +-/* FIXME: This should become an interrupt service routine. For now +- it's just used to catch events from control keys. */ +-static int +-grub_keyboard_isr (grub_keyboard_key_t key, int is_break) +-{ +- if (!is_break) +- switch (key) +- { +- case GRUB_KEYBOARD_KEY_LEFT_SHIFT: +- at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: +- at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT; +- return 1; +- case GRUB_KEYBOARD_KEY_LEFT_CTRL: +- at_keyboard_status |= GRUB_TERM_STATUS_LCTRL; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_CTRL: +- at_keyboard_status |= GRUB_TERM_STATUS_RCTRL; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_ALT: +- at_keyboard_status |= GRUB_TERM_STATUS_RALT; +- return 1; +- case GRUB_KEYBOARD_KEY_LEFT_ALT: +- at_keyboard_status |= GRUB_TERM_STATUS_LALT; +- return 1; +- default: +- return 0; +- } +- else +- switch (key) +- { +- case GRUB_KEYBOARD_KEY_LEFT_SHIFT: +- at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: +- at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT; +- return 1; +- case GRUB_KEYBOARD_KEY_LEFT_CTRL: +- at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_CTRL: +- at_keyboard_status &= ~GRUB_TERM_STATUS_RCTRL; +- return 1; +- case GRUB_KEYBOARD_KEY_RIGHT_ALT: +- at_keyboard_status &= ~GRUB_TERM_STATUS_RALT; +- return 1; +- case GRUB_KEYBOARD_KEY_LEFT_ALT: +- at_keyboard_status &= ~GRUB_TERM_STATUS_LALT; +- return 1; +- default: +- return 0; +- } +-} +- +-/* If there is a raw key pending, return it; otherwise return -1. */ +-static int +-grub_keyboard_getkey (void) +-{ +- int key; +- int is_break = 0; +- +- key = fetch_key (&is_break); +- if (key == -1) +- return -1; +- +- if (grub_keyboard_isr (key, is_break)) +- return -1; +- if (is_break) +- return -1; +- return key; +-} +- + int + grub_at_keyboard_is_alive (void) + { +- if (current_set != 0) ++ if (ps2_state.current_set != 0) + return 1; + if (ping_sent + && KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)) +@@ -566,51 +221,28 @@ grub_at_keyboard_is_alive (void) + static int + grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) + { +- int code; ++ grub_uint8_t at_key; ++ int ret; ++ grub_uint8_t old_led; + + if (!grub_at_keyboard_is_alive ()) + return GRUB_TERM_NO_KEY; + +- code = grub_keyboard_getkey (); +- if (code == -1) +- return GRUB_TERM_NO_KEY; +-#ifdef DEBUG_AT_KEYBOARD +- grub_dprintf ("atkeyb", "Detected key 0x%x\n", code); +-#endif +- switch (code) +- { +- case GRUB_KEYBOARD_KEY_CAPS_LOCK: +- at_keyboard_status ^= GRUB_TERM_STATUS_CAPS; +- led_status ^= KEYBOARD_LED_CAPS; +- keyboard_controller_led (led_status); ++ if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) ++ return -1; ++ at_key = grub_inb (KEYBOARD_REG_DATA); ++ old_led = ps2_state.led_status; + +-#ifdef DEBUG_AT_KEYBOARD +- grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & GRUB_KEYBOARD_STATUS_CAPS_LOCK)); +-#endif +- return GRUB_TERM_NO_KEY; +- case GRUB_KEYBOARD_KEY_NUM_LOCK: +- at_keyboard_status ^= GRUB_TERM_STATUS_NUM; +- led_status ^= KEYBOARD_LED_NUM; +- keyboard_controller_led (led_status); +- +-#ifdef DEBUG_AT_KEYBOARD +- grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & GRUB_KEYBOARD_STATUS_NUM_LOCK)); +-#endif +- return GRUB_TERM_NO_KEY; +- case GRUB_KEYBOARD_KEY_SCROLL_LOCK: +- at_keyboard_status ^= GRUB_TERM_STATUS_SCROLL; +- led_status ^= KEYBOARD_LED_SCROLL; +- keyboard_controller_led (led_status); +- return GRUB_TERM_NO_KEY; +- default: +- return grub_term_map_key (code, at_keyboard_status); +- } ++ ret = grub_ps2_process_incoming_byte (&ps2_state, at_key); ++ if (old_led != ps2_state.led_status) ++ keyboard_controller_led (ps2_state.led_status); ++ return ret; + } + + static void + grub_keyboard_controller_init (void) + { +- at_keyboard_status = 0; ++ ps2_state.at_keyboard_status = 0; + /* Drain input buffer. */ + while (1) + { +@@ -632,13 +264,13 @@ grub_keyboard_controller_init (void) + grub_keyboard_orig_set = query_mode (); + #endif + set_scancodes (); +- keyboard_controller_led (led_status); ++ keyboard_controller_led (ps2_state.led_status); + } + + static grub_err_t + grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) + { +- if (current_set == 0) ++ if (ps2_state.current_set == 0) + return GRUB_ERR_NONE; + if (grub_keyboard_orig_set) + write_mode (grub_keyboard_orig_set); +@@ -655,7 +287,7 @@ grub_at_fini_hw (int noreturn __attribute__ ((unused))) + static grub_err_t + grub_at_restore_hw (void) + { +- if (current_set == 0) ++ if (ps2_state.current_set == 0) + return GRUB_ERR_NONE; + + /* Drain input buffer. */ +@@ -668,7 +300,7 @@ grub_at_restore_hw (void) + grub_inb (KEYBOARD_REG_DATA); + } + set_scancodes (); +- keyboard_controller_led (led_status); ++ keyboard_controller_led (ps2_state.led_status); + + return GRUB_ERR_NONE; + } +diff --git a/grub-core/term/ps2.c b/grub-core/term/ps2.c +new file mode 100644 +index 000000000..7ae4e9f2f +--- /dev/null ++++ b/grub-core/term/ps2.c +@@ -0,0 +1,387 @@ ++/* ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define KEYBOARD_LED_SCROLL (1 << 0) ++#define KEYBOARD_LED_NUM (1 << 1) ++#define KEYBOARD_LED_CAPS (1 << 2) ++ ++static const grub_uint8_t set1_mapping[128] = ++ { ++ /* 0x00 */ 0 /* Unused */, GRUB_KEYBOARD_KEY_ESCAPE, ++ /* 0x02 */ GRUB_KEYBOARD_KEY_1, GRUB_KEYBOARD_KEY_2, ++ /* 0x04 */ GRUB_KEYBOARD_KEY_3, GRUB_KEYBOARD_KEY_4, ++ /* 0x06 */ GRUB_KEYBOARD_KEY_5, GRUB_KEYBOARD_KEY_6, ++ /* 0x08 */ GRUB_KEYBOARD_KEY_7, GRUB_KEYBOARD_KEY_8, ++ /* 0x0a */ GRUB_KEYBOARD_KEY_9, GRUB_KEYBOARD_KEY_0, ++ /* 0x0c */ GRUB_KEYBOARD_KEY_DASH, GRUB_KEYBOARD_KEY_EQUAL, ++ /* 0x0e */ GRUB_KEYBOARD_KEY_BACKSPACE, GRUB_KEYBOARD_KEY_TAB, ++ /* 0x10 */ GRUB_KEYBOARD_KEY_Q, GRUB_KEYBOARD_KEY_W, ++ /* 0x12 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_R, ++ /* 0x14 */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_Y, ++ /* 0x16 */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_I, ++ /* 0x18 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_P, ++ /* 0x1a */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_RBRACKET, ++ /* 0x1c */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_LEFT_CTRL, ++ /* 0x1e */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_S, ++ /* 0x20 */ GRUB_KEYBOARD_KEY_D, GRUB_KEYBOARD_KEY_F, ++ /* 0x22 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_H, ++ /* 0x24 */ GRUB_KEYBOARD_KEY_J, GRUB_KEYBOARD_KEY_K, ++ /* 0x26 */ GRUB_KEYBOARD_KEY_L, GRUB_KEYBOARD_KEY_SEMICOLON, ++ /* 0x28 */ GRUB_KEYBOARD_KEY_DQUOTE, GRUB_KEYBOARD_KEY_RQUOTE, ++ /* 0x2a */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, GRUB_KEYBOARD_KEY_BACKSLASH, ++ /* 0x2c */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_X, ++ /* 0x2e */ GRUB_KEYBOARD_KEY_C, GRUB_KEYBOARD_KEY_V, ++ /* 0x30 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_N, ++ /* 0x32 */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_COMMA, ++ /* 0x34 */ GRUB_KEYBOARD_KEY_DOT, GRUB_KEYBOARD_KEY_SLASH, ++ /* 0x36 */ GRUB_KEYBOARD_KEY_RIGHT_SHIFT, GRUB_KEYBOARD_KEY_NUMMUL, ++ /* 0x38 */ GRUB_KEYBOARD_KEY_LEFT_ALT, GRUB_KEYBOARD_KEY_SPACE, ++ /* 0x3a */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_F1, ++ /* 0x3c */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F3, ++ /* 0x3e */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_F5, ++ /* 0x40 */ GRUB_KEYBOARD_KEY_F6, GRUB_KEYBOARD_KEY_F7, ++ /* 0x42 */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F9, ++ /* 0x44 */ GRUB_KEYBOARD_KEY_F10, GRUB_KEYBOARD_KEY_NUM_LOCK, ++ /* 0x46 */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, GRUB_KEYBOARD_KEY_NUM7, ++ /* 0x48 */ GRUB_KEYBOARD_KEY_NUM8, GRUB_KEYBOARD_KEY_NUM9, ++ /* 0x4a */ GRUB_KEYBOARD_KEY_NUMMINUS, GRUB_KEYBOARD_KEY_NUM4, ++ /* 0x4c */ GRUB_KEYBOARD_KEY_NUM5, GRUB_KEYBOARD_KEY_NUM6, ++ /* 0x4e */ GRUB_KEYBOARD_KEY_NUMPLUS, GRUB_KEYBOARD_KEY_NUM1, ++ /* 0x50 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM3, ++ /* 0x52 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, ++ /* 0x54 */ 0, 0, ++ /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, ++ /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, ++ /* 0x5a */ 0, 0, ++ /* 0x5c */ 0, 0, ++ /* 0x5e */ 0, 0, ++ /* 0x60 */ 0, 0, ++ /* 0x62 */ 0, 0, ++ /* OLPC keys. Just mapped to normal keys. */ ++ /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, ++ /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, ++ /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, ++ /* 0x6a */ 0, 0, ++ /* 0x6c */ 0, 0, ++ /* 0x6e */ 0, 0, ++ /* 0x70 */ 0, 0, ++ /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, ++ /* 0x74 */ 0, 0, ++ /* 0x76 */ 0, 0, ++ /* 0x78 */ 0, 0, ++ /* 0x7a */ 0, 0, ++ /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, ++ /* 0x7e */ GRUB_KEYBOARD_KEY_KPCOMMA ++ }; ++ ++static const struct ++{ ++ grub_uint8_t from, to; ++} set1_e0_mapping[] = ++ { ++ {0x1c, GRUB_KEYBOARD_KEY_NUMENTER}, ++ {0x1d, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, ++ {0x35, GRUB_KEYBOARD_KEY_NUMSLASH }, ++ {0x38, GRUB_KEYBOARD_KEY_RIGHT_ALT}, ++ {0x47, GRUB_KEYBOARD_KEY_HOME}, ++ {0x48, GRUB_KEYBOARD_KEY_UP}, ++ {0x49, GRUB_KEYBOARD_KEY_PPAGE}, ++ {0x4b, GRUB_KEYBOARD_KEY_LEFT}, ++ {0x4d, GRUB_KEYBOARD_KEY_RIGHT}, ++ {0x4f, GRUB_KEYBOARD_KEY_END}, ++ {0x50, GRUB_KEYBOARD_KEY_DOWN}, ++ {0x51, GRUB_KEYBOARD_KEY_NPAGE}, ++ {0x52, GRUB_KEYBOARD_KEY_INSERT}, ++ {0x53, GRUB_KEYBOARD_KEY_DELETE}, ++ }; ++ ++static const grub_uint8_t set2_mapping[256] = ++ { ++ /* 0x00 */ 0, GRUB_KEYBOARD_KEY_F9, ++ /* 0x02 */ 0, GRUB_KEYBOARD_KEY_F5, ++ /* 0x04 */ GRUB_KEYBOARD_KEY_F3, GRUB_KEYBOARD_KEY_F1, ++ /* 0x06 */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F12, ++ /* 0x08 */ 0, GRUB_KEYBOARD_KEY_F10, ++ /* 0x0a */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F6, ++ /* 0x0c */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_TAB, ++ /* 0x0e */ GRUB_KEYBOARD_KEY_RQUOTE, 0, ++ /* 0x10 */ 0, GRUB_KEYBOARD_KEY_LEFT_ALT, ++ /* 0x12 */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, 0, ++ /* 0x14 */ GRUB_KEYBOARD_KEY_LEFT_CTRL, GRUB_KEYBOARD_KEY_Q, ++ /* 0x16 */ GRUB_KEYBOARD_KEY_1, 0, ++ /* 0x18 */ 0, 0, ++ /* 0x1a */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_S, ++ /* 0x1c */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_W, ++ /* 0x1e */ GRUB_KEYBOARD_KEY_2, 0, ++ /* 0x20 */ 0, GRUB_KEYBOARD_KEY_C, ++ /* 0x22 */ GRUB_KEYBOARD_KEY_X, GRUB_KEYBOARD_KEY_D, ++ /* 0x24 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_4, ++ /* 0x26 */ GRUB_KEYBOARD_KEY_3, 0, ++ /* 0x28 */ 0, GRUB_KEYBOARD_KEY_SPACE, ++ /* 0x2a */ GRUB_KEYBOARD_KEY_V, GRUB_KEYBOARD_KEY_F, ++ /* 0x2c */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_R, ++ /* 0x2e */ GRUB_KEYBOARD_KEY_5, 0, ++ /* 0x30 */ 0, GRUB_KEYBOARD_KEY_N, ++ /* 0x32 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_H, ++ /* 0x34 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_Y, ++ /* 0x36 */ GRUB_KEYBOARD_KEY_6, 0, ++ /* 0x38 */ 0, 0, ++ /* 0x3a */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_J, ++ /* 0x3c */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_7, ++ /* 0x3e */ GRUB_KEYBOARD_KEY_8, 0, ++ /* 0x40 */ 0, GRUB_KEYBOARD_KEY_COMMA, ++ /* 0x42 */ GRUB_KEYBOARD_KEY_K, GRUB_KEYBOARD_KEY_I, ++ /* 0x44 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_0, ++ /* 0x46 */ GRUB_KEYBOARD_KEY_9, 0, ++ /* 0x48 */ 0, GRUB_KEYBOARD_KEY_DOT, ++ /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, ++ /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, ++ /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, ++ /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, ++ /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, ++ /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, ++ /* 0x56 */ 0, 0, ++ /* 0x58 */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_RIGHT_SHIFT, ++ /* 0x5a */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_RBRACKET, ++ /* 0x5c */ 0, GRUB_KEYBOARD_KEY_BACKSLASH, ++ /* 0x5e */ 0, 0, ++ /* 0x60 */ 0, GRUB_KEYBOARD_KEY_102ND, ++ /* 0x62 */ 0, 0, ++ /* 0x64 */ 0, 0, ++ /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, ++ /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, ++ /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, ++ /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, GRUB_KEYBOARD_KEY_KPCOMMA, ++ /* 0x6e */ 0, 0, ++ /* 0x70 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, ++ /* 0x72 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM5, ++ /* 0x74 */ GRUB_KEYBOARD_KEY_NUM6, GRUB_KEYBOARD_KEY_NUM8, ++ /* 0x76 */ GRUB_KEYBOARD_KEY_ESCAPE, GRUB_KEYBOARD_KEY_NUM_LOCK, ++ /* 0x78 */ GRUB_KEYBOARD_KEY_F11, GRUB_KEYBOARD_KEY_NUMPLUS, ++ /* 0x7a */ GRUB_KEYBOARD_KEY_NUM3, GRUB_KEYBOARD_KEY_NUMMINUS, ++ /* 0x7c */ GRUB_KEYBOARD_KEY_NUMMUL, GRUB_KEYBOARD_KEY_NUM9, ++ /* 0x7e */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, 0, ++ /* 0x80 */ 0, 0, ++ /* 0x82 */ 0, GRUB_KEYBOARD_KEY_F7, ++ }; ++ ++static const struct ++{ ++ grub_uint8_t from, to; ++} set2_e0_mapping[] = ++ { ++ {0x11, GRUB_KEYBOARD_KEY_RIGHT_ALT}, ++ {0x14, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, ++ {0x4a, GRUB_KEYBOARD_KEY_NUMSLASH}, ++ {0x5a, GRUB_KEYBOARD_KEY_NUMENTER}, ++ {0x69, GRUB_KEYBOARD_KEY_END}, ++ {0x6b, GRUB_KEYBOARD_KEY_LEFT}, ++ {0x6c, GRUB_KEYBOARD_KEY_HOME}, ++ {0x70, GRUB_KEYBOARD_KEY_INSERT}, ++ {0x71, GRUB_KEYBOARD_KEY_DELETE}, ++ {0x72, GRUB_KEYBOARD_KEY_DOWN}, ++ {0x74, GRUB_KEYBOARD_KEY_RIGHT}, ++ {0x75, GRUB_KEYBOARD_KEY_UP}, ++ {0x7a, GRUB_KEYBOARD_KEY_NPAGE}, ++ {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, ++ }; ++ ++static int ++fetch_key (struct grub_ps2_state *ps2_state, grub_uint8_t at_key, int *is_break) ++{ ++ int was_ext = 0; ++ int ret = 0; ++ ++ /* May happen if no keyboard is connected. Just ignore this. */ ++ if (at_key == 0xff) ++ return -1; ++ if (at_key == 0xe0) ++ { ++ ps2_state->e0_received = 1; ++ return -1; ++ } ++ ++ if ((ps2_state->current_set == 2 || ps2_state->current_set == 3) && at_key == 0xf0) ++ { ++ ps2_state->f0_received = 1; ++ return -1; ++ } ++ ++ /* Setting LEDs may generate ACKs. */ ++ if (at_key == GRUB_AT_ACK) ++ return -1; ++ ++ was_ext = ps2_state->e0_received; ++ ps2_state->e0_received = 0; ++ ++ switch (ps2_state->current_set) ++ { ++ case 1: ++ *is_break = !!(at_key & 0x80); ++ if (!was_ext) ++ ret = set1_mapping[at_key & 0x7f]; ++ else ++ { ++ unsigned i; ++ for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++) ++ if (set1_e0_mapping[i].from == (at_key & 0x7f)) ++ { ++ ret = set1_e0_mapping[i].to; ++ break; ++ } ++ } ++ break; ++ case 2: ++ *is_break = ps2_state->f0_received; ++ ps2_state->f0_received = 0; ++ if (!was_ext) ++ ret = set2_mapping[at_key]; ++ else ++ { ++ unsigned i; ++ for (i = 0; i < ARRAY_SIZE (set2_e0_mapping); i++) ++ if (set2_e0_mapping[i].from == at_key) ++ { ++ ret = set2_e0_mapping[i].to; ++ break; ++ } ++ } ++ break; ++ default: ++ return -1; ++ } ++ if (!ret) ++ { ++ if (was_ext) ++ grub_dprintf ("atkeyb", "Unknown key 0xe0+0x%02x from set %d\n", ++ at_key, ps2_state->current_set); ++ else ++ grub_dprintf ("atkeyb", "Unknown key 0x%02x from set %d\n", ++ at_key, ps2_state->current_set); ++ return -1; ++ } ++ return ret; ++} ++ ++/* FIXME: This should become an interrupt service routine. For now ++ it's just used to catch events from control keys. */ ++static int ++grub_keyboard_isr (struct grub_ps2_state *ps2_state, ++ grub_keyboard_key_t key, int is_break) ++{ ++ if (!is_break) ++ switch (key) ++ { ++ case GRUB_KEYBOARD_KEY_LEFT_SHIFT: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_LEFT_CTRL: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LCTRL; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_CTRL: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RCTRL; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_ALT: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RALT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_LEFT_ALT: ++ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LALT; ++ return 1; ++ default: ++ return 0; ++ } ++ else ++ switch (key) ++ { ++ case GRUB_KEYBOARD_KEY_LEFT_SHIFT: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_LEFT_CTRL: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_CTRL: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RCTRL; ++ return 1; ++ case GRUB_KEYBOARD_KEY_RIGHT_ALT: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RALT; ++ return 1; ++ case GRUB_KEYBOARD_KEY_LEFT_ALT: ++ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LALT; ++ return 1; ++ default: ++ return 0; ++ } ++} ++ ++/* If there is a key pending, return it; otherwise return GRUB_TERM_NO_KEY. */ ++int ++grub_ps2_process_incoming_byte (struct grub_ps2_state *ps2_state, ++ grub_uint8_t at_key) ++{ ++ int code; ++ int is_break = 0; ++ ++ code = fetch_key (ps2_state, at_key, &is_break); ++ if (code == -1) ++ return GRUB_TERM_NO_KEY; ++ ++ if (grub_keyboard_isr (ps2_state, code, is_break)) ++ return GRUB_TERM_NO_KEY; ++ if (is_break) ++ return GRUB_TERM_NO_KEY; ++#ifdef DEBUG_AT_KEYBOARD ++ grub_dprintf ("atkeyb", "Detected key 0x%x\n", code); ++#endif ++ switch (code) ++ { ++ case GRUB_KEYBOARD_KEY_CAPS_LOCK: ++ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_CAPS; ++ ps2_state->led_status ^= KEYBOARD_LED_CAPS; ++ ++#ifdef DEBUG_AT_KEYBOARD ++ grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(ps2_state->at_keyboard_status & GRUB_KEYBOARD_STATUS_CAPS_LOCK)); ++#endif ++ return GRUB_TERM_NO_KEY; ++ case GRUB_KEYBOARD_KEY_NUM_LOCK: ++ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_NUM; ++ ps2_state->led_status ^= KEYBOARD_LED_NUM; ++ ++#ifdef DEBUG_AT_KEYBOARD ++ grub_dprintf ("atkeyb", "num_lock = %d\n", !!(ps2_state->at_keyboard_status & GRUB_KEYBOARD_STATUS_NUM_LOCK)); ++#endif ++ return GRUB_TERM_NO_KEY; ++ case GRUB_KEYBOARD_KEY_SCROLL_LOCK: ++ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_SCROLL; ++ ps2_state->led_status ^= KEYBOARD_LED_SCROLL; ++ return GRUB_TERM_NO_KEY; ++ default: ++ return grub_term_map_key (code, ps2_state->at_keyboard_status); ++ } ++} +diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h +index b4f8ff0a0..b031523eb 100644 +--- a/include/grub/at_keyboard.h ++++ b/include/grub/at_keyboard.h +@@ -27,10 +27,6 @@ + + #define KEYBOARD_AT_TRANSLATE 0x40 + +-#define GRUB_AT_ACK 0xfa +-#define GRUB_AT_NACK 0xfe +-#define GRUB_AT_TRIES 5 +- + #define KEYBOARD_ISMAKE(x) !((x) & 0x80) + #define KEYBOARD_ISREADY(x) ((x) & 0x01) + #define KEYBOARD_SCANCODE(x) ((x) & 0x7f) +diff --git a/include/grub/ps2.h b/include/grub/ps2.h +new file mode 100644 +index 000000000..4f2e527e4 +--- /dev/null ++++ b/include/grub/ps2.h +@@ -0,0 +1,43 @@ ++/* ++ * 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 . ++ */ ++ ++#ifndef GRUB_PS2_HEADER ++#define GRUB_PS2_HEADER 1 ++ ++#include ++ ++#define GRUB_AT_ACK 0xfa ++#define GRUB_AT_NACK 0xfe ++#define GRUB_AT_TRIES 5 ++ ++/* Make sure it's zeroed-out and set current_set at init. */ ++struct grub_ps2_state ++{ ++ int e0_received; ++ int f0_received; ++ grub_uint8_t led_status; ++ short at_keyboard_status; ++ grub_uint8_t current_set; ++}; ++ ++/* If there is a key pending, return it; otherwise return GRUB_TERM_NO_KEY. */ ++int ++grub_ps2_process_incoming_byte (struct grub_ps2_state *ps2_state, ++ grub_uint8_t data); ++ ++#endif +-- +2.13.0 + diff --git a/0024-arm_coreboot-Support-keyboard-for-vexpress.patch b/0024-arm_coreboot-Support-keyboard-for-vexpress.patch new file mode 100644 index 00000000..5d44033e --- /dev/null +++ b/0024-arm_coreboot-Support-keyboard-for-vexpress.patch @@ -0,0 +1,249 @@ +From 848bed9d92cf20e9f25db4c69a20efad23996ca0 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:42:37 +0200 +Subject: [PATCH 024/176] arm_coreboot: Support keyboard for vexpress. + +--- + grub-core/Makefile.am | 1 + + grub-core/Makefile.core.def | 3 + + grub-core/kern/arm/coreboot/init.c | 1 + + grub-core/term/arm/pl050.c | 189 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 194 insertions(+) + create mode 100644 grub-core/term/arm/pl050.c + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 147e6959c..a2aaf9f54 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -240,6 +240,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h + endif + + if COND_arm_coreboot ++KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6ade6e950..6be6e7f61 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -160,6 +160,9 @@ kernel = { + arm_coreboot = kern/arm/coreboot/coreboot.S; + arm_coreboot = lib/fdt.c; + arm_coreboot = bus/fdt.c; ++ arm_coreboot = term/ps2.c; ++ arm_coreboot = term/arm/pl050.c; ++ arm_coreboot = commands/keylayouts.c; + + terminfoinkernel = term/terminfo.c; + terminfoinkernel = term/tparm.c; +diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c +index aec75c672..a06ccb72f 100644 +--- a/grub-core/kern/arm/coreboot/init.c ++++ b/grub-core/kern/arm/coreboot/init.c +@@ -133,6 +133,7 @@ grub_machine_init (void) + grub_fdtbus_init (dtb, dtb_size); + + grub_machine_timer_init (); ++ grub_pl050_init (); + } + + void +diff --git a/grub-core/term/arm/pl050.c b/grub-core/term/arm/pl050.c +new file mode 100644 +index 000000000..e4cda3056 +--- /dev/null ++++ b/grub-core/term/arm/pl050.c +@@ -0,0 +1,189 @@ ++/* ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static volatile grub_uint32_t *pl050_regs; ++ ++struct grub_ps2_state ps2_state; ++ ++static void ++keyboard_controller_wait_until_ready (void) ++{ ++ while (! (pl050_regs[1] & 0x40)); ++} ++ ++static grub_uint8_t ++wait_ack (void) ++{ ++ grub_uint64_t endtime; ++ grub_uint8_t ack; ++ ++ endtime = grub_get_time_ms () + 20; ++ do ++ ack = pl050_regs[2]; ++ while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK ++ && grub_get_time_ms () < endtime); ++ return ack; ++} ++ ++ ++static int ++write_mode (int mode) ++{ ++ unsigned i; ++ for (i = 0; i < GRUB_AT_TRIES; i++) ++ { ++ grub_uint8_t ack; ++ keyboard_controller_wait_until_ready (); ++ pl050_regs[2] = 0xf0; ++ keyboard_controller_wait_until_ready (); ++ pl050_regs[2] = mode; ++ keyboard_controller_wait_until_ready (); ++ ack = wait_ack (); ++ if (ack == GRUB_AT_NACK) ++ continue; ++ if (ack == GRUB_AT_ACK) ++ break; ++ return 0; ++ } ++ ++ return (i != GRUB_AT_TRIES); ++} ++ ++static int ++query_mode (void) ++{ ++ grub_uint8_t ret; ++ int e; ++ ++ e = write_mode (0); ++ if (!e) ++ return 0; ++ ++ keyboard_controller_wait_until_ready (); ++ ++ do ++ ret = pl050_regs[2]; ++ while (ret == GRUB_AT_ACK); ++ ++ /* QEMU translates the set even in no-translate mode. */ ++ if (ret == 0x43 || ret == 1) ++ return 1; ++ if (ret == 0x41 || ret == 2) ++ return 2; ++ if (ret == 0x3f || ret == 3) ++ return 3; ++ return 0; ++} ++ ++static void ++set_scancodes (void) ++{ ++ write_mode (2); ++ ps2_state.current_set = query_mode (); ++ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); ++ if (ps2_state.current_set == 2) ++ return; ++ ++ write_mode (1); ++ ps2_state.current_set = query_mode (); ++ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); ++ if (ps2_state.current_set == 1) ++ return; ++ grub_dprintf ("atkeyb", "no supported scancode set found\n"); ++} ++ ++static void ++keyboard_controller_led (grub_uint8_t leds) ++{ ++ keyboard_controller_wait_until_ready (); ++ pl050_regs[2] = 0xed; ++ keyboard_controller_wait_until_ready (); ++ pl050_regs[2] = leds & 0x7; ++} ++ ++/* If there is a character pending, return it; ++ otherwise return GRUB_TERM_NO_KEY. */ ++static int ++grub_pl050_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) ++{ ++ grub_uint8_t at_key; ++ int ret; ++ grub_uint8_t old_led; ++ ++ if (!(pl050_regs[1] & 0x10)) ++ return -1; ++ at_key = pl050_regs[2]; ++ old_led = ps2_state.led_status; ++ ++ ret = grub_ps2_process_incoming_byte (&ps2_state, at_key); ++ if (old_led != ps2_state.led_status) ++ keyboard_controller_led (ps2_state.led_status); ++ return ret; ++} ++ ++static struct grub_term_input grub_pl050_keyboard_term = ++ { ++ .name = "pl050_keyboard", ++ .getkey = grub_pl050_keyboard_getkey ++ }; ++ ++static grub_err_t ++pl050_attach(const struct grub_fdtbus_dev *dev) ++{ ++ const grub_uint32_t *reg; ++ reg = grub_fdtbus_get_prop (dev, "reg", 0); ++ ++ /* Mouse. Nothing to do. */ ++ if (grub_be_to_cpu32 (*reg) == 0x7000) ++ return 0; ++ ++ pl050_regs = grub_fdtbus_map_reg (dev, 0, 0); ++ ++ if (!grub_fdtbus_is_mapping_valid (pl050_regs)) ++ return grub_error (GRUB_ERR_IO, "could not map pl050"); ++ ++ ps2_state.at_keyboard_status = 0; ++ set_scancodes (); ++ keyboard_controller_led (ps2_state.led_status); ++ ++ grub_term_register_input ("pl050_keyboard", &grub_pl050_keyboard_term); ++ return GRUB_ERR_NONE; ++} ++ ++struct grub_fdtbus_driver pl050 = ++{ ++ .compatible = "arm,pl050", ++ .attach = pl050_attach ++}; ++ ++void ++grub_pl050_init (void) ++{ ++ grub_fdtbus_register (&pl050); ++} +-- +2.13.0 + diff --git a/0025-arm_coreboot-Support-grub-mkstandalone.patch b/0025-arm_coreboot-Support-grub-mkstandalone.patch new file mode 100644 index 00000000..c2f6f90d --- /dev/null +++ b/0025-arm_coreboot-Support-grub-mkstandalone.patch @@ -0,0 +1,158 @@ +From 3edabad8fefb112cc4b2d43be6e97d43c909ceee Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 21:59:48 +0200 +Subject: [PATCH 025/176] arm_coreboot: Support grub-mkstandalone. + +--- + include/grub/util/install.h | 6 +++++- + util/grub-install-common.c | 12 ++++++++++-- + util/grub-install.c | 7 +++++++ + 3 files changed, 22 insertions(+), 3 deletions(-) + +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index 6abd288c3..5910b0c09 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -29,6 +29,8 @@ + #define GRUB_INSTALL_OPTIONS \ + { "modules", GRUB_INSTALL_OPTIONS_MODULES, N_("MODULES"), \ + 0, N_("pre-load specified modules MODULES"), 1 }, \ ++ { "dtb", GRUB_INSTALL_OPTIONS_DTB, N_("FILE"), \ ++ 0, N_("embed a specific DTB"), 1 }, \ + { "install-modules", GRUB_INSTALL_OPTIONS_INSTALL_MODULES, \ + N_("MODULES"), 0, \ + N_("install only MODULES and their dependencies [default=all]"), 1 }, \ +@@ -99,6 +101,7 @@ enum grub_install_plat + GRUB_INSTALL_PLATFORM_I386_XEN, + GRUB_INSTALL_PLATFORM_X86_64_XEN, + GRUB_INSTALL_PLATFORM_ARM64_EFI, ++ GRUB_INSTALL_PLATFORM_ARM_COREBOOT, + GRUB_INSTALL_PLATFORM_MAX + }; + +@@ -115,7 +118,8 @@ enum grub_install_options { + GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, + GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, + GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, +- GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS ++ GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, ++ GRUB_INSTALL_OPTIONS_DTB + }; + + extern char *grub_install_source_directory; +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index 8539ff348..9e3e358c9 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -73,6 +73,7 @@ grub_install_help_filter (int key, const char *text, + + static int (*compress_func) (const char *src, const char *dest) = NULL; + char *grub_install_copy_buffer; ++static char *dtb; + + int + grub_install_copy_file (const char *src, +@@ -364,6 +365,11 @@ grub_install_parse (int key, char *arg) + case GRUB_INSTALL_OPTIONS_INSTALL_FONTS: + handle_install_list (&install_fonts, arg, 0); + return 1; ++ case GRUB_INSTALL_OPTIONS_DTB: ++ if (dtb) ++ free (dtb); ++ dtb = xstrdup (arg); ++ return 1; + case GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS: + if (strcmp (arg, "no") == 0 + || strcmp (arg, "none") == 0) +@@ -486,9 +492,10 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + + grub_util_info ("grub-mkimage --directory '%s' --prefix '%s'" + " --output '%s' " ++ " --dtb '%s' " + "--format '%s' --compression '%s' %s %s\n", + dir, prefix, +- outname, mkimage_target, ++ outname, dtb ? : "", mkimage_target, + compnames[compression], note ? "--note" : "", s); + free (s); + +@@ -499,7 +506,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_install_generate_image (dir, prefix, fp, outname, + modules.entries, memdisk_path, + pubkeys, npubkeys, config_path, tgt, +- note, compression, 0); ++ note, compression, dtb); + while (dc--) + grub_install_pop_module (); + } +@@ -666,6 +673,7 @@ static struct + [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, + [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, ++ [GRUB_INSTALL_PLATFORM_ARM_COREBOOT] = { "arm", "coreboot" }, + }; + + char * +diff --git a/util/grub-install.c b/util/grub-install.c +index 9074d3e9e..75e3e5ba6 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -486,6 +486,7 @@ have_bootdev (enum grub_install_plat pl) + + case GRUB_INSTALL_PLATFORM_I386_QEMU: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: +@@ -911,6 +912,7 @@ main (int argc, char *argv[]) + + case GRUB_INSTALL_PLATFORM_I386_QEMU: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: +@@ -946,6 +948,7 @@ main (int argc, char *argv[]) + case GRUB_INSTALL_PLATFORM_ARM_UBOOT: + case GRUB_INSTALL_PLATFORM_I386_QEMU: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: +@@ -1448,6 +1451,7 @@ main (int argc, char *argv[]) + case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: + case GRUB_INSTALL_PLATFORM_I386_QEMU: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: +@@ -1542,6 +1546,7 @@ main (int argc, char *argv[]) + break; + + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_I386_IEEE1275: + case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275: +@@ -1629,6 +1634,7 @@ main (int argc, char *argv[]) + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_I386_PC: + case GRUB_INSTALL_PLATFORM_MIPSEL_ARC: +@@ -1889,6 +1895,7 @@ main (int argc, char *argv[]) + case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: + case GRUB_INSTALL_PLATFORM_I386_COREBOOT: ++ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: + case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: + case GRUB_INSTALL_PLATFORM_MIPSEL_ARC: + case GRUB_INSTALL_PLATFORM_ARM_UBOOT: +-- +2.13.0 + diff --git a/0026-arm_coreboot-Support-loading-linux-images.patch b/0026-arm_coreboot-Support-loading-linux-images.patch new file mode 100644 index 00000000..7897491c --- /dev/null +++ b/0026-arm_coreboot-Support-loading-linux-images.patch @@ -0,0 +1,302 @@ +From 656c3b0d7fbe23f0e1ab561c8faa4ac4a37364d1 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 22:00:06 +0200 +Subject: [PATCH 026/176] arm_coreboot: Support loading linux images. + +--- + grub-core/loader/arm/linux.c | 132 ++++++++++++++++++++++--------------------- + include/grub/arm/linux.h | 16 ++++++ + 2 files changed, 83 insertions(+), 65 deletions(-) + +diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c +index 01374ee78..260cbf068 100644 +--- a/grub-core/loader/arm/linux.c ++++ b/grub-core/loader/arm/linux.c +@@ -31,8 +31,6 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-#ifndef GRUB_MACHINE_COREBOOT +- + static grub_dl_t my_mod; + + static grub_addr_t initrd_start; +@@ -44,7 +42,7 @@ static grub_size_t linux_size; + static char *linux_args; + + static grub_uint32_t machine_type; +-static void *fdt_addr; ++static const void *current_fdt; + + typedef void (*kernel_entry_t) (int, unsigned long, void *); + +@@ -56,9 +54,9 @@ typedef void (*kernel_entry_t) (int, unsigned long, void *); + #define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) + + static grub_size_t +-get_atag_size (grub_uint32_t *atag) ++get_atag_size (const grub_uint32_t *atag) + { +- grub_uint32_t *atag0 = atag; ++ const grub_uint32_t *atag0 = atag; + while (atag[0] && atag[1]) + atag += atag[0]; + return atag - atag0; +@@ -70,10 +68,11 @@ get_atag_size (grub_uint32_t *atag) + * Merges in command line parameters and sets up initrd addresses. + */ + static grub_err_t +-linux_prepare_atag (void) ++linux_prepare_atag (void *target_atag) + { +- grub_uint32_t *atag_orig = (grub_uint32_t *) fdt_addr; +- grub_uint32_t *tmp_atag, *from, *to; ++ const grub_uint32_t *atag_orig = (const grub_uint32_t *) current_fdt; ++ grub_uint32_t *tmp_atag, *to; ++ const grub_uint32_t *from; + grub_size_t tmp_size; + grub_size_t arg_size = grub_strlen (linux_args); + char *cmdline_orig = NULL; +@@ -144,7 +143,7 @@ linux_prepare_atag (void) + to += 2; + + /* Copy updated FDT to its launch location */ +- grub_memcpy (atag_orig, tmp_atag, sizeof (grub_uint32_t) * (to - tmp_atag)); ++ grub_memcpy (target_atag, tmp_atag, sizeof (grub_uint32_t) * (to - tmp_atag)); + grub_free (tmp_atag); + + grub_dprintf ("loader", "ATAG updated for Linux boot\n"); +@@ -158,19 +157,19 @@ linux_prepare_atag (void) + * Merges in command line parameters and sets up initrd addresses. + */ + static grub_err_t +-linux_prepare_fdt (void) ++linux_prepare_fdt (void *target_fdt) + { + int node; + int retval; + int tmp_size; + void *tmp_fdt; + +- tmp_size = grub_fdt_get_totalsize (fdt_addr) + 0x100 + grub_strlen (linux_args); ++ tmp_size = grub_fdt_get_totalsize (current_fdt) + 0x100 + grub_strlen (linux_args); + tmp_fdt = grub_malloc (tmp_size); + if (!tmp_fdt) + return grub_errno; + +- grub_memcpy (tmp_fdt, fdt_addr, grub_fdt_get_totalsize (fdt_addr)); ++ grub_memcpy (tmp_fdt, current_fdt, grub_fdt_get_totalsize (current_fdt)); + grub_fdt_set_totalsize (tmp_fdt, tmp_size); + + /* Find or create '/chosen' node */ +@@ -211,7 +210,7 @@ linux_prepare_fdt (void) + } + + /* Copy updated FDT to its launch location */ +- grub_memcpy (fdt_addr, tmp_fdt, tmp_size); ++ grub_memcpy (target_fdt, tmp_fdt, tmp_size); + grub_free (tmp_fdt); + + grub_dprintf ("loader", "FDT updated for Linux boot\n"); +@@ -228,16 +227,17 @@ linux_boot (void) + { + kernel_entry_t linuxmain; + int fdt_valid, atag_valid; ++ void *target_fdt = 0; + +- fdt_valid = (fdt_addr && grub_fdt_check_header_nosize (fdt_addr) == 0); +- atag_valid = ((((grub_uint16_t *) fdt_addr)[3] & ~3) == 0x5440 +- && *((grub_uint32_t *) fdt_addr)); ++ fdt_valid = (current_fdt && grub_fdt_check_header_nosize (current_fdt) == 0); ++ atag_valid = ((((const grub_uint16_t *) current_fdt)[3] & ~3) == 0x5440 ++ && *((const grub_uint32_t *) current_fdt)); + grub_dprintf ("loader", "atag: %p, %x, %x, %s, %s\n", +- fdt_addr, +- ((grub_uint16_t *) fdt_addr)[3], +- *((grub_uint32_t *) fdt_addr), +- (char *) fdt_addr, +- (char *) fdt_addr + 1); ++ current_fdt, ++ ((const grub_uint16_t *) current_fdt)[3], ++ *((const grub_uint32_t *) current_fdt), ++ (const char *) current_fdt, ++ (const char *) current_fdt + 1); + + if (!fdt_valid && machine_type == GRUB_ARM_MACHINE_TYPE_FDT) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, +@@ -247,23 +247,40 @@ linux_boot (void) + + grub_dprintf ("loader", "Kernel at: 0x%x\n", linux_addr); + ++ if (fdt_valid || atag_valid) ++ { ++#ifdef GRUB_MACHINE_EFI ++ grub_size_t size; ++ if (fdt_valid) ++ size = grub_fdt_get_totalsize (fdt_addr); ++ else ++ size = 4 * get_atag_size (atag_orig); ++ size += grub_strlen (linux_args) + 256; ++ target_fdt = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); ++ if (!fdt_addr) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++#else ++ target_fdt = (void *) LINUX_FDT_ADDRESS; ++#endif ++ } ++ + if (fdt_valid) + { + grub_err_t err; + +- err = linux_prepare_fdt (); ++ err = linux_prepare_fdt (target_fdt); + if (err) + return err; +- grub_dprintf ("loader", "FDT @ 0x%p\n", fdt_addr); ++ grub_dprintf ("loader", "FDT @ %p\n", target_fdt); + } + else if (atag_valid) + { + grub_err_t err; + +- err = linux_prepare_atag (); ++ err = linux_prepare_atag (target_fdt); + if (err) + return err; +- grub_dprintf ("loader", "ATAG @ 0x%p\n", fdt_addr); ++ grub_dprintf ("loader", "ATAG @ %p\n", target_fdt); + } + + grub_dprintf ("loader", "Jumping to Linux...\n"); +@@ -287,7 +304,7 @@ linux_boot (void) + + grub_arm_disable_caches_mmu (); + +- linuxmain (0, machine_type, fdt_addr); ++ linuxmain (0, machine_type, target_fdt); + + return grub_error (GRUB_ERR_BAD_OS, "Linux call returned"); + } +@@ -446,11 +463,26 @@ fail: + static grub_err_t + load_dtb (grub_file_t dtb, int size) + { +- if ((grub_file_read (dtb, fdt_addr, size) != size) +- || (grub_fdt_check_header (fdt_addr, size) != 0)) +- return grub_error (GRUB_ERR_BAD_OS, N_("invalid device tree")); ++ void *new_fdt = grub_zalloc (size); ++ if (!new_fdt) ++ return grub_errno; ++ grub_dprintf ("loader", "Loading device tree to %p\n", ++ new_fdt); ++ if ((grub_file_read (dtb, new_fdt, size) != size) ++ || (grub_fdt_check_header (new_fdt, size) != 0)) ++ { ++ grub_free (new_fdt); ++ return grub_error (GRUB_ERR_BAD_OS, N_("invalid device tree")); ++ } ++ ++ grub_fdt_set_totalsize (new_fdt, size); ++ current_fdt = new_fdt; ++ /* ++ * We've successfully loaded an FDT, so any machine type passed ++ * from firmware is now obsolete. ++ */ ++ machine_type = GRUB_ARM_MACHINE_TYPE_FDT; + +- grub_fdt_set_totalsize (fdt_addr, size); + return GRUB_ERR_NONE; + } + +@@ -466,42 +498,13 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)), + + dtb = grub_file_open (argv[0]); + if (!dtb) +- goto out; ++ return grub_errno; + + size = grub_file_size (dtb); + if (size == 0) +- { +- grub_error (GRUB_ERR_BAD_OS, "empty file"); +- goto out; +- } +- +-#ifdef GRUB_MACHINE_EFI +- fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); +- if (!fdt_addr) +- { +- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); +- goto out; +- } +-#else +- fdt_addr = (void *) LINUX_FDT_ADDRESS; +-#endif +- +- grub_dprintf ("loader", "Loading device tree to 0x%08x\n", +- (grub_addr_t) fdt_addr); +- load_dtb (dtb, size); +- if (grub_errno != GRUB_ERR_NONE) +- { +- fdt_addr = NULL; +- goto out; +- } +- +- /* +- * We've successfully loaded an FDT, so any machine type passed +- * from firmware is now obsolete. +- */ +- machine_type = GRUB_ARM_MACHINE_TYPE_FDT; +- +- out: ++ grub_error (GRUB_ERR_BAD_OS, "empty file"); ++ else ++ load_dtb (dtb, size); + grub_file_close (dtb); + + return grub_errno; +@@ -519,7 +522,7 @@ GRUB_MOD_INIT (linux) + /* TRANSLATORS: DTB stands for device tree blob. */ + 0, N_("Load DTB file.")); + my_mod = mod; +- fdt_addr = (void *) grub_arm_firmware_get_boot_data (); ++ current_fdt = grub_arm_firmware_get_boot_data (); + machine_type = grub_arm_firmware_get_machine_type (); + } + +@@ -529,4 +532,3 @@ GRUB_MOD_FINI (linux) + grub_unregister_command (cmd_initrd); + grub_unregister_command (cmd_devicetree); + } +-#endif +diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h +index a66caad13..f217f8281 100644 +--- a/include/grub/arm/linux.h ++++ b/include/grub/arm/linux.h +@@ -46,6 +46,22 @@ grub_arm_firmware_get_machine_type (void) + { + return GRUB_ARM_MACHINE_TYPE_FDT; + } ++#elif defined (GRUB_MACHINE_COREBOOT) ++#include ++#include ++# define LINUX_ADDRESS (start_of_ram + 0x8000) ++# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000) ++# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) ++static inline const void * ++grub_arm_firmware_get_boot_data (void) ++{ ++ return grub_fdtbus_get_fdt (); ++} ++static inline grub_uint32_t ++grub_arm_firmware_get_machine_type (void) ++{ ++ return GRUB_ARM_MACHINE_TYPE_FDT; ++} + #endif + + #define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 +-- +2.13.0 + diff --git a/0027-arm_coreboot-Support-DMA.patch b/0027-arm_coreboot-Support-DMA.patch new file mode 100644 index 00000000..3f9e4a25 --- /dev/null +++ b/0027-arm_coreboot-Support-DMA.patch @@ -0,0 +1,292 @@ +From 265292f2b0da0eb414c409871ba0f94a99ec33c1 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 22:06:04 +0200 +Subject: [PATCH 027/176] arm_coreboot: Support DMA. + +This is needed to support USB and some other busses. +--- + grub-core/Makefile.am | 1 + + grub-core/Makefile.core.def | 1 + + grub-core/kern/arm/cache.c | 34 ++++++++++++++++++++++ + grub-core/kern/arm/cache_armv7.S | 12 ++++++++ + grub-core/kern/arm/coreboot/dma.c | 59 +++++++++++++++++++++++++++++++++++++++ + include/grub/cache.h | 7 ++--- + include/grub/dma.h | 44 +++++++++++++++++++++++++++++ + include/grub/pci.h | 22 +-------------- + 8 files changed, 155 insertions(+), 25 deletions(-) + create mode 100644 grub-core/kern/arm/coreboot/dma.c + create mode 100644 include/grub/dma.h + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index a2aaf9f54..104513847 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -248,6 +248,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h ++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dma.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h + KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h + endif +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6be6e7f61..e4f253a20 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -163,6 +163,7 @@ kernel = { + arm_coreboot = term/ps2.c; + arm_coreboot = term/arm/pl050.c; + arm_coreboot = commands/keylayouts.c; ++ arm_coreboot = kern/arm/coreboot/dma.c; + + terminfoinkernel = term/terminfo.c; + terminfoinkernel = term/tparm.c; +diff --git a/grub-core/kern/arm/cache.c b/grub-core/kern/arm/cache.c +index 34154ccdb..af1c4bbf5 100644 +--- a/grub-core/kern/arm/cache.c ++++ b/grub-core/kern/arm/cache.c +@@ -29,6 +29,8 @@ void grub_arm_clean_dcache_range_armv6 (grub_addr_t start, grub_addr_t end, + grub_addr_t dlinesz); + void grub_arm_clean_dcache_range_armv7 (grub_addr_t start, grub_addr_t end, + grub_addr_t dlinesz); ++void grub_arm_clean_dcache_range_poc_armv7 (grub_addr_t start, grub_addr_t end, ++ grub_addr_t dlinesz); + void grub_arm_invalidate_icache_range_armv6 (grub_addr_t start, grub_addr_t end, + grub_addr_t dlinesz); + void grub_arm_invalidate_icache_range_armv7 (grub_addr_t start, grub_addr_t end, +@@ -253,6 +255,38 @@ grub_arch_sync_caches (void *address, grub_size_t len) + } + + void ++grub_arch_sync_dma_caches (volatile void *address, grub_size_t len) ++{ ++ grub_addr_t start = (grub_addr_t) address; ++ grub_addr_t end = start + len; ++ ++ if (type == ARCH_UNKNOWN) ++ probe_caches (); ++ start = ALIGN_DOWN (start, grub_arch_cache_max_linesz); ++ end = ALIGN_UP (end, grub_arch_cache_max_linesz); ++ switch (type) ++ { ++ case ARCH_ARMV6: ++ grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz); ++ grub_arm_invalidate_icache_range_armv6 (start, end, ++ grub_arch_cache_ilinesz); ++ break; ++ case ARCH_ARMV5_WRITE_THROUGH: ++ case ARCH_ARMV6_UNIFIED: ++ grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz); ++ break; ++ case ARCH_ARMV7: ++ grub_arm_clean_dcache_range_poc_armv7 (start, end, grub_arch_cache_dlinesz); ++ grub_arm_invalidate_icache_range_armv7 (start, end, ++ grub_arch_cache_ilinesz); ++ break; ++ /* Pacify GCC. */ ++ case ARCH_UNKNOWN: ++ break; ++ } ++} ++ ++void + grub_arm_disable_caches_mmu (void) + { + if (type == ARCH_UNKNOWN) +diff --git a/grub-core/kern/arm/cache_armv7.S b/grub-core/kern/arm/cache_armv7.S +index 1ef2754af..5ae76a3d8 100644 +--- a/grub-core/kern/arm/cache_armv7.S ++++ b/grub-core/kern/arm/cache_armv7.S +@@ -33,6 +33,18 @@ + # define ISB isb + #define ARMV7 1 + ++FUNCTION(grub_arm_clean_dcache_range_poc_armv7) ++ DSB ++ @ Clean data cache for range to point-of-coherence ++1: cmp r0, r1 ++ bge 2f ++ mcr p15, 0, r0, c7, c14, 1 @ DCCMVAC ++ add r0, r0, r2 @ Next line ++ b 1b ++2: DSB ++ bx lr ++ ++ + @ r0 - CLIDR + @ r1 - LoC + @ r2 - current level +diff --git a/grub-core/kern/arm/coreboot/dma.c b/grub-core/kern/arm/coreboot/dma.c +new file mode 100644 +index 000000000..2c2a62789 +--- /dev/null ++++ b/grub-core/kern/arm/coreboot/dma.c +@@ -0,0 +1,59 @@ ++/* ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct grub_pci_dma_chunk * ++grub_memalign_dma32 (grub_size_t align, grub_size_t size) ++{ ++ void *ret; ++ if (align < 64) ++ align = 64; ++ size = ALIGN_UP (size, align); ++ ret = grub_memalign (align, size); ++ if (!ret) ++ return 0; ++ grub_arch_sync_dma_caches (ret, size); ++ return ret; ++} ++ ++void ++grub_dma_free (struct grub_pci_dma_chunk *ch) ++{ ++ grub_size_t size = (((struct grub_mm_header *) ch) - 1)->size * GRUB_MM_ALIGN; ++ grub_arch_sync_dma_caches (ch, size); ++ grub_free (ch); ++} ++ ++volatile void * ++grub_dma_get_virt (struct grub_pci_dma_chunk *ch) ++{ ++ return (void *) ch; ++} ++ ++grub_uint32_t ++grub_dma_get_phys (struct grub_pci_dma_chunk *ch) ++{ ++ return (grub_uint32_t) (grub_addr_t) ch; ++} ++ +diff --git a/include/grub/cache.h b/include/grub/cache.h +index fc669dfd1..1c98ce270 100644 +--- a/include/grub/cache.h ++++ b/include/grub/cache.h +@@ -34,15 +34,14 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len); + #endif + + #ifndef GRUB_MACHINE_EMU +-#ifdef _mips +-void EXPORT_FUNC(grub_arch_sync_dma_caches) (volatile void *address, +- grub_size_t len); +-#else ++#if defined (__i386__) || defined (__x86_64__) + static inline void + grub_arch_sync_dma_caches (volatile void *address __attribute__ ((unused)), + grub_size_t len __attribute__ ((unused))) + { + } ++#else ++void EXPORT_FUNC(grub_arch_sync_dma_caches) (volatile void *address, grub_size_t len); + #endif + #endif + +diff --git a/include/grub/dma.h b/include/grub/dma.h +new file mode 100644 +index 000000000..19992ebc1 +--- /dev/null ++++ b/include/grub/dma.h +@@ -0,0 +1,44 @@ ++/* ++ * 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 . ++ */ ++ ++#ifndef GRUB_DMA_H ++#define GRUB_DMA_H 1 ++ ++struct grub_pci_dma_chunk; ++ ++struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align, ++ grub_size_t size); ++void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch); ++volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch); ++grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch); ++ ++static inline void * ++grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk) ++{ ++ return ((grub_uint8_t *) grub_dma_get_virt (chunk) ++ + (phys - grub_dma_get_phys (chunk))); ++} ++ ++static inline grub_uint32_t ++grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk) ++{ ++ return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk)) ++ + grub_dma_get_phys (chunk)); ++} ++ ++#endif +diff --git a/include/grub/pci.h b/include/grub/pci.h +index 70d9a0513..262c89b74 100644 +--- a/include/grub/pci.h ++++ b/include/grub/pci.h +@@ -142,27 +142,7 @@ grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev, + void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook, + void *hook_data); + +-struct grub_pci_dma_chunk; +- +-struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align, +- grub_size_t size); +-void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch); +-volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch); +-grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch); +- +-static inline void * +-grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk) +-{ +- return ((grub_uint8_t *) grub_dma_get_virt (chunk) +- + (phys - grub_dma_get_phys (chunk))); +-} +- +-static inline grub_uint32_t +-grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk) +-{ +- return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk)) +- + grub_dma_get_phys (chunk)); +-} ++#include + + grub_uint8_t + EXPORT_FUNC (grub_pci_find_capability) (grub_pci_device_t dev, grub_uint8_t cap); +-- +2.13.0 + diff --git a/0028-ehci-Split-core-code-from-PCI-part.patch b/0028-ehci-Split-core-code-from-PCI-part.patch new file mode 100644 index 00000000..8f3ac94a --- /dev/null +++ b/0028-ehci-Split-core-code-from-PCI-part.patch @@ -0,0 +1,571 @@ +From 058df7b5a9cc7aaa9872eaa916b715544a8f9840 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 22:10:26 +0200 +Subject: [PATCH 028/176] ehci: Split core code from PCI part. + +On ARM often EHCI is present without PCI and just declared in device +tree. So splitcore from PCI part. +--- + grub-core/Makefile.core.def | 1 + + grub-core/bus/usb/ehci-pci.c | 208 +++++++++++++++++++++++++++++++++++++++++++ + grub-core/bus/usb/ehci.c | 201 +++-------------------------------------- + 3 files changed, 223 insertions(+), 187 deletions(-) + create mode 100644 grub-core/bus/usb/ehci-pci.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index e4f253a20..4745eb4d9 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -593,6 +593,7 @@ module = { + module = { + name = ehci; + common = bus/usb/ehci.c; ++ pci = bus/usb/ehci-pci.c; + enable = pci; + }; + +diff --git a/grub-core/bus/usb/ehci-pci.c b/grub-core/bus/usb/ehci-pci.c +new file mode 100644 +index 000000000..65e6cb574 +--- /dev/null ++++ b/grub-core/bus/usb/ehci-pci.c +@@ -0,0 +1,208 @@ ++/* ehci.c - EHCI Support. */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2011 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define GRUB_EHCI_PCI_SBRN_REG 0x60 ++#define GRUB_EHCI_ADDR_MEM_MASK (~0xff) ++ ++/* USBLEGSUP bits and related OS OWNED byte offset */ ++enum ++{ ++ GRUB_EHCI_BIOS_OWNED = (1 << 16), ++ GRUB_EHCI_OS_OWNED = (1 << 24) ++}; ++ ++/* PCI iteration function... */ ++static int ++grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, ++ void *data __attribute__ ((unused))) ++{ ++ volatile grub_uint32_t *regs; ++ grub_uint32_t base, base_h; ++ grub_uint32_t eecp_offset; ++ grub_uint32_t usblegsup = 0; ++ grub_uint64_t maxtime; ++ grub_uint32_t interf; ++ grub_uint32_t subclass; ++ grub_uint32_t class; ++ grub_uint8_t release; ++ grub_uint32_t class_code; ++ ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: begin\n"); ++ ++ if (pciid == GRUB_CS5536_PCIID) ++ { ++ grub_uint64_t basereg; ++ ++ basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE); ++ if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE)) ++ { ++ /* Shouldn't happen. */ ++ grub_dprintf ("ehci", "No EHCI address is assigned\n"); ++ return 0; ++ } ++ base = (basereg & GRUB_CS5536_MSR_USB_BASE_ADDR_MASK); ++ basereg |= GRUB_CS5536_MSR_USB_BASE_BUS_MASTER; ++ basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_ENABLED; ++ basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_STATUS; ++ basereg &= ~GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE; ++ grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE, basereg); ++ } ++ else ++ { ++ grub_pci_address_t addr; ++ 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 EHCI controller, just return. */ ++ if (class != 0x0c || subclass != 0x03 || interf != 0x20) ++ return 0; ++ ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: class OK\n"); ++ ++ /* Check Serial Bus Release Number */ ++ addr = grub_pci_make_address (dev, GRUB_EHCI_PCI_SBRN_REG); ++ release = grub_pci_read_byte (addr); ++ if (release != 0x20) ++ { ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: Wrong SBRN: %0x\n", ++ release); ++ return 0; ++ } ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: bus rev. num. OK\n"); ++ ++ /* Determine EHCI EHCC registers base address. */ ++ addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0); ++ base = grub_pci_read (addr); ++ addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1); ++ base_h = grub_pci_read (addr); ++ /* Stop if registers are mapped above 4G - GRUB does not currently ++ * work with registers mapped above 4G */ ++ if (((base & GRUB_PCI_ADDR_MEM_TYPE_MASK) != GRUB_PCI_ADDR_MEM_TYPE_32) ++ && (base_h != 0)) ++ { ++ grub_dprintf ("ehci", ++ "EHCI grub_ehci_pci_iter: registers above 4G are not supported\n"); ++ return 0; ++ } ++ base &= GRUB_PCI_ADDR_MEM_MASK; ++ if (!base) ++ { ++ grub_dprintf ("ehci", ++ "EHCI: EHCI is not mapped\n"); ++ return 0; ++ } ++ ++ /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */ ++ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); ++ grub_pci_write_word(addr, ++ GRUB_PCI_COMMAND_MEM_ENABLED ++ | GRUB_PCI_COMMAND_BUS_MASTER ++ | grub_pci_read_word(addr)); ++ ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: 32-bit EHCI OK\n"); ++ } ++ ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: iobase of EHCC: %08x\n", ++ (base & GRUB_EHCI_ADDR_MEM_MASK)); ++ ++ regs = grub_pci_device_map_range (dev, ++ (base & GRUB_EHCI_ADDR_MEM_MASK), ++ 0x100); ++ ++ /* Is there EECP ? */ ++ eecp_offset = (grub_le_to_cpu32 (regs[2]) >> 8) & 0xff; ++ ++ /* Determine and change ownership. */ ++ /* EECP offset valid in HCCPARAMS */ ++ /* Ownership can be changed via EECP only */ ++ if (pciid != GRUB_CS5536_PCIID && eecp_offset >= 0x40) ++ { ++ grub_pci_address_t pciaddr_eecp; ++ pciaddr_eecp = grub_pci_make_address (dev, eecp_offset); ++ ++ usblegsup = grub_pci_read (pciaddr_eecp); ++ if (usblegsup & GRUB_EHCI_BIOS_OWNED) ++ { ++ grub_boot_time ("Taking ownership of EHCI controller"); ++ grub_dprintf ("ehci", ++ "EHCI grub_ehci_pci_iter: EHCI owned by: BIOS\n"); ++ /* Ownership change - set OS_OWNED bit */ ++ grub_pci_write (pciaddr_eecp, usblegsup | GRUB_EHCI_OS_OWNED); ++ /* Ensure PCI register is written */ ++ grub_pci_read (pciaddr_eecp); ++ ++ /* Wait for finish of ownership change, EHCI specification ++ * doesn't say how long it can take... */ ++ maxtime = grub_get_time_ms () + 1000; ++ while ((grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) ++ && (grub_get_time_ms () < maxtime)); ++ if (grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) ++ { ++ grub_dprintf ("ehci", ++ "EHCI grub_ehci_pci_iter: EHCI change ownership timeout"); ++ /* Change ownership in "hard way" - reset BIOS ownership */ ++ grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); ++ /* Ensure PCI register is written */ ++ grub_pci_read (pciaddr_eecp); ++ } ++ } ++ else if (usblegsup & GRUB_EHCI_OS_OWNED) ++ /* XXX: What to do in this case - nothing ? Can it happen ? */ ++ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: EHCI owned by: OS\n"); ++ else ++ { ++ grub_dprintf ("ehci", ++ "EHCI grub_ehci_pci_iter: EHCI owned by: NONE\n"); ++ /* XXX: What to do in this case ? Can it happen ? ++ * Is code below correct ? */ ++ /* Ownership change - set OS_OWNED bit */ ++ grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); ++ /* Ensure PCI register is written */ ++ grub_pci_read (pciaddr_eecp); ++ } ++ ++ /* Disable SMI, just to be sure. */ ++ pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4); ++ grub_pci_write (pciaddr_eecp, 0); ++ /* Ensure PCI register is written */ ++ grub_pci_read (pciaddr_eecp); ++ } ++ ++ grub_dprintf ("ehci", "inithw: EHCI grub_ehci_pci_iter: ownership OK\n"); ++ ++ grub_ehci_init_device (regs); ++ return 0; ++} ++ ++void ++grub_ehci_pci_scan (void) ++{ ++ grub_pci_iterate (grub_ehci_pci_iter, NULL); ++} +diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c +index 5f4297bb2..c772e7654 100644 +--- a/grub-core/bus/usb/ehci.c ++++ b/grub-core/bus/usb/ehci.c +@@ -22,13 +22,10 @@ + #include + #include + #include +-#include +-#include +-#include + #include + #include +-#include + #include ++#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +@@ -39,8 +36,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); + * - is not supporting interrupt transfers + */ + +-#define GRUB_EHCI_PCI_SBRN_REG 0x60 +- + /* Capability registers offsets */ + enum + { +@@ -54,7 +49,6 @@ enum + #define GRUB_EHCI_EECP_MASK (0xff << 8) + #define GRUB_EHCI_EECP_SHIFT 8 + +-#define GRUB_EHCI_ADDR_MEM_MASK (~0xff) + #define GRUB_EHCI_POINTER_MASK (~0x1f) + + /* Capability register SPARAMS bits */ +@@ -85,13 +79,6 @@ enum + + #define GRUB_EHCI_QH_EMPTY 1 + +-/* USBLEGSUP bits and related OS OWNED byte offset */ +-enum +-{ +- GRUB_EHCI_BIOS_OWNED = (1 << 16), +- GRUB_EHCI_OS_OWNED = (1 << 24) +-}; +- + /* Operational registers offsets */ + enum + { +@@ -455,9 +442,10 @@ grub_ehci_reset (struct grub_ehci *e) + + sync_all_caches (e); + ++ grub_dprintf ("ehci", "reset\n"); ++ + grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND, +- GRUB_EHCI_CMD_HC_RESET +- | grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); ++ GRUB_EHCI_CMD_HC_RESET); + /* Ensure command is written */ + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND); + /* XXX: How long time could take reset of HC ? */ +@@ -473,116 +461,24 @@ grub_ehci_reset (struct grub_ehci *e) + } + + /* PCI iteration function... */ +-static int +-grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, +- void *data __attribute__ ((unused))) ++void ++grub_ehci_init_device (volatile void *regs) + { +- grub_uint8_t release; +- grub_uint32_t class_code; +- grub_uint32_t interf; +- grub_uint32_t subclass; +- grub_uint32_t class; +- grub_uint32_t base, base_h; + struct grub_ehci *e; +- grub_uint32_t eecp_offset; + grub_uint32_t fp; + int i; +- grub_uint32_t usblegsup = 0; +- grub_uint64_t maxtime; + grub_uint32_t n_ports; + grub_uint8_t caplen; + +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: begin\n"); +- +- if (pciid == GRUB_CS5536_PCIID) +- { +- grub_uint64_t basereg; +- +- basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE); +- if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE)) +- { +- /* Shouldn't happen. */ +- grub_dprintf ("ehci", "No EHCI address is assigned\n"); +- return 0; +- } +- base = (basereg & GRUB_CS5536_MSR_USB_BASE_ADDR_MASK); +- basereg |= GRUB_CS5536_MSR_USB_BASE_BUS_MASTER; +- basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_ENABLED; +- basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_STATUS; +- basereg &= ~GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE; +- grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE, basereg); +- } +- else +- { +- grub_pci_address_t addr; +- 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 EHCI controller, just return. */ +- if (class != 0x0c || subclass != 0x03 || interf != 0x20) +- return 0; +- +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: class OK\n"); +- +- /* Check Serial Bus Release Number */ +- addr = grub_pci_make_address (dev, GRUB_EHCI_PCI_SBRN_REG); +- release = grub_pci_read_byte (addr); +- if (release != 0x20) +- { +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: Wrong SBRN: %0x\n", +- release); +- return 0; +- } +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: bus rev. num. OK\n"); +- +- /* Determine EHCI EHCC registers base address. */ +- addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0); +- base = grub_pci_read (addr); +- addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1); +- base_h = grub_pci_read (addr); +- /* Stop if registers are mapped above 4G - GRUB does not currently +- * work with registers mapped above 4G */ +- if (((base & GRUB_PCI_ADDR_MEM_TYPE_MASK) != GRUB_PCI_ADDR_MEM_TYPE_32) +- && (base_h != 0)) +- { +- grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: registers above 4G are not supported\n"); +- return 0; +- } +- base &= GRUB_PCI_ADDR_MEM_MASK; +- if (!base) +- { +- grub_dprintf ("ehci", +- "EHCI: EHCI is not mapped\n"); +- return 0; +- } +- +- /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */ +- addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); +- grub_pci_write_word(addr, +- GRUB_PCI_COMMAND_MEM_ENABLED +- | GRUB_PCI_COMMAND_BUS_MASTER +- | grub_pci_read_word(addr)); +- +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: 32-bit EHCI OK\n"); +- } +- + /* Allocate memory for the controller and fill basic values. */ + e = grub_zalloc (sizeof (*e)); + if (!e) +- return 1; ++ return; + e->framelist_chunk = NULL; + e->td_chunk = NULL; + e->qh_chunk = NULL; +- e->iobase_ehcc = grub_pci_device_map_range (dev, +- (base & GRUB_EHCI_ADDR_MEM_MASK), +- 0x100); ++ e->iobase_ehcc = regs; + +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: iobase of EHCC: %08x\n", +- (base & GRUB_EHCI_ADDR_MEM_MASK)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CAPLEN: %02x\n", + grub_ehci_ehcc_read8 (e, GRUB_EHCI_EHCC_CAPLEN)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: VERSION: %04x\n", +@@ -598,7 +494,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + if (caplen & (sizeof (grub_uint32_t) - 1)) + { + grub_dprintf ("ehci", "Unaligned caplen\n"); +- return 0; ++ return; + } + e->iobase = ((volatile grub_uint32_t *) e->iobase_ehcc + + (caplen / sizeof (grub_uint32_t))); +@@ -609,7 +505,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + + grub_dprintf ("ehci", + "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", +- (base & GRUB_EHCI_ADDR_MEM_MASK) + caplen); ++ (grub_addr_t) e->iobase_ehcc + caplen); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +@@ -625,10 +521,6 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CONFIG_FLAG: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_CONFIG_FLAG)); + +- /* Is there EECP ? */ +- eecp_offset = (grub_ehci_ehcc_read32 (e, GRUB_EHCI_EHCC_CPARAMS) +- & GRUB_EHCI_EECP_MASK) >> GRUB_EHCI_EECP_SHIFT; +- + /* Check format of data structures requested by EHCI */ + /* XXX: In fact it is not used at any place, it is prepared for future + * This implementation uses 32-bits pointers only */ +@@ -732,65 +624,6 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: QH/TD init. OK\n"); + +- /* Determine and change ownership. */ +- /* EECP offset valid in HCCPARAMS */ +- /* Ownership can be changed via EECP only */ +- if (pciid != GRUB_CS5536_PCIID && eecp_offset >= 0x40) +- { +- grub_pci_address_t pciaddr_eecp; +- pciaddr_eecp = grub_pci_make_address (dev, eecp_offset); +- +- usblegsup = grub_pci_read (pciaddr_eecp); +- if (usblegsup & GRUB_EHCI_BIOS_OWNED) +- { +- grub_boot_time ("Taking ownership of EHCI controller"); +- grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: EHCI owned by: BIOS\n"); +- /* Ownership change - set OS_OWNED bit */ +- grub_pci_write (pciaddr_eecp, usblegsup | GRUB_EHCI_OS_OWNED); +- /* Ensure PCI register is written */ +- grub_pci_read (pciaddr_eecp); +- +- /* Wait for finish of ownership change, EHCI specification +- * doesn't say how long it can take... */ +- maxtime = grub_get_time_ms () + 1000; +- while ((grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) +- && (grub_get_time_ms () < maxtime)); +- if (grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) +- { +- grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: EHCI change ownership timeout"); +- /* Change ownership in "hard way" - reset BIOS ownership */ +- grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); +- /* Ensure PCI register is written */ +- grub_pci_read (pciaddr_eecp); +- } +- } +- else if (usblegsup & GRUB_EHCI_OS_OWNED) +- /* XXX: What to do in this case - nothing ? Can it happen ? */ +- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: EHCI owned by: OS\n"); +- else +- { +- grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: EHCI owned by: NONE\n"); +- /* XXX: What to do in this case ? Can it happen ? +- * Is code below correct ? */ +- /* Ownership change - set OS_OWNED bit */ +- grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); +- /* Ensure PCI register is written */ +- grub_pci_read (pciaddr_eecp); +- } +- +- /* Disable SMI, just to be sure. */ +- pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4); +- grub_pci_write (pciaddr_eecp, 0); +- /* Ensure PCI register is written */ +- grub_pci_read (pciaddr_eecp); +- +- } +- +- grub_dprintf ("ehci", "inithw: EHCI grub_ehci_pci_iter: ownership OK\n"); +- + /* Now we can setup EHCI (maybe...) */ + + /* Check if EHCI is halted and halt it if not */ +@@ -864,7 +697,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + + grub_dprintf ("ehci", + "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", +- (base & GRUB_EHCI_ADDR_MEM_MASK)); ++ (grub_addr_t) regs); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +@@ -880,7 +713,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CONFIG_FLAG: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_CONFIG_FLAG)); + +- return 0; ++ return; + + fail: + if (e) +@@ -894,7 +727,7 @@ fail: + } + grub_free (e); + +- return 0; ++ return; + } + + static int +@@ -1891,12 +1724,6 @@ grub_ehci_detect_dev (grub_usb_controller_t dev, int port, int *changed) + } + } + +-static void +-grub_ehci_inithw (void) +-{ +- grub_pci_iterate (grub_ehci_pci_iter, NULL); +-} +- + static grub_err_t + grub_ehci_restore_hw (void) + { +@@ -1997,7 +1824,7 @@ GRUB_MOD_INIT (ehci) + grub_stop_disk_firmware (); + + grub_boot_time ("Initing EHCI hardware"); +- grub_ehci_inithw (); ++ grub_ehci_pci_scan (); + grub_boot_time ("Registering EHCI driver"); + grub_usb_controller_dev_register (&usb_controller); + grub_boot_time ("EHCI driver registered"); +-- +2.13.0 + diff --git a/0029-arm_coreboot-Support-EHCI.patch b/0029-arm_coreboot-Support-EHCI.patch new file mode 100644 index 00000000..8aa72655 --- /dev/null +++ b/0029-arm_coreboot-Support-EHCI.patch @@ -0,0 +1,123 @@ +From d11ced1e1fb93676942e51618eb53c140f541890 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 8 May 2017 22:14:28 +0200 +Subject: [PATCH 029/176] arm_coreboot: Support EHCI. + +--- + gentpl.py | 2 +- + grub-core/Makefile.core.def | 2 ++ + grub-core/bus/usb/ehci-fdt.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ + grub-core/bus/usb/usbtrans.c | 2 +- + include/grub/usb.h | 4 ++++ + 5 files changed, 53 insertions(+), 2 deletions(-) + create mode 100644 grub-core/bus/usb/ehci-fdt.c + +diff --git a/gentpl.py b/gentpl.py +index ed268178b..da67965a4 100644 +--- a/gentpl.py ++++ b/gentpl.py +@@ -63,7 +63,7 @@ GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips", + "sparc64_ieee1275", "powerpc_ieee1275"] + GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi"); + GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"] +-GROUPS["usb"] = GROUPS["pci"] ++GROUPS["usb"] = GROUPS["pci"] + ["arm_coreboot"] + + # If gfxterm is main output console integrate it into kernel + GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot", "arm_coreboot" ] +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 4745eb4d9..5ce506597 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -593,8 +593,10 @@ module = { + module = { + name = ehci; + common = bus/usb/ehci.c; ++ arm_coreboot = bus/usb/ehci-fdt.c; + pci = bus/usb/ehci-pci.c; + enable = pci; ++ enable = arm_coreboot; + }; + + module = { +diff --git a/grub-core/bus/usb/ehci-fdt.c b/grub-core/bus/usb/ehci-fdt.c +new file mode 100644 +index 000000000..29b50bdd5 +--- /dev/null ++++ b/grub-core/bus/usb/ehci-fdt.c +@@ -0,0 +1,45 @@ ++/* ehci.c - EHCI Support. */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2011 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static grub_err_t ++ehci_attach(const struct grub_fdtbus_dev *dev) ++{ ++ grub_dprintf ("ehci", "Found generic-ehci\n"); ++ ++ grub_ehci_init_device (grub_fdtbus_map_reg (dev, 0, 0)); ++ return 0; ++} ++ ++struct grub_fdtbus_driver ehci = ++{ ++ .compatible = "generic-ehci", ++ .attach = ehci_attach ++}; ++ ++void ++grub_ehci_pci_scan (void) ++{ ++ grub_fdtbus_register (&ehci); ++} +diff --git a/grub-core/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c +index 9266e4931..85f081fff 100644 +--- a/grub-core/bus/usb/usbtrans.c ++++ b/grub-core/bus/usb/usbtrans.c +@@ -18,7 +18,7 @@ + */ + + #include +-#include ++#include + #include + #include + #include +diff --git a/include/grub/usb.h b/include/grub/usb.h +index 11d96481f..512ae1dd0 100644 +--- a/include/grub/usb.h ++++ b/include/grub/usb.h +@@ -321,5 +321,9 @@ grub_usb_err_t + grub_usb_check_transfer (grub_usb_transfer_t trans, grub_size_t *actual); + void + grub_usb_cancel_transfer (grub_usb_transfer_t trans); ++void ++grub_ehci_init_device (volatile void *regs); ++void ++grub_ehci_pci_scan (void); + + #endif /* GRUB_USB_H */ +-- +2.13.0 + diff --git a/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch b/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch new file mode 100644 index 00000000..68aac459 --- /dev/null +++ b/0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch @@ -0,0 +1,25 @@ +From 4f8471532d454b2db96434c28bf7105ed69e0f4d Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 08:39:40 +0200 +Subject: [PATCH 030/176] Fix bug on FDT nodes with compatible property + +--- + grub-core/bus/fdt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/bus/fdt.c b/grub-core/bus/fdt.c +index 6fb077000..34d535457 100644 +--- a/grub-core/bus/fdt.c ++++ b/grub-core/bus/fdt.c +@@ -43,6 +43,8 @@ is_compatible (struct grub_fdtbus_driver *driver, + grub_size_t compatible_size; + const char *compatible = grub_fdt_get_prop (dtb, node, "compatible", + &compatible_size); ++ if (!compatible) ++ return 0; + const char *compatible_end = compatible + compatible_size; + while (compatible < compatible_end) + { +-- +2.13.0 + diff --git a/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch b/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch new file mode 100644 index 00000000..ad0a90ad --- /dev/null +++ b/0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch @@ -0,0 +1,134 @@ +From c4313c812dc14e82a774b580b5e34d40e7f3fae6 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 08:40:29 +0200 +Subject: [PATCH 031/176] fdtbus: Add ability to send/receive messages on + parent busses. + +--- + grub-core/bus/fdt.c | 35 +++++++++++++++++------------------ + include/grub/fdtbus.h | 18 +++++++++++++++++- + 2 files changed, 34 insertions(+), 19 deletions(-) + +diff --git a/grub-core/bus/fdt.c b/grub-core/bus/fdt.c +index 34d535457..135da497b 100644 +--- a/grub-core/bus/fdt.c ++++ b/grub-core/bus/fdt.c +@@ -25,30 +25,22 @@ static grub_size_t root_address_cells, root_size_cells; + /* Pointer to this symbol signals invalid mapping. */ + char grub_fdtbus_invalid_mapping[1]; + +-struct grub_fdtbus_dev +-{ +- struct grub_fdtbus_dev *next; +- struct grub_fdtbus_dev *parent; +- int node; +- struct grub_fdtbus_driver *driver; +-}; +- + struct grub_fdtbus_dev *devs; + struct grub_fdtbus_driver *drivers; + +-static int +-is_compatible (struct grub_fdtbus_driver *driver, +- int node) ++int ++grub_fdtbus_is_compatible (const char *compat_string, ++ const struct grub_fdtbus_dev *dev) + { + grub_size_t compatible_size; +- const char *compatible = grub_fdt_get_prop (dtb, node, "compatible", ++ const char *compatible = grub_fdt_get_prop (dtb, dev->node, "compatible", + &compatible_size); + if (!compatible) + return 0; + const char *compatible_end = compatible + compatible_size; + while (compatible < compatible_end) + { +- if (grub_strcmp (driver->compatible, compatible) == 0) ++ if (grub_strcmp (compat_string, compatible) == 0) + return 1; + compatible += grub_strlen (compatible) + 1; + } +@@ -75,10 +67,12 @@ fdtbus_scan (struct grub_fdtbus_dev *parent) + dev->parent = parent; + devs = dev; + FOR_LIST_ELEMENTS(driver, drivers) +- if (!dev->driver && is_compatible (driver, node)) ++ if (!dev->driver && grub_fdtbus_is_compatible (driver->compatible, dev)) + { +- if (driver->attach(dev) == GRUB_ERR_NONE) ++ grub_dprintf ("fdtbus", "Attaching %s\n", driver->compatible); ++ if (driver->attach (dev) == GRUB_ERR_NONE) + { ++ grub_dprintf ("fdtbus", "Attached %s\n", driver->compatible); + dev->driver = driver; + break; + } +@@ -92,13 +86,18 @@ void + grub_fdtbus_register (struct grub_fdtbus_driver *driver) + { + struct grub_fdtbus_dev *dev; ++ grub_dprintf ("fdtbus", "Registering %s\n", driver->compatible); + grub_list_push (GRUB_AS_LIST_P (&drivers), + GRUB_AS_LIST (driver)); + for (dev = devs; dev; dev = dev->next) +- if (!dev->driver && is_compatible (driver, dev->node)) ++ if (!dev->driver && grub_fdtbus_is_compatible (driver->compatible, dev)) + { +- if (driver->attach(dev) == GRUB_ERR_NONE) +- dev->driver = driver; ++ grub_dprintf ("fdtbus", "Attaching %s (%p)\n", driver->compatible, dev); ++ if (driver->attach (dev) == GRUB_ERR_NONE) ++ { ++ grub_dprintf ("fdtbus", "Attached %s\n", driver->compatible); ++ dev->driver = driver; ++ } + grub_print_error (); + } + } +diff --git a/include/grub/fdtbus.h b/include/grub/fdtbus.h +index 985837e55..f519c40ec 100644 +--- a/include/grub/fdtbus.h ++++ b/include/grub/fdtbus.h +@@ -22,7 +22,13 @@ + #include + #include + +-struct grub_fdtbus_dev; ++struct grub_fdtbus_dev ++{ ++ struct grub_fdtbus_dev *next; ++ struct grub_fdtbus_dev *parent; ++ int node; ++ struct grub_fdtbus_driver *driver; ++}; + + struct grub_fdtbus_driver + { +@@ -33,6 +39,12 @@ struct grub_fdtbus_driver + + grub_err_t (*attach) (const struct grub_fdtbus_dev *dev); + void (*detach) (const struct grub_fdtbus_dev *dev); ++ ++ /* Message bus operations. */ ++ grub_err_t (*send) (const struct grub_fdtbus_dev *dev, const void *data, grub_size_t sz); ++ grub_err_t (*receive) (const struct grub_fdtbus_dev *dev, void *data, grub_size_t sz); ++ grub_err_t (*start) (const struct grub_fdtbus_dev *dev); ++ void (*stop) (const struct grub_fdtbus_dev *dev); + }; + + extern char EXPORT_VAR(grub_fdtbus_invalid_mapping)[1]; +@@ -63,6 +75,10 @@ EXPORT_FUNC(grub_fdtbus_register) (struct grub_fdtbus_driver *driver); + void + EXPORT_FUNC(grub_fdtbus_unregister) (struct grub_fdtbus_driver *driver); + ++int ++EXPORT_FUNC(grub_fdtbus_is_compatible) (const char *compat_string, ++ const struct grub_fdtbus_dev *dev); ++ + /* Must be called before any register(). */ + /* dtb is assumed to be unfreeable and must remain + valid for lifetime of GRUB. +-- +2.13.0 + diff --git a/0032-rk3288_spi-Add-SPI-driver.patch b/0032-rk3288_spi-Add-SPI-driver.patch new file mode 100644 index 00000000..21445965 --- /dev/null +++ b/0032-rk3288_spi-Add-SPI-driver.patch @@ -0,0 +1,165 @@ +From b0b1b81a11f8bae8ab9e8edd87ac3f4f7949d03b Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 08:42:14 +0200 +Subject: [PATCH 032/176] rk3288_spi: Add SPI driver + +--- + grub-core/Makefile.core.def | 1 + + grub-core/bus/spi/rk3288_spi.c | 103 +++++++++++++++++++++++++++++++++++++ + grub-core/kern/arm/coreboot/init.c | 2 + + include/grub/arm/coreboot/kernel.h | 4 +- + 4 files changed, 108 insertions(+), 2 deletions(-) + create mode 100644 grub-core/bus/spi/rk3288_spi.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 5ce506597..d2239f171 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -162,6 +162,7 @@ kernel = { + arm_coreboot = bus/fdt.c; + arm_coreboot = term/ps2.c; + arm_coreboot = term/arm/pl050.c; ++ arm_coreboot = bus/spi/rk3288_spi.c; + arm_coreboot = commands/keylayouts.c; + arm_coreboot = kern/arm/coreboot/dma.c; + +diff --git a/grub-core/bus/spi/rk3288_spi.c b/grub-core/bus/spi/rk3288_spi.c +new file mode 100644 +index 000000000..aacb79ffe +--- /dev/null ++++ b/grub-core/bus/spi/rk3288_spi.c +@@ -0,0 +1,103 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * ++ * Copyright (C) 2012 Google Inc. ++ * Copyright (C) 2016 Free Software Foundation, Inc. ++ * ++ * This is based on depthcharge code. ++ * ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static grub_err_t ++spi_send (const struct grub_fdtbus_dev *dev, const void *data, grub_size_t sz) ++{ ++ const grub_uint8_t *ptr = data, *end = ptr + sz; ++ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); ++ spi[2] = 0; ++ spi[1] = sz - 1; ++ spi[0] = ((1 << 18) | spi[0]) & ~(1 << 19); ++ spi[2] = 1; ++ while (ptr < end) ++ { ++ while (spi[9] & 2); ++ spi[256] = *ptr++; ++ } ++ while (spi[9] & 1); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++spi_receive (const struct grub_fdtbus_dev *dev, void *data, grub_size_t sz) ++{ ++ grub_uint8_t *ptr = data, *end = ptr + sz; ++ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); ++ spi[2] = 0; ++ spi[1] = sz - 1; ++ spi[0] = ((1 << 19) | spi[0]) & ~(1 << 18); ++ spi[2] = 1; ++ while (ptr < end) ++ { ++ while (spi[9] & 8); ++ *ptr++ = spi[512]; ++ } ++ while (spi[9] & 1); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++spi_start (const struct grub_fdtbus_dev *dev) ++{ ++ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); ++ spi[3] = 1; ++ return GRUB_ERR_NONE; ++} ++ ++static void ++spi_stop (const struct grub_fdtbus_dev *dev) ++{ ++ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); ++ spi[3] = 0; ++} ++ ++static grub_err_t ++spi_attach(const struct grub_fdtbus_dev *dev) ++{ ++ if (!grub_fdtbus_is_mapping_valid (grub_fdtbus_map_reg (dev, 0, 0))) ++ return GRUB_ERR_IO; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static struct grub_fdtbus_driver spi = ++{ ++ .compatible = "rockchip,rk3288-spi", ++ .attach = spi_attach, ++ .send = spi_send, ++ .receive = spi_receive, ++ .start = spi_start, ++ .stop = spi_stop, ++}; ++ ++void ++grub_rk3288_spi_init (void) ++{ ++ grub_fdtbus_register (&spi); ++} +diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c +index a06ccb72f..0126ff638 100644 +--- a/grub-core/kern/arm/coreboot/init.c ++++ b/grub-core/kern/arm/coreboot/init.c +@@ -132,6 +132,8 @@ grub_machine_init (void) + grub_fatal ("No DTB found"); + grub_fdtbus_init (dtb, dtb_size); + ++ grub_rk3288_spi_init (); ++ + grub_machine_timer_init (); + grub_pl050_init (); + } +diff --git a/include/grub/arm/coreboot/kernel.h b/include/grub/arm/coreboot/kernel.h +index 09cd7fe32..269505342 100644 +--- a/include/grub/arm/coreboot/kernel.h ++++ b/include/grub/arm/coreboot/kernel.h +@@ -34,8 +34,8 @@ struct grub_fdt_board + extern struct grub_fdt_board grub_fdt_boards[]; + void grub_machine_timer_init (void); + void grub_pl050_init (void); +-void +-grub_cros_init (void); ++void grub_cros_init (void); ++void grub_rk3288_spi_init (void); + extern grub_addr_t EXPORT_VAR (start_of_ram); + #endif /* ! ASM_FILE */ + +-- +2.13.0 + diff --git a/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch b/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch new file mode 100644 index 00000000..0751c6f0 --- /dev/null +++ b/0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch @@ -0,0 +1,419 @@ +From 5c3fd1b135bd73c8e3467b9b635b25ca4d360a19 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 08:47:34 +0200 +Subject: [PATCH 033/176] arm_coreboot: Add Chromebook keyboard driver. + +--- + grub-core/term/arm/cros.c | 125 +++++++++++++++++++++++ + grub-core/term/arm/cros_ec.c | 238 +++++++++++++++++++++++++++++++++++++++++++ + include/grub/arm/cros_ec.h | 21 ++++ + 3 files changed, 384 insertions(+) + create mode 100644 grub-core/term/arm/cros.c + create mode 100644 grub-core/term/arm/cros_ec.c + create mode 100644 include/grub/arm/cros_ec.h + +diff --git a/grub-core/term/arm/cros.c b/grub-core/term/arm/cros.c +new file mode 100644 +index 000000000..1ff9f8ccf +--- /dev/null ++++ b/grub-core/term/arm/cros.c +@@ -0,0 +1,125 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * ++ * Copyright (C) 2012 Google Inc. ++ * Copyright (C) 2016 Free Software Foundation, Inc. ++ * ++ * This is based on depthcharge code. ++ * ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct grub_ps2_state ps2_state; ++ ++struct grub_cros_ec_keyscan old_scan; ++ ++static const struct grub_fdtbus_dev *cros_ec; ++ ++static grub_uint8_t map_code[GRUB_CROS_EC_KEYSCAN_COLS][GRUB_CROS_EC_KEYSCAN_ROWS]; ++ ++static grub_uint8_t e0_translate[16] = ++ { ++ 0x1c, 0x1d, 0x35, 0x00, ++ 0x38, 0x00, 0x47, 0x48, ++ 0x49, 0x4b, 0x4d, 0x4f, ++ 0x50, 0x51, 0x52, 0x53, ++ }; ++ ++/* If there is a character pending, return it; ++ otherwise return GRUB_TERM_NO_KEY. */ ++static int ++grub_cros_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) ++{ ++ struct grub_cros_ec_keyscan scan; ++ int i, j; ++ if (grub_cros_ec_scan_keyboard (cros_ec, &scan) < 0) ++ return GRUB_TERM_NO_KEY; ++ for (i = 0; i < GRUB_CROS_EC_KEYSCAN_COLS; i++) ++ if (scan.data[i] ^ old_scan.data[i]) ++ for (j = 0; j < GRUB_CROS_EC_KEYSCAN_ROWS; j++) ++ if ((scan.data[i] ^ old_scan.data[i]) & (1 << j)) ++ { ++ grub_uint8_t code = map_code[i][j]; ++ int ret; ++ grub_uint8_t brk = 0; ++ if (!(scan.data[i] & (1 << j))) ++ brk = 0x80; ++ grub_dprintf ("cros_keyboard", "key <%d, %d> code %x\n", i, j, code); ++ if (code < 0x60) ++ ret = grub_ps2_process_incoming_byte (&ps2_state, code | brk); ++ else if (code >= 0x60 && code < 0x70 && e0_translate[code - 0x60]) ++ { ++ grub_ps2_process_incoming_byte (&ps2_state, 0xe0); ++ ret = grub_ps2_process_incoming_byte (&ps2_state, e0_translate[code - 0x60] | brk); ++ } ++ else ++ ret = GRUB_TERM_NO_KEY; ++ old_scan.data[i] ^= (1 << j); ++ if (ret != GRUB_TERM_NO_KEY) ++ return ret; ++ } ++ return GRUB_TERM_NO_KEY; ++} ++ ++static struct grub_term_input grub_cros_keyboard_term = ++ { ++ .name = "cros_keyboard", ++ .getkey = grub_cros_keyboard_getkey ++ }; ++ ++static grub_err_t ++cros_attach (const struct grub_fdtbus_dev *dev) ++{ ++ grub_size_t keymap_size, i; ++ const grub_uint8_t *keymap = grub_fdtbus_get_prop (dev, "linux,keymap", &keymap_size); ++ ++ if (!dev->parent || !grub_cros_ec_validate (dev->parent)) ++ return GRUB_ERR_IO; ++ ++ if (keymap) ++ { ++ for (i = 0; i + 3 < keymap_size; i += 4) ++ if (keymap[i+1] < GRUB_CROS_EC_KEYSCAN_COLS && keymap[i] < GRUB_CROS_EC_KEYSCAN_ROWS ++ && keymap[i+2] == 0 && keymap[i+3] < 0x80) ++ map_code[keymap[i+1]][keymap[i]] = keymap[i+3]; ++ } ++ ++ cros_ec = dev->parent; ++ ps2_state.current_set = 1; ++ ps2_state.at_keyboard_status = 0; ++ grub_term_register_input ("cros_keyboard", &grub_cros_keyboard_term); ++ return GRUB_ERR_NONE; ++} ++ ++static struct grub_fdtbus_driver cros = ++{ ++ .compatible = "google,cros-ec-keyb", ++ .attach = cros_attach ++}; ++ ++void ++grub_cros_init (void) ++{ ++ grub_fdtbus_register (&cros); ++} +diff --git a/grub-core/term/arm/cros_ec.c b/grub-core/term/arm/cros_ec.c +new file mode 100644 +index 000000000..f4144818b +--- /dev/null ++++ b/grub-core/term/arm/cros_ec.c +@@ -0,0 +1,238 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * ++ * Copyright (C) 2012 Google Inc. ++ * Copyright (C) 2016 Free Software Foundation, Inc. ++ * ++ * This is based on depthcharge code. ++ * ++ * 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 . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static const grub_uint64_t FRAMING_TIMEOUT_MS = 300; ++ ++static const grub_uint8_t EC_FRAMING_BYTE = 0xec; ++ ++#define EC_CMD_MKBP_STATE 0x60 ++#define EC_CMD_VERSION0 0xdc ++ ++static grub_uint64_t last_transfer; ++ ++static void ++stop_bus (const struct grub_fdtbus_dev *spi) ++{ ++ spi->driver->stop (spi); ++ last_transfer = grub_get_time_ms (); ++} ++ ++static int ++wait_for_frame (const struct grub_fdtbus_dev *spi) ++{ ++ grub_uint64_t start = grub_get_time_ms (); ++ grub_uint8_t byte; ++ do ++ { ++ if (spi->driver->receive (spi, &byte, 1)) ++ return -1; ++ if (byte != EC_FRAMING_BYTE && ++ grub_get_time_ms () - start > FRAMING_TIMEOUT_MS) ++ { ++ grub_dprintf ("cros", "Timeout waiting for framing byte.\n"); ++ return -1; ++ } ++ } ++ while (byte != EC_FRAMING_BYTE); ++ return 0; ++} ++ ++/* ++ * Calculate a simple 8-bit checksum of a data block ++ * ++ * @param data Data block to checksum ++ * @param size Size of data block in bytes ++ * @return checksum value (0 to 255) ++ */ ++static grub_uint8_t ++cros_ec_calc_checksum (const void *data, int size) ++{ ++ grub_uint8_t csum; ++ const grub_uint8_t *bytes = data; ++ int i; ++ ++ for (i = csum = 0; i < size; i++) ++ csum += bytes[i]; ++ return csum & 0xff; ++} ++ ++enum ++{ ++ /* response, arglen */ ++ CROS_EC_SPI_IN_HDR_SIZE = 2, ++ /* version, cmd, arglen */ ++ CROS_EC_SPI_OUT_HDR_SIZE = 3 ++}; ++ ++static grub_uint8_t busbuf[256]; ++#define MSG_BYTES ((int)sizeof (busbuf)) ++ ++static int ++ec_command (const struct grub_fdtbus_dev *dev, int cmd, int cmd_version, ++ const void *dout, int dout_len, void *din, int din_len) ++{ ++ const struct grub_fdtbus_dev *spi = dev->parent; ++ grub_uint8_t *bytes; ++ ++ /* Header + data + checksum. */ ++ grub_uint32_t out_bytes = CROS_EC_SPI_OUT_HDR_SIZE + dout_len + 1; ++ grub_uint32_t in_bytes = CROS_EC_SPI_IN_HDR_SIZE + din_len + 1; ++ ++ /* ++ * Sanity-check I/O sizes given transaction overhead in internal ++ * buffers. ++ */ ++ if (out_bytes > MSG_BYTES) ++ { ++ grub_dprintf ("cros", "Cannot send %d bytes\n", dout_len); ++ return -1; ++ } ++ if (in_bytes > MSG_BYTES) ++ { ++ grub_dprintf ("cros", "Cannot receive %d bytes\n", din_len); ++ return -1; ++ } ++ ++ /* Prepare the output. */ ++ bytes = busbuf; ++ *bytes++ = EC_CMD_VERSION0 + cmd_version; ++ *bytes++ = cmd; ++ *bytes++ = dout_len; ++ grub_memcpy (bytes, dout, dout_len); ++ bytes += dout_len; ++ ++ *bytes++ = cros_ec_calc_checksum (busbuf, ++ CROS_EC_SPI_OUT_HDR_SIZE + dout_len); ++ ++ /* Depthcharge uses 200 us here but GRUB timer resolution is only 1ms, ++ decrease this when we increase timer resolution. */ ++ while (grub_get_time_ms () - last_transfer < 1) ++ ; ++ ++ if (spi->driver->start (spi)) ++ return -1; ++ ++ /* Allow EC to ramp up clock after being awoken. */ ++ /* Depthcharge only waits 100 us here but GRUB timer resolution is only 1ms, ++ decrease this when we increase timer resolution. */ ++ grub_millisleep (1); ++ ++ if (spi->driver->send (spi, busbuf, out_bytes)) ++ { ++ stop_bus (spi); ++ return -1; ++ } ++ ++ /* Wait until the EC is ready. */ ++ if (wait_for_frame (spi)) ++ { ++ stop_bus (spi); ++ return -1; ++ } ++ ++ /* Read the response code and the data length. */ ++ bytes = busbuf; ++ if (spi->driver->receive (spi, bytes, 2)) ++ { ++ stop_bus (spi); ++ return -1; ++ } ++ grub_uint8_t result = *bytes++; ++ grub_uint8_t length = *bytes++; ++ ++ /* Make sure there's enough room for the data. */ ++ if (CROS_EC_SPI_IN_HDR_SIZE + length + 1 > MSG_BYTES) ++ { ++ grub_dprintf ("cros", "Received length %#02x too large\n", length); ++ stop_bus (spi); ++ return -1; ++ } ++ ++ /* Read the data and the checksum, and finish up. */ ++ if (spi->driver->receive (spi, bytes, length + 1)) ++ { ++ stop_bus (spi); ++ return -1; ++ } ++ bytes += length; ++ int expected = *bytes++; ++ stop_bus (spi); ++ ++ /* Check the integrity of the response. */ ++ if (result != 0) ++ { ++ grub_dprintf ("cros", "Received bad result code %d\n", result); ++ return -result; ++ } ++ ++ int csum = cros_ec_calc_checksum (busbuf, ++ CROS_EC_SPI_IN_HDR_SIZE + length); ++ ++ if (csum != expected) ++ { ++ grub_dprintf ("cros", "Invalid checksum rx %#02x, calced %#02x\n", ++ expected, csum); ++ return -1; ++ } ++ ++ /* If the caller wants the response, copy it out for them. */ ++ if (length < din_len) ++ din_len = length; ++ if (din) ++ { ++ grub_memcpy (din, (grub_uint8_t *) busbuf + CROS_EC_SPI_IN_HDR_SIZE, din_len); ++ } ++ ++ return din_len; ++} ++ ++int ++grub_cros_ec_scan_keyboard (const struct grub_fdtbus_dev *dev, struct grub_cros_ec_keyscan *scan) ++{ ++ if (ec_command (dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, ++ sizeof (*scan)) < (int) sizeof (*scan)) ++ return -1; ++ ++ return 0; ++} ++ ++int ++grub_cros_ec_validate (const struct grub_fdtbus_dev *dev) ++{ ++ if (!grub_fdtbus_is_compatible("google,cros-ec-spi", dev)) ++ return 0; ++ if (!dev->parent) ++ return 0; ++ if (!dev->parent->driver) ++ return 0; ++ if (!dev->parent->driver->send ++ || !dev->parent->driver->receive) ++ return 0; ++ return 1; ++} ++ +diff --git a/include/grub/arm/cros_ec.h b/include/grub/arm/cros_ec.h +new file mode 100644 +index 000000000..45a372572 +--- /dev/null ++++ b/include/grub/arm/cros_ec.h +@@ -0,0 +1,21 @@ ++#ifndef GRUB_ARM_CROS_EC_H ++#define GRUB_ARM_CROS_EC_H 1 ++ ++#include ++#include ++ ++#define GRUB_CROS_EC_KEYSCAN_COLS 13 ++#define GRUB_CROS_EC_KEYSCAN_ROWS 8 ++ ++struct grub_cros_ec_keyscan { ++ grub_uint8_t data[GRUB_CROS_EC_KEYSCAN_COLS]; ++}; ++ ++int ++grub_cros_ec_scan_keyboard (const struct grub_fdtbus_dev *dev, ++ struct grub_cros_ec_keyscan *scan); ++ ++int ++grub_cros_ec_validate (const struct grub_fdtbus_dev *dev); ++ ++#endif +-- +2.13.0 + diff --git a/0034-Missing-parts-of-previous-commit.patch b/0034-Missing-parts-of-previous-commit.patch new file mode 100644 index 00000000..0914ff52 --- /dev/null +++ b/0034-Missing-parts-of-previous-commit.patch @@ -0,0 +1,38 @@ +From c6eaa982d12e3cfc5465dda5ea372774188b6b81 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 09:02:15 +0200 +Subject: [PATCH 034/176] Missing parts of previous commit + +--- + grub-core/Makefile.core.def | 2 ++ + grub-core/kern/arm/coreboot/init.c | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index d2239f171..1d86bd22e 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -162,6 +162,8 @@ kernel = { + arm_coreboot = bus/fdt.c; + arm_coreboot = term/ps2.c; + arm_coreboot = term/arm/pl050.c; ++ arm_coreboot = term/arm/cros.c; ++ arm_coreboot = term/arm/cros_ec.c; + arm_coreboot = bus/spi/rk3288_spi.c; + arm_coreboot = commands/keylayouts.c; + arm_coreboot = kern/arm/coreboot/dma.c; +diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c +index 0126ff638..8d8c5b829 100644 +--- a/grub-core/kern/arm/coreboot/init.c ++++ b/grub-core/kern/arm/coreboot/init.c +@@ -135,6 +135,7 @@ grub_machine_init (void) + grub_rk3288_spi_init (); + + grub_machine_timer_init (); ++ grub_cros_init (); + grub_pl050_init (); + } + +-- +2.13.0 + diff --git a/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch b/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch new file mode 100644 index 00000000..a98dbfdf --- /dev/null +++ b/0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch @@ -0,0 +1,98 @@ +From 70b555a52a065b2beb91e6fc97a6b358c931b303 Mon Sep 17 00:00:00 2001 +From: Julius Werner +Date: Tue, 9 May 2017 09:03:02 +0200 +Subject: [PATCH 035/176] coreboot: Changed cbmemc to support updated console + format from coreboot. + +--- + grub-core/term/i386/coreboot/cbmemc.c | 50 ++++++++++++++++++++++++----------- + 1 file changed, 35 insertions(+), 15 deletions(-) + +diff --git a/grub-core/term/i386/coreboot/cbmemc.c b/grub-core/term/i386/coreboot/cbmemc.c +index 129248c7f..cea9b8431 100644 +--- a/grub-core/term/i386/coreboot/cbmemc.c ++++ b/grub-core/term/i386/coreboot/cbmemc.c +@@ -29,11 +29,14 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + ++#define CURSOR_MASK ((1 << 28) - 1) ++#define OVERFLOW (1 << 31) ++ + struct grub_linuxbios_cbmemc + { + grub_uint32_t size; +- grub_uint32_t pointer; +- char data[0]; ++ grub_uint32_t cursor; ++ char body[0]; + }; + + static struct grub_linuxbios_cbmemc *cbmemc; +@@ -41,11 +44,20 @@ static struct grub_linuxbios_cbmemc *cbmemc; + static void + put (struct grub_term_output *term __attribute__ ((unused)), const int c) + { ++ grub_uint32_t flags, cursor; + if (!cbmemc) + return; +- if (cbmemc->pointer < cbmemc->size) +- cbmemc->data[cbmemc->pointer] = c; +- cbmemc->pointer++; ++ flags = cbmemc->cursor & ~CURSOR_MASK; ++ cursor = cbmemc->cursor & CURSOR_MASK; ++ if (cursor >= cbmemc->size) ++ return; ++ cbmemc->body[cursor++] = c; ++ if (cursor >= cbmemc->size) ++ { ++ cursor = 0; ++ flags |= OVERFLOW; ++ } ++ cbmemc->cursor = flags | cursor; + } + + struct grub_terminfo_output_state grub_cbmemc_terminfo_output = +@@ -87,21 +99,29 @@ grub_cmd_cbmemc (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char *argv[] __attribute__ ((unused))) + { +- grub_size_t len; +- char *str; +- struct grub_linuxbios_cbmemc *cbmemc_saved; ++ grub_size_t size, cursor; ++ struct grub_linuxbios_cbmemc *real_cbmemc; + + if (!cbmemc) + return grub_error (GRUB_ERR_IO, "no CBMEM console found"); + +- len = cbmemc->pointer; +- if (len > cbmemc->size) +- len = cbmemc->size; +- str = cbmemc->data; +- cbmemc_saved = cbmemc; ++ real_cbmemc = cbmemc; + cbmemc = 0; +- grub_xnputs (str, len); +- cbmemc = cbmemc_saved; ++ cursor = real_cbmemc->cursor & CURSOR_MASK; ++ if (!(real_cbmemc->cursor & OVERFLOW) && cursor < real_cbmemc->size) ++ size = cursor; ++ else ++ size = real_cbmemc->size; ++ if (real_cbmemc->cursor & OVERFLOW) ++ { ++ if (cursor > size) ++ cursor = 0; ++ grub_xnputs(real_cbmemc->body + cursor, size - cursor); ++ grub_xnputs(real_cbmemc->body, cursor); ++ } ++ else ++ grub_xnputs(real_cbmemc->body, size); ++ cbmemc = real_cbmemc; + return 0; + } + +-- +2.13.0 + diff --git a/0036-at_keyboard-Fix-falco-chromebook-case.patch b/0036-at_keyboard-Fix-falco-chromebook-case.patch new file mode 100644 index 00000000..702da0f7 --- /dev/null +++ b/0036-at_keyboard-Fix-falco-chromebook-case.patch @@ -0,0 +1,89 @@ +From c4b8bec5fee4e30a165fd14a188cf3ab8eccd095 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Tue, 9 May 2017 14:27:52 +0200 +Subject: [PATCH 036/176] at_keyboard: Fix falco chromebook case. + +EC is slow, so we need few delays for it to toggle the bits correctly. + +Command to enable clock and keyboard were not sent. +--- + grub-core/term/at_keyboard.c | 23 ++++++++++++++--------- + include/grub/at_keyboard.h | 2 ++ + 2 files changed, 16 insertions(+), 9 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index 3ab4e205f..f0a986eb1 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -40,6 +40,8 @@ grub_keyboard_controller_init (void); + static void + keyboard_controller_wait_until_ready (void) + { ++ /* 50 us would be enough but our current time resolution is 1ms. */ ++ grub_millisleep (1); + while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))); + } + +@@ -50,10 +52,11 @@ wait_ack (void) + grub_uint8_t ack; + + endtime = grub_get_time_ms () + 20; +- do ++ do { ++ keyboard_controller_wait_until_ready (); + ack = grub_inb (KEYBOARD_REG_DATA); +- while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK +- && grub_get_time_ms () < endtime); ++ } while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK ++ && grub_get_time_ms () < endtime); + return ack; + } + +@@ -135,12 +138,10 @@ query_mode (void) + if (!e) + return 0; + +- keyboard_controller_wait_until_ready (); +- +- do ++ do { ++ keyboard_controller_wait_until_ready (); + ret = grub_inb (KEYBOARD_REG_DATA); +- while (ret == GRUB_AT_ACK); +- ++ } while (ret == GRUB_AT_ACK); + /* QEMU translates the set even in no-translate mode. */ + if (ret == 0x43 || ret == 1) + return 1; +@@ -169,7 +170,11 @@ set_scancodes (void) + #else + + grub_keyboard_controller_write (grub_keyboard_controller_orig +- & ~KEYBOARD_AT_TRANSLATE); ++ & ~KEYBOARD_AT_TRANSLATE ++ & ~KEYBOARD_AT_DISABLE); ++ ++ keyboard_controller_wait_until_ready (); ++ grub_outb (KEYBOARD_COMMAND_ENABLE, KEYBOARD_REG_DATA); + + write_mode (2); + ps2_state.current_set = query_mode (); +diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h +index b031523eb..bcb4d9ba7 100644 +--- a/include/grub/at_keyboard.h ++++ b/include/grub/at_keyboard.h +@@ -23,9 +23,11 @@ + #define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) + #define KEYBOARD_COMMAND_READ 0x20 + #define KEYBOARD_COMMAND_WRITE 0x60 ++#define KEYBOARD_COMMAND_ENABLE 0xf4 + #define KEYBOARD_COMMAND_REBOOT 0xfe + + #define KEYBOARD_AT_TRANSLATE 0x40 ++#define KEYBOARD_AT_DISABLE 0x10 + + #define KEYBOARD_ISMAKE(x) !((x) & 0x80) + #define KEYBOARD_ISREADY(x) ((x) & 0x01) +-- +2.13.0 + diff --git a/0037-sparc64-Close-cdboot-ihandle.patch b/0037-sparc64-Close-cdboot-ihandle.patch new file mode 100644 index 00000000..bb675a68 --- /dev/null +++ b/0037-sparc64-Close-cdboot-ihandle.patch @@ -0,0 +1,48 @@ +From bd4e40aadded7093908d786d03b4acf60b7b1707 Mon Sep 17 00:00:00 2001 +From: Eric Snowberg +Date: Thu, 11 May 2017 18:42:23 -0700 +Subject: [PATCH 037/176] sparc64: Close cdboot ihandle + +The ihandle is left open with a cd-core image. This will cause a delay +booting grub from a virtual cdrom in a LDOM. It will also cause problems +as Linux boots, since it expects the ihandle to be closed during init. + +Orabug: 25911275 + +Signed-off-by: Eric Snowberg +Reviewed-by: Daniel Kiper +--- + grub-core/boot/sparc64/ieee1275/boot.S | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S +index 586efb401..9ea9b4e06 100644 +--- a/grub-core/boot/sparc64/ieee1275/boot.S ++++ b/grub-core/boot/sparc64/ieee1275/boot.S +@@ -69,6 +69,10 @@ prom_seek_name: .asciz "seek" + prom_read_name: .asciz "read" + prom_exit_name: .asciz "exit" + grub_name: .asciz "GRUB " ++#ifdef CDBOOT ++prom_close_name: .asciz "close" ++#endif ++ + #define GRUB_NAME_LEN 5 + + .align 4 +@@ -213,6 +217,12 @@ bootpath_known: + call prom_call_3_1_o1 + #ifdef CDBOOT + LDUW_ABS(kernel_size, 0x00, %o3) ++ ++ GET_ABS(prom_close_name, %o0) ++ mov 1, %g1 ++ mov 0, %o5 ++ call prom_call ++ mov BOOTDEV_REG, %o1 + #else + mov 512, %o3 + #endif +-- +2.13.0 + diff --git a/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch b/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch new file mode 100644 index 00000000..f1078690 --- /dev/null +++ b/0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch @@ -0,0 +1,32 @@ +From ae5817f1dcbf0b99f7a849f56afe442165317840 Mon Sep 17 00:00:00 2001 +From: Julien Grall +Date: Fri, 19 Feb 2016 16:28:52 +0000 +Subject: [PATCH 038/176] arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64 + +Xen is currently crashing because of malformed compatible property for +the boot module. This is because the property string is not +null-terminated as requested by the ePAR spec. + +Signed-off-by: Julien Grall +Tested-by: Fu Wei +Reviewed-by: Daniel Kiper +--- + grub-core/loader/arm64/xen_boot.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c +index a914eb8e2..8ae43d7e8 100644 +--- a/grub-core/loader/arm64/xen_boot.c ++++ b/grub-core/loader/arm64/xen_boot.c +@@ -156,7 +156,7 @@ prepare_xen_module_params (struct xen_boot_binary *module, void *xen_boot_fdt) + grub_fdt_add_subnode (xen_boot_fdt, chosen_node, module_name); + + retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "compatible", +- MODULE_CUSTOM_COMPATIBLE, sizeof(MODULE_CUSTOM_COMPATIBLE) - 1); ++ MODULE_CUSTOM_COMPATIBLE, sizeof(MODULE_CUSTOM_COMPATIBLE)); + if (retval) + return grub_error (GRUB_ERR_IO, "failed to update FDT"); + +-- +2.13.0 + diff --git a/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch b/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch new file mode 100644 index 00000000..a78cfa0b --- /dev/null +++ b/0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch @@ -0,0 +1,56 @@ +From 8eed7be8a61c295df700e918744a984162378ca9 Mon Sep 17 00:00:00 2001 +From: Fu Wei +Date: Sun, 14 May 2017 15:43:45 +0800 +Subject: [PATCH 039/176] arm64: Add "--nounzip" option support in xen_module + command + +This patch adds "--nounzip" option support in order to +be compatible with the module command of multiboot on other architecture, +by this way we can simplify grub-mkconfig support code. + +This patch also allow us to use zip compressed module(like Linux kernel +for Dom0). + +Signed-off-by: Fu Wei +Reviewed-by: Daniel Kiper +--- + grub-core/loader/arm64/xen_boot.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c +index 8ae43d7e8..27ede46ca 100644 +--- a/grub-core/loader/arm64/xen_boot.c ++++ b/grub-core/loader/arm64/xen_boot.c +@@ -379,6 +379,20 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)), + + struct xen_boot_binary *module = NULL; + grub_file_t file = 0; ++ int nounzip = 0; ++ ++ if (!argc) ++ { ++ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); ++ goto fail; ++ } ++ ++ if (grub_strcmp (argv[0], "--nounzip") == 0) ++ { ++ argv++; ++ argc--; ++ nounzip = 1; ++ } + + if (!argc) + { +@@ -403,6 +417,8 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)), + + grub_dprintf ("xen_loader", "Init module and node info\n"); + ++ if (nounzip) ++ grub_file_filter_disable_compression (); + file = grub_file_open (argv[0]); + if (!file) + goto fail; +-- +2.13.0 + diff --git a/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch b/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch new file mode 100644 index 00000000..35079d54 --- /dev/null +++ b/0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch @@ -0,0 +1,63 @@ +From d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe Mon Sep 17 00:00:00 2001 +From: Fu Wei +Date: Sun, 14 May 2017 15:43:46 +0800 +Subject: [PATCH 040/176] util/grub.d/20_linux_xen.in: Add xen_boot command + support for aarch64 + +This patch adds the support of xen_boot command for aarch64: + xen_hypervisor + xen_module +These two commands are only for aarch64, since it has its own protocol and +commands to boot xen hypervisor and Dom0, but not multiboot. + +For other architectures, they are still using multiboot and module +commands. + +Signed-off-by: Fu Wei +Reviewed-by: Daniel Kiper +--- + util/grub.d/20_linux_xen.in | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in +index c48af948d..c002fc9f9 100644 +--- a/util/grub.d/20_linux_xen.in ++++ b/util/grub.d/20_linux_xen.in +@@ -122,16 +122,16 @@ linux_entry () + else + xen_rm_opts="no-real-mode edd=off" + fi +- multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} ++ ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} + echo '$(echo "$lmessage" | grub_quote)' +- module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} ++ ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} + EOF + if test -n "${initrd}" ; then + # TRANSLATORS: ramdisk isn't identifier. Should be translated. + message="$(gettext_printf "Loading initial ramdisk ...")" + sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' +- module --nounzip ${rel_dirname}/${initrd} ++ ${module_loader} --nounzip ${rel_dirname}/${initrd} + EOF + fi + sed "s/^/$submenu_indentation/" << EOF +@@ -206,6 +206,14 @@ while [ "x${xen_list}" != "x" ] ; do + if [ "x$is_top_level" != xtrue ]; then + echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" + fi ++ $grub_file --is-arm64-efi $current_xen ++ if [ $? -ne 0 ]; then ++ xen_loader="multiboot" ++ module_loader="module" ++ else ++ xen_loader="xen_hypervisor" ++ module_loader="xen_module" ++ fi + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` + gettext_printf "Found linux image: %s\n" "$linux" >&2 +-- +2.13.0 + diff --git a/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch b/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch new file mode 100644 index 00000000..dce5b378 --- /dev/null +++ b/0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch @@ -0,0 +1,93 @@ +From 26c2f306fd425d2c0348023b8dcb7eb40a01851a Mon Sep 17 00:00:00 2001 +From: Fu Wei +Date: Sun, 14 May 2017 15:43:47 +0800 +Subject: [PATCH 041/176] arm64: Update the introduction of Xen boot commands + in docs/grub.texi + +delete: xen_linux, xen_initrd, xen_xsm +add: xen_module + +This update bases on + commit 0edd750e50698854068358ea53528100a9192902 + Author: Vladimir Serbinenko + Date: Fri Jan 22 10:18:47 2016 +0100 + + xen_boot: Remove obsolete module type distinctions. + +Also bases on the module loading mechanism of Xen code: +488c2a8 docs/arm64: clarify the documention for loading XSM support +67831c4 docs/arm64: update the documentation for loading XSM support +ca32012 xen/arm64: check XSM Magic from the second unknown module. + +Signed-off-by: Fu Wei +Reviewed-by: Julien Grall +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 38 +++++++++++++------------------------- + 1 file changed, 13 insertions(+), 25 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index e935af33e..a0c4b9e4e 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -3873,11 +3873,9 @@ you forget a command, you can run the command @command{help} + @comment * vbeinfo:: List available video modes + * verify_detached:: Verify detached digital signature + * videoinfo:: List available video modes +-@comment * xen_*:: Xen boot commands +-* xen_hypervisor:: Load xen hypervisor binary +-* xen_linux:: Load dom0 kernel for xen hypervisor +-* xen_initrd:: Load dom0 initrd for dom0 kernel +-* xen_xsm:: Load xen security module for xen hypervisor ++@comment * xen_*:: Xen boot commands for AArch64 ++* xen_hypervisor:: Load xen hypervisor binary (only on AArch64) ++* xen_module:: Load xen modules for xen hypervisor (only on AArch64) + @end menu + + +@@ -5153,32 +5151,22 @@ List available video modes. If resolution is given, show only matching modes. + Load a Xen hypervisor binary from @var{file}. The rest of the line is passed + verbatim as the @dfn{kernel command-line}. Any other binaries must be + reloaded after using this command. ++This command is only available on AArch64 systems. + @end deffn + +-@node xen_linux +-@subsection xen_linux ++@node xen_module ++@subsection xen_module + +-@deffn Command xen_linux file [arguments] +-Load a dom0 kernel image for xen hypervisor at the booting process of xen. ++@deffn Command xen_module [--nounzip] file [arguments] ++Load a module for xen hypervisor at the booting process of xen. + The rest of the line is passed verbatim as the module command line. ++Modules should be loaded in the following order: ++ - dom0 kernel image ++ - dom0 ramdisk if present ++ - XSM policy if present ++This command is only available on AArch64 systems. + @end deffn + +-@node xen_initrd +-@subsection xen_initrd +- +-@deffn Command xen_initrd file +-Load a initrd image for dom0 kernel at the booting process of xen. +-@end deffn +- +-@node xen_xsm +-@subsection xen_xsm +- +-@deffn Command xen_xsm file +-Load a xen security module for xen hypervisor at the booting process of xen. +-See @uref{http://wiki.xen.org/wiki/XSM} for more detail. +-@end deffn +- +- + @node Networking commands + @section The list of networking commands + +-- +2.13.0 + diff --git a/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch b/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch new file mode 100644 index 00000000..6553c35d --- /dev/null +++ b/0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch @@ -0,0 +1,53 @@ +From f8679cedff703b437171f4708d46adbfcff80a65 Mon Sep 17 00:00:00 2001 +From: Eric Snowberg +Date: Thu, 18 May 2017 17:10:22 -0600 +Subject: [PATCH 042/176] sparc64: Don't use devspec to determine the OBP path + +Don't use devspec to determine the OBP path on SPARC hardware. Within all +versions of Linux on SPARC, the devspec returns one of three values: +"none", "vnet-port", or "vdisk". Unlike on PPC, none of these values +are useful in determining the OBP path. + +Before this patch grub-ofpathname always returned the wrong value +for a virtual disk. For example: + +% grub-ofpathname /dev/vdiskc2 +vdisk/disk@2:b + +After this patch it now returns the correct value: + +% grub-ofpathname /dev/vdiskc2 +/virtual-devices@100/channel-devices@200/disk@2:b + +Orabug: 24459765 + +Signed-off-by: Eric Snowberg +Reviewed-by: Daniel Kiper +--- + grub-core/osdep/linux/ofpath.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c +index a79682a5e..dce4e59d0 100644 +--- a/grub-core/osdep/linux/ofpath.c ++++ b/grub-core/osdep/linux/ofpath.c +@@ -120,6 +120,8 @@ find_obppath (const char *sysfs_path_orig) + #endif + + fd = open(path, O_RDONLY); ++ ++#ifndef __sparc__ + if (fd < 0 || fstat (fd, &st) < 0) + { + if (fd >= 0) +@@ -127,6 +129,7 @@ find_obppath (const char *sysfs_path_orig) + snprintf(path, path_size, "%s/devspec", sysfs_path); + fd = open(path, O_RDONLY); + } ++#endif + + if (fd < 0 || fstat (fd, &st) < 0) + { +-- +2.13.0 + diff --git a/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch b/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch new file mode 100644 index 00000000..05540b0f --- /dev/null +++ b/0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch @@ -0,0 +1,140 @@ +From 734668238fcc0ef691a080839e04f33854fa133a Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Thu, 29 Jun 2017 13:27:49 +0000 +Subject: [PATCH 043/176] Allow GRUB to mount ext2/3/4 filesystems that have + the encryption feature. + +On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set. +For a regular file, this means its contents are encrypted; for a +directory, this means the filenames in its directory entries are +encrypted; and for a symlink, this means its target is encrypted. Since +GRUB cannot decrypt encrypted contents or filenames, just issue an error +if it would need to do so. This is sufficient to allow unencrypted boot +files to co-exist with encrypted files elsewhere on the filesystem. + +(Note that encrypted regular files and symlinks will not normally be +encountered outside an encrypted directory; however, it's possible via +hard links, so they still need to be handled.) + +Tested by booting from an ext4 /boot partition on which I had run +'tune2fs -O encrypt'. I also verified that the expected error messages +are printed when trying to access encrypted directories, files, and +symlinks from the GRUB command line. Also ran 'sudo ./grub-fs-tester +ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+. + +Signed-off-by: Eric Biggers +--- + grub-core/fs/ext2.c | 23 ++++++++++++++++++++++- + tests/ext234_test.in | 1 + + tests/util/grub-fs-tester.in | 10 ++++++++++ + 3 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index cdce63bcc..b8ad75a0f 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -102,6 +102,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 + #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 + #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 ++#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 + + /* The set of back-incompatible features this driver DOES support. Add (OR) + * flags here as the related features are implemented into the driver. */ +@@ -109,7 +110,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + | EXT4_FEATURE_INCOMPAT_EXTENTS \ + | EXT4_FEATURE_INCOMPAT_FLEX_BG \ + | EXT2_FEATURE_INCOMPAT_META_BG \ +- | EXT4_FEATURE_INCOMPAT_64BIT) ++ | EXT4_FEATURE_INCOMPAT_64BIT \ ++ | EXT4_FEATURE_INCOMPAT_ENCRYPT) + /* List of rationales for the ignored "incompatible" features: + * needs_recovery: Not really back-incompatible - was added as such to forbid + * ext2 drivers from mounting an ext3 volume with a dirty +@@ -138,6 +140,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT3_JOURNAL_FLAG_DELETED 4 + #define EXT3_JOURNAL_FLAG_LAST_TAG 8 + ++#define EXT4_ENCRYPT_FLAG 0x800 + #define EXT4_EXTENTS_FLAG 0x80000 + + /* The ext2 superblock. */ +@@ -706,6 +709,12 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) + grub_ext2_read_inode (diro->data, diro->ino, &diro->inode); + if (grub_errno) + return 0; ++ ++ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "symlink is encrypted"); ++ return 0; ++ } + } + + symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1); +@@ -749,6 +758,12 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir, + return 0; + } + ++ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "directory is encrypted"); ++ return 0; ++ } ++ + /* Search the file. */ + while (fpos < grub_le_to_cpu32 (diro->inode.size)) + { +@@ -859,6 +874,12 @@ grub_ext2_open (struct grub_file *file, const char *name) + goto fail; + } + ++ if (fdiro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ err = grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "file is encrypted"); ++ goto fail; ++ } ++ + grub_memcpy (data->inode, &fdiro->inode, sizeof (struct grub_ext2_inode)); + grub_free (fdiro); + +diff --git a/tests/ext234_test.in b/tests/ext234_test.in +index 892b99cbd..4f1eb527e 100644 +--- a/tests/ext234_test.in ++++ b/tests/ext234_test.in +@@ -30,3 +30,4 @@ fi + "@builddir@/grub-fs-tester" ext3 + "@builddir@/grub-fs-tester" ext4 + "@builddir@/grub-fs-tester" ext4_metabg ++"@builddir@/grub-fs-tester" ext4_encrypt +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index 88cbe7365..fd7e0f14b 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -156,6 +156,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + # Could go further but what's the point? + MAXBLKSIZE=$((65536*1024)) + ;; ++ xext4_encrypt) ++ # OS LIMITATION: Linux currently only allows the 'encrypt' feature ++ # in combination with block_size = PAGE_SIZE (4096 bytes on x86). ++ MINBLKSIZE=$(getconf PAGE_SIZE) ++ MAXBLKSIZE=$MINBLKSIZE ++ ;; + xext*) + MINBLKSIZE=1024 + if [ $MINBLKSIZE -lt $SECSIZE ]; then +@@ -796,6 +802,10 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O meta_bg,^resize_inode -b $BLKSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" + MOUNTFS=ext4 + ;; ++ xext4_encrypt) ++ MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O encrypt -b $BLKSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" ++ MOUNTFS=ext4 ++ ;; + xext*) + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.$fs" -b $BLKSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; + xxfs) +-- +2.13.0 + diff --git a/0044-ehci-Fix-compilation-for-amd64.patch b/0044-ehci-Fix-compilation-for-amd64.patch new file mode 100644 index 00000000..ae9e8b45 --- /dev/null +++ b/0044-ehci-Fix-compilation-for-amd64.patch @@ -0,0 +1,38 @@ +From edb37fb30bbc8a3b6bec67911c7200e4eb071127 Mon Sep 17 00:00:00 2001 +From: phcoder +Date: Sun, 9 Jul 2017 20:58:31 +0200 +Subject: [PATCH 044/176] ehci: Fix compilation for amd64 + +--- + grub-core/bus/usb/ehci.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c +index c772e7654..7b7061f53 100644 +--- a/grub-core/bus/usb/ehci.c ++++ b/grub-core/bus/usb/ehci.c +@@ -504,8 +504,8 @@ grub_ehci_init_device (volatile void *regs) + #endif + + grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", +- (grub_addr_t) e->iobase_ehcc + caplen); ++ "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llxx\n", ++ (unsigned long long) e->iobase_ehcc + caplen); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +@@ -696,8 +696,8 @@ grub_ehci_init_device (volatile void *regs) + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: OK at all\n"); + + grub_dprintf ("ehci", +- "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", +- (grub_addr_t) regs); ++ "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llx\n", ++ (unsigned long long) regs); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +-- +2.13.0 + diff --git a/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch b/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch new file mode 100644 index 00000000..db67efad --- /dev/null +++ b/0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch @@ -0,0 +1,27 @@ +From d8901e3ba115d705c9c08ecedd201aca8b4867b8 Mon Sep 17 00:00:00 2001 +From: phcoder +Date: Sun, 9 Jul 2017 20:59:15 +0200 +Subject: [PATCH 045/176] cache: Fix compilation for ppc, sparc and arm64 + +--- + include/grub/cache.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/grub/cache.h b/include/grub/cache.h +index 1c98ce270..ccfa717e6 100644 +--- a/include/grub/cache.h ++++ b/include/grub/cache.h +@@ -34,7 +34,9 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len); + #endif + + #ifndef GRUB_MACHINE_EMU +-#if defined (__i386__) || defined (__x86_64__) ++#if defined (__aarch64__) || defined (__powerpc__) || defined (__sparc__) ++ ++#elif defined (__i386__) || defined (__x86_64__) + static inline void + grub_arch_sync_dma_caches (volatile void *address __attribute__ ((unused)), + grub_size_t len __attribute__ ((unused))) +-- +2.13.0 + diff --git a/0046-ehci-Fix-compilation-on-i386.patch b/0046-ehci-Fix-compilation-on-i386.patch new file mode 100644 index 00000000..b2066505 --- /dev/null +++ b/0046-ehci-Fix-compilation-on-i386.patch @@ -0,0 +1,34 @@ +From 284afab081ef7ed7db2c59151853aa3c92d988f2 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Sun, 9 Jul 2017 21:31:19 +0200 +Subject: [PATCH 046/176] ehci: Fix compilation on i386 + +--- + grub-core/bus/usb/ehci.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c +index 7b7061f53..d966fc210 100644 +--- a/grub-core/bus/usb/ehci.c ++++ b/grub-core/bus/usb/ehci.c +@@ -505,7 +505,7 @@ grub_ehci_init_device (volatile void *regs) + + grub_dprintf ("ehci", + "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llxx\n", +- (unsigned long long) e->iobase_ehcc + caplen); ++ (unsigned long long) (grub_addr_t) e->iobase_ehcc + caplen); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +@@ -697,7 +697,7 @@ grub_ehci_init_device (volatile void *regs) + + grub_dprintf ("ehci", + "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llx\n", +- (unsigned long long) regs); ++ (unsigned long long) (grub_addr_t) regs); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", + grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", +-- +2.13.0 + diff --git a/0047-crypto-Fix-use-after-free.patch b/0047-crypto-Fix-use-after-free.patch new file mode 100644 index 00000000..1f1bccf5 --- /dev/null +++ b/0047-crypto-Fix-use-after-free.patch @@ -0,0 +1,28 @@ +From a0fe0c26aa8a1c0ad66d9527611bd726b849c623 Mon Sep 17 00:00:00 2001 +From: AppChecker +Date: Sun, 9 Jul 2017 21:57:35 +0200 +Subject: [PATCH 047/176] crypto: Fix use after free. + +Reported by: AppChecker +Transformed to patch by: Satish Govindarajan +--- + grub-core/normal/crypto.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/normal/crypto.c b/grub-core/normal/crypto.c +index 2bfd67c8e..e6d345f33 100644 +--- a/grub-core/normal/crypto.c ++++ b/grub-core/normal/crypto.c +@@ -147,8 +147,8 @@ read_crypto_list (const char *prefix) + if (! cur->modname) + { + grub_errno = GRUB_ERR_NONE; +- grub_free (cur); + grub_free (cur->name); ++ grub_free (cur); + continue; + } + cur->next = crypto_specs; +-- +2.13.0 + diff --git a/0048-arm-efi-Fix-compilation.patch b/0048-arm-efi-Fix-compilation.patch new file mode 100644 index 00000000..ff017d75 --- /dev/null +++ b/0048-arm-efi-Fix-compilation.patch @@ -0,0 +1,41 @@ +From cb8b7e4e36bf32dccbbba8252aa44ad3ada4fbc1 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Sun, 9 Jul 2017 21:48:37 +0000 +Subject: [PATCH 048/176] arm-efi: Fix compilation + +--- + grub-core/loader/arm/linux.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c +index 260cbf068..e64c79a95 100644 +--- a/grub-core/loader/arm/linux.c ++++ b/grub-core/loader/arm/linux.c +@@ -252,12 +252,12 @@ linux_boot (void) + #ifdef GRUB_MACHINE_EFI + grub_size_t size; + if (fdt_valid) +- size = grub_fdt_get_totalsize (fdt_addr); ++ size = grub_fdt_get_totalsize (current_fdt); + else +- size = 4 * get_atag_size (atag_orig); ++ size = 4 * get_atag_size (current_fdt); + size += grub_strlen (linux_args) + 256; + target_fdt = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); +- if (!fdt_addr) ++ if (!target_fdt) + return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); + #else + target_fdt = (void *) LINUX_FDT_ADDRESS; +@@ -522,7 +522,7 @@ GRUB_MOD_INIT (linux) + /* TRANSLATORS: DTB stands for device tree blob. */ + 0, N_("Load DTB file.")); + my_mod = mod; +- current_fdt = grub_arm_firmware_get_boot_data (); ++ current_fdt = (const void *) grub_arm_firmware_get_boot_data (); + machine_type = grub_arm_firmware_get_machine_type (); + } + +-- +2.13.0 + diff --git a/0049-fdt-silence-clang-warning.patch b/0049-fdt-silence-clang-warning.patch new file mode 100644 index 00000000..398d92f2 --- /dev/null +++ b/0049-fdt-silence-clang-warning.patch @@ -0,0 +1,26 @@ +From 68d54b55f49249c5e0517bf189f0f3df7ee6a36f Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Mon, 10 Jul 2017 01:34:22 +0000 +Subject: [PATCH 049/176] fdt: silence clang warning. + +--- + grub-core/lib/fdt.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c +index bdc630244..2705f2629 100644 +--- a/grub-core/lib/fdt.c ++++ b/grub-core/lib/fdt.c +@@ -309,7 +309,8 @@ advance_token (const void *fdt, const grub_uint32_t *token, const grub_uint32_t + continue; + } + char *ptr; +- for (ptr = (char *) (token + 1); *ptr && ptr < (char *) end; ptr++); ++ for (ptr = (char *) (token + 1); *ptr && ptr < (char *) end; ptr++) ++ ; + if (ptr >= (char *) end) + return 0; + return token; +-- +2.13.0 + diff --git a/0004-Fix-bzr-s-ignore-artificats-in-.gitignore.patch b/0050-Fix-bzr-s-ignore-artificats-in-.gitignore.patch similarity index 86% rename from 0004-Fix-bzr-s-ignore-artificats-in-.gitignore.patch rename to 0050-Fix-bzr-s-ignore-artificats-in-.gitignore.patch index 7705c8e3..3f5a128a 100644 --- a/0004-Fix-bzr-s-ignore-artificats-in-.gitignore.patch +++ b/0050-Fix-bzr-s-ignore-artificats-in-.gitignore.patch @@ -1,18 +1,18 @@ -From 512fe6865738286c94f87da64ca6b475bc3e2f38 Mon Sep 17 00:00:00 2001 +From 229239b69319cd39d36d85551144dfe7ebf0d5e1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 7 Jul 2015 10:13:14 -0400 -Subject: [PATCH 04/90] Fix bzr's ignore artificats in .gitignore +Subject: [PATCH 050/176] Fix bzr's ignore artificats in .gitignore We lost a man page because of incompatibilities between bzr's ignore system and .gitignore, so solve that slightly better. Signed-off-by: Peter Jones --- - .gitignore | 265 ++++++++++++++++++++++++++++--------------------------------- - 1 file changed, 120 insertions(+), 145 deletions(-) + .gitignore | 257 ++++++++++++++++++++++++++++++------------------------------- + 1 file changed, 127 insertions(+), 130 deletions(-) diff --git a/.gitignore b/.gitignore -index 18ab8e8..06c9f3a 100644 +index eca17bec9..e82aa55b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,93 +1,154 @@ @@ -65,18 +65,25 @@ index 18ab8e8..06c9f3a 100644 build-grub-mkfont cdboot_test cmp_test -+compile -+config-util.h -+config-util.h.in - config.cache - config.guess - config.h +-config.cache +-config.guess +-config.h -config-util.h -config-util.h.in - config.log - config.status - config.sub - configure +-config.log +-config.status +-config.sub +-configure ++compile ++/config-util.h ++/config-util.h.in ++/config.cache ++/config.guess ++/config.h ++/config.log ++/config.status ++/config.sub ++/configure +contrib core_compress_test -DISTLIST @@ -214,7 +221,7 @@ index 18ab8e8..06c9f3a 100644 grub_script_check_init.c grub_script_check_init.h grub_script_comments -@@ -113,136 +174,50 @@ grub_script_strcmp +@@ -113,115 +174,50 @@ grub_script_strcmp grub_script_test grub_script_vars1 grub_script_while1 @@ -343,29 +350,12 @@ index 18ab8e8..06c9f3a 100644 -grub-core/rs_decoder.h widthspec.bin widthspec.h --docs/stamp-1 --docs/version-dev.texi --Makefile.utilgcry.def --po/*.po --po/*.gmo --po/LINGUAS --po/remove-potcdate.sed --include/grub/gcrypt/gcrypt.h --include/grub/gcrypt/g10lib.h --po/POTFILES.in --po/POTFILES-shell.in --/grub-glue-efi --/grub-render-label --/grub-glue-efi.exe --/grub-render-label.exe --grub-core/gnulib/locale.h --grub-core/gnulib/unitypes.h --grub-core/gnulib/uniwidth.h --build-aux/test-driver --/garbage-gen --/garbage-gen.exe --/grub-fs-tester + docs/stamp-1 +@@ -247,3 +243,4 @@ build-aux/test-driver + /garbage-gen.exe + /grub-fs-tester + grub-core/build-grub-module-verifier +xzcompress_test -- -2.9.3 +2.13.0 diff --git a/0001-IBM-client-architecture-CAS-reboot-support.patch b/0051-IBM-client-architecture-CAS-reboot-support.patch similarity index 95% rename from 0001-IBM-client-architecture-CAS-reboot-support.patch rename to 0051-IBM-client-architecture-CAS-reboot-support.patch index 22c682da..5bf8bdd0 100644 --- a/0001-IBM-client-architecture-CAS-reboot-support.patch +++ b/0051-IBM-client-architecture-CAS-reboot-support.patch @@ -1,7 +1,7 @@ -From e32c57d2abd034cbdea24a8f51de8dbef453bd96 Mon Sep 17 00:00:00 2001 +From a0103db268b36f4c772643afaf818d719143edda Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Thu, 20 Sep 2012 18:07:39 -0300 -Subject: [PATCH 01/90] IBM client architecture (CAS) reboot support +Subject: [PATCH 051/176] IBM client architecture (CAS) reboot support This is an implementation of IBM client architecture (CAS) reboot for GRUB. @@ -25,7 +25,7 @@ parameters 4 files changed, 90 insertions(+) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index ddb7783..6db8b98 100644 +index ddb778340..6db8b9865 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -561,3 +561,65 @@ grub_ieee1275_canonicalise_devname (const char *path) @@ -95,7 +95,7 @@ index ddb7783..6db8b98 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 78a70a8..249e19b 100644 +index 78a70a8bf..249e19bc7 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -33,6 +33,9 @@ @@ -132,7 +132,7 @@ index 78a70a8..249e19b 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index a8502d9..ab78ca8 100644 +index a8502d907..ab78ca87f 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -27,6 +27,9 @@ @@ -157,7 +157,7 @@ index a8502d9..ab78ca8 100644 { char *line; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 8e42513..9f26c69 100644 +index 8e4251303..9f26c69a2 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -234,6 +234,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali @@ -170,5 +170,5 @@ index 8e42513..9f26c69 100644 #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) -- -2.9.3 +2.13.0 diff --git a/0002-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0052-for-ppc-reset-console-display-attr-when-clear-screen.patch similarity index 85% rename from 0002-for-ppc-reset-console-display-attr-when-clear-screen.patch rename to 0052-for-ppc-reset-console-display-attr-when-clear-screen.patch index 3582760b..a729c6d5 100644 --- a/0002-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0052-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -1,7 +1,7 @@ -From 4f82466e3b1fcf3370d82432e406f51906e1fa46 Mon Sep 17 00:00:00 2001 +From 86ac14fb559afa7e5009e2b663ee0189b4a55e94 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 24 Apr 2013 10:51:48 -0300 -Subject: [PATCH 02/90] for ppc, reset console display attr when clear screen +Subject: [PATCH 052/176] for ppc, reset console display attr when clear screen v2: Also use \x0c instead of a literal ^L to make future patches less awkward. @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index f0d3e3d..9bb75c1 100644 +index f0d3e3deb..9bb75c173 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, @@ -28,5 +28,5 @@ index f0d3e3d..9bb75c1 100644 data->reverse_video_off = grub_strdup ("\e[m"); if (grub_strcmp ("ieee1275", str) == 0) -- -2.9.3 +2.13.0 diff --git a/0003-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0053-Disable-GRUB-video-support-for-IBM-power-machines.patch similarity index 86% rename from 0003-Disable-GRUB-video-support-for-IBM-power-machines.patch rename to 0053-Disable-GRUB-video-support-for-IBM-power-machines.patch index 335100a4..bf1a4818 100644 --- a/0003-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0053-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -1,7 +1,7 @@ -From 9cff6efa3a7e15a6968fed29a29f38713da864fd Mon Sep 17 00:00:00 2001 +From a87849e382cd6e417bfc4bcf33a907617a5b7494 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 11 Jun 2013 15:14:05 -0300 -Subject: [PATCH 03/90] Disable GRUB video support for IBM power machines +Subject: [PATCH 053/176] Disable GRUB video support for IBM power machines Should fix the problem in bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=973205 @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=973205 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 3e12e6b..3e14f53 100644 +index 3e12e6b24..3e14f5393 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) @@ -28,10 +28,10 @@ index 3e12e6b..3e14f53 100644 /* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c -index 0b150ec..813ab38 100644 +index 17a3dbbb5..b8e4b3feb 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c -@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = +@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = GRUB_MOD_INIT(ieee1275_fb) { @@ -48,7 +48,7 @@ index 0b150ec..813ab38 100644 GRUB_MOD_FINI(ieee1275_fb) diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 9f26c69..ab4f284 100644 +index 9f26c69a2..ab4f284c3 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -146,6 +146,8 @@ enum grub_ieee1275_flag @@ -61,5 +61,5 @@ index 9f26c69..ab4f284 100644 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); -- -2.9.3 +2.13.0 diff --git a/0005-Honor-a-symlink-when-generating-configuration-by-gru.patch b/0054-Honor-a-symlink-when-generating-configuration-by-gru.patch similarity index 80% rename from 0005-Honor-a-symlink-when-generating-configuration-by-gru.patch rename to 0054-Honor-a-symlink-when-generating-configuration-by-gru.patch index 5977a221..6c04a185 100644 --- a/0005-Honor-a-symlink-when-generating-configuration-by-gru.patch +++ b/0054-Honor-a-symlink-when-generating-configuration-by-gru.patch @@ -1,7 +1,7 @@ -From 7f1ea377390345b8ef7609ad0fa2952708b17e19 Mon Sep 17 00:00:00 2001 +From e34b379ba33181e212952f39b4db1e48f08f0c14 Mon Sep 17 00:00:00 2001 From: Marcel Kolaja Date: Tue, 21 Jan 2014 10:57:08 -0500 -Subject: [PATCH 05/90] Honor a symlink when generating configuration by +Subject: [PATCH 054/176] Honor a symlink when generating configuration by grub2-mkconfig Honor a symlink when generating configuration by grub2-mkconfig, so that @@ -11,7 +11,7 @@ the -o option follows it rather than overwriting it with a regular file. 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8496d2..3b070fd 100644 +index f8496d28b..3b070fd76 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -276,7 +276,8 @@ and /etc/grub.d/* files or please file a bug report with @@ -25,5 +25,5 @@ index f8496d2..3b070fd 100644 fi -- -2.9.3 +2.13.0 diff --git a/0006-Move-bash-completion-script-922997.patch b/0055-Move-bash-completion-script-922997.patch similarity index 83% rename from 0006-Move-bash-completion-script-922997.patch rename to 0055-Move-bash-completion-script-922997.patch index 4f60fb00..e72c14e8 100644 --- a/0006-Move-bash-completion-script-922997.patch +++ b/0055-Move-bash-completion-script-922997.patch @@ -1,7 +1,7 @@ -From 5b77e510eb6e4b649c53ab0790cdc9fdf0c85be9 Mon Sep 17 00:00:00 2001 +From 6ba0717b7f678ca175d63673e58a0c9a5e9f7fb0 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Apr 2013 14:35:34 -0400 -Subject: [PATCH 06/90] Move bash completion script (#922997) +Subject: [PATCH 055/176] Move bash completion script (#922997) Apparently these go in a new place now. --- @@ -10,10 +10,10 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 9ddfc53..ab9134c 100644 +index 571f7a0b5..9ae97f026 100644 --- a/configure.ac +++ b/configure.ac -@@ -287,6 +287,14 @@ AC_SUBST(grubdirname) +@@ -288,6 +288,14 @@ AC_SUBST(grubdirname) AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", [Default grub directory name]) @@ -28,7 +28,7 @@ index 9ddfc53..ab9134c 100644 # # Checks for build programs. # -@@ -476,6 +484,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" +@@ -497,6 +505,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" # Check for target programs. # @@ -39,7 +39,7 @@ index 9ddfc53..ab9134c 100644 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then tmp_ac_tool_prefix="$ac_tool_prefix" diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am -index 136287c..61108f0 100644 +index 136287cf1..61108f054 100644 --- a/util/bash-completion.d/Makefile.am +++ b/util/bash-completion.d/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) @@ -51,5 +51,5 @@ index 136287c..61108f0 100644 $(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status -- -2.9.3 +2.13.0 diff --git a/0007-Update-to-minilzo-2.08.patch b/0056-Update-to-minilzo-2.08.patch similarity index 99% rename from 0007-Update-to-minilzo-2.08.patch rename to 0056-Update-to-minilzo-2.08.patch index cb8e4a66..e1a74592 100644 --- a/0007-Update-to-minilzo-2.08.patch +++ b/0056-Update-to-minilzo-2.08.patch @@ -1,7 +1,7 @@ -From 579ecb682efc5221b4a13b8009af1731f5349912 Mon Sep 17 00:00:00 2001 +From 9c517c4205e02f920fd12995710017b7558bffda Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Dec 2014 15:36:09 -0500 -Subject: [PATCH 07/90] Update to minilzo-2.08 +Subject: [PATCH 056/176] Update to minilzo-2.08 This fixes CVE-2014-4607 - lzo: lzo1x_decompress_safe() integer overflow @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 4 files changed, 4630 insertions(+), 2010 deletions(-) diff --git a/grub-core/lib/minilzo/lzoconf.h b/grub-core/lib/minilzo/lzoconf.h -index 1d0fe14..61be29c 100644 +index 1d0fe14fc..61be29c5d 100644 --- a/grub-core/lib/minilzo/lzoconf.h +++ b/grub-core/lib/minilzo/lzoconf.h @@ -2,22 +2,7 @@ @@ -353,7 +353,7 @@ index 1d0fe14..61be29c 100644 -/* vim:set ts=4 et: */ +/* vim:set ts=4 sw=4 et: */ diff --git a/grub-core/lib/minilzo/lzodefs.h b/grub-core/lib/minilzo/lzodefs.h -index 0e40e33..f4ae948 100644 +index 0e40e332a..f4ae9487e 100644 --- a/grub-core/lib/minilzo/lzodefs.h +++ b/grub-core/lib/minilzo/lzodefs.h @@ -2,22 +2,7 @@ @@ -3361,7 +3361,7 @@ index 0e40e33..f4ae948 100644 -/* vim:set ts=4 et: */ +/* vim:set ts=4 sw=4 et: */ diff --git a/grub-core/lib/minilzo/minilzo.c b/grub-core/lib/minilzo/minilzo.c -index 25a1f68..ab2be5f 100644 +index 25a1f68b3..ab2be5f4f 100644 --- a/grub-core/lib/minilzo/minilzo.c +++ b/grub-core/lib/minilzo/minilzo.c @@ -2,22 +2,7 @@ @@ -8740,7 +8740,7 @@ index 25a1f68..ab2be5f 100644 /***** End of minilzo.c *****/ - diff --git a/grub-core/lib/minilzo/minilzo.h b/grub-core/lib/minilzo/minilzo.h -index 74fefa9..7937454 100644 +index 74fefa9fe..793745467 100644 --- a/grub-core/lib/minilzo/minilzo.h +++ b/grub-core/lib/minilzo/minilzo.h @@ -2,22 +2,7 @@ @@ -8786,5 +8786,5 @@ index 74fefa9..7937454 100644 -- -2.9.3 +2.13.0 diff --git a/0009-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0057-Allow-fallback-to-include-entries-by-title-not-just-.patch similarity index 94% rename from 0009-Allow-fallback-to-include-entries-by-title-not-just-.patch rename to 0057-Allow-fallback-to-include-entries-by-title-not-just-.patch index 37f85f19..13ab76d7 100644 --- a/0009-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0057-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -1,8 +1,8 @@ -From 196ae5abd961cd64b60d9ab41bfc02d340e8bb6f Mon Sep 17 00:00:00 2001 +From 5fcbbf442dfa3b1d922bff02038ec480ea02c866 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 5 Sep 2014 10:07:04 -0400 -Subject: [PATCH 09/90] Allow "fallback" to include entries by title, not just - number. +Subject: [PATCH 057/176] Allow "fallback" to include entries by title, not + just number. Resolves: rhbz#1026084 @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 719e2fb..2e8a7bd 100644 +index 719e2fb1c..2e8a7bd89 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -163,16 +163,41 @@ grub_menu_set_timeout (int timeout) @@ -140,5 +140,5 @@ index 719e2fb..2e8a7bd 100644 static int get_entry_number (grub_menu_t menu, const char *name) -- -2.9.3 +2.13.0 diff --git a/0010-Add-GRUB_DISABLE_UUID.patch b/0058-Add-GRUB_DISABLE_UUID.patch similarity index 94% rename from 0010-Add-GRUB_DISABLE_UUID.patch rename to 0058-Add-GRUB_DISABLE_UUID.patch index 6bd4ca77..0b006ed2 100644 --- a/0010-Add-GRUB_DISABLE_UUID.patch +++ b/0058-Add-GRUB_DISABLE_UUID.patch @@ -1,7 +1,7 @@ -From 8f405e93871ad51cd9ab4dfdea844042a33fa7f0 Mon Sep 17 00:00:00 2001 +From 9da68ff7f22e8736fba4e1aef91e2acdc2b2b2c3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 16:49:25 -0400 -Subject: [PATCH 10/90] Add GRUB_DISABLE_UUID. +Subject: [PATCH 058/176] Add GRUB_DISABLE_UUID. This will cause "search --fs-uuid --set=root ..." not to be generated by grub2-mkconfig, and instead simply attempt to use the grub device name @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 82f6fa4..98d4d0d 100644 +index a0c4b9e4e..6fdd2a041 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1409,6 +1409,13 @@ disable the use of UUIDs, set this option to @samp{true}. @@ -33,7 +33,7 @@ index 82f6fa4..98d4d0d 100644 If graphical video support is required, either because the @samp{gfxterm} graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 3b070fd..c088b70 100644 +index 3b070fd76..c088b7054 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -133,11 +133,11 @@ fi @@ -73,7 +73,7 @@ index 3b070fd..c088b70 100644 GRUB_GFXMODE \ GRUB_BACKGROUND \ diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 60b31ca..cf35e41 100644 +index 60b31cadd..cf35e4174 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -156,7 +156,7 @@ prepare_grub_to_access_device () @@ -95,5 +95,5 @@ index 60b31ca..cf35e41 100644 else echo $device |sed 's, ,_,g' -- -2.9.3 +2.13.0 diff --git a/0011-Make-exit-take-a-return-code.patch b/0059-Make-exit-take-a-return-code.patch similarity index 88% rename from 0011-Make-exit-take-a-return-code.patch rename to 0059-Make-exit-take-a-return-code.patch index 1bae1cdb..f230f5ef 100644 --- a/0011-Make-exit-take-a-return-code.patch +++ b/0059-Make-exit-take-a-return-code.patch @@ -1,7 +1,7 @@ -From 6879936079d17ace35cebcab787f7fb9f8cd205e Mon Sep 17 00:00:00 2001 +From 0dc6c8bd6c7e49868a62a6da4194035d0f70f9ea Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 26 Feb 2014 21:49:12 -0500 -Subject: [PATCH 11/90] Make "exit" take a return code. +Subject: [PATCH 059/176] Make "exit" take a return code. This adds "exit" with a return code. With this patch, any "exit" command /may/ include a return code, and on platforms that support @@ -27,7 +27,7 @@ Signed-off-by: Peter Jones 14 files changed, 39 insertions(+), 21 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index a3a1182..b25ca4b 100644 +index a3a118241..b25ca4b9f 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c @@ -176,12 +176,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), @@ -60,7 +60,7 @@ index a3a1182..b25ca4b 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index caf9bcc..101307f 100644 +index d467785fc..684ca93f8 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -155,11 +155,16 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) @@ -83,10 +83,10 @@ index caf9bcc..101307f 100644 } diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index f91280f..34634d3 100644 +index 425bb9603..55ea5a11c 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c -@@ -66,7 +66,7 @@ grub_reboot (void) +@@ -67,7 +67,7 @@ grub_reboot (void) } void @@ -96,10 +96,10 @@ index f91280f..34634d3 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index d361feb..331fa62 100644 +index 76661337f..82012a72f 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -136,9 +136,10 @@ xasprintf (const char *fmt, ...) +@@ -137,9 +137,10 @@ xasprintf (const char *fmt, ...) #if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL) void @@ -113,7 +113,7 @@ index d361feb..331fa62 100644 #endif diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c -index 3314f02..36f9134 100644 +index 3314f027f..36f9134b7 100644 --- a/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c @@ -41,7 +41,7 @@ extern grub_uint8_t _end[]; @@ -126,7 +126,7 @@ index 3314f02..36f9134 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c -index 271b6fb..9fafe98 100644 +index 271b6fbfa..9fafe98f0 100644 --- a/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c @@ -42,7 +42,7 @@ extern grub_uint8_t _end[]; @@ -139,7 +139,7 @@ index 271b6fb..9fafe98 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 5fa26e1..8a3ecd5 100644 +index 12590225e..e69c0133e 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -68,7 +68,7 @@ grub_addr_t grub_ieee1275_original_stack; @@ -152,7 +152,7 @@ index 5fa26e1..8a3ecd5 100644 grub_ieee1275_exit (); } diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index 3834a14..86b3a25 100644 +index 3834a1490..86b3a25ec 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -276,7 +276,7 @@ grub_halt (void) @@ -165,7 +165,7 @@ index 3834a14..86b3a25 100644 GRUB_ARC_FIRMWARE_VECTOR->exit (); diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c -index 7b96531..dff598c 100644 +index 7b96531b9..dff598ca7 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -304,7 +304,7 @@ grub_halt (void) @@ -178,7 +178,7 @@ index 7b96531..dff598c 100644 grub_halt (); } diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c -index be88b77..8b6c55f 100644 +index be88b77d2..8b6c55ffc 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused))) @@ -191,10 +191,10 @@ index be88b77..8b6c55f 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index d1a54df..6bb0351 100644 +index 3b633d51f..952411d5d 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1094,7 +1094,7 @@ grub_abort (void) +@@ -1095,7 +1095,7 @@ grub_abort (void) grub_getkey (); } @@ -204,11 +204,11 @@ index d1a54df..6bb0351 100644 void diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c -index 5dcc106..430c62b 100644 +index 3e338645c..be2a5be1d 100644 --- a/grub-core/kern/uboot/init.c +++ b/grub-core/kern/uboot/init.c -@@ -43,9 +43,9 @@ extern grub_uint32_t grub_uboot_machine_type; - extern grub_addr_t grub_uboot_boot_data; +@@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size; + static unsigned long timer_start; void -grub_exit (void) @@ -218,8 +218,8 @@ index 5dcc106..430c62b 100644 + grub_uboot_return (rc < 0 ? 1 : rc); } - grub_uint32_t -@@ -94,7 +94,7 @@ grub_machine_init (void) + static grub_uint64_t +@@ -78,7 +78,7 @@ grub_machine_init (void) if (!ver) { /* Don't even have a console to log errors to... */ @@ -229,7 +229,7 @@ index 5dcc106..430c62b 100644 else if (ver > API_SIG_VERSION) { diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c -index 0559c03..fce526d 100644 +index 0559c033c..fce526d41 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c @@ -549,7 +549,7 @@ grub_machine_init (void) @@ -242,7 +242,7 @@ index 0559c03..fce526d 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index 2a9f87c..0620814 100644 +index 2a9f87cc2..062081437 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -334,7 +334,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, @@ -255,5 +255,5 @@ index 2a9f87c..0620814 100644 grub_uint64_t d, grub_uint64_t *r); -- -2.9.3 +2.13.0 diff --git a/0012-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch b/0060-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch similarity index 65% rename from 0012-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch rename to 0060-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch index e9477047..5c2f8da8 100644 --- a/0012-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch +++ b/0060-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch @@ -1,8 +1,8 @@ -From ef756db92dd4f47ed4bb4aede86d33326b0b9188 Mon Sep 17 00:00:00 2001 +From 8ef312cf5646d4348bcd2bd1c059c6b6f905eade Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 22 Jul 2015 11:21:01 -0400 -Subject: [PATCH 12/90] Mark po/exclude.pot as binary so git won't try to diff - nonprintables. +Subject: [PATCH 060/176] Mark po/exclude.pot as binary so git won't try to + diff nonprintables. Signed-off-by: Peter Jones --- @@ -12,11 +12,11 @@ Signed-off-by: Peter Jones diff --git a/.gitattributes b/.gitattributes new file mode 100644 -index 0000000..33ffaa4 +index 000000000..33ffaa404 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +po/exclude.pot binary -- -2.9.3 +2.13.0 diff --git a/0013-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0061-Make-efi-machines-load-an-env-block-from-a-variable.patch similarity index 89% rename from 0013-Make-efi-machines-load-an-env-block-from-a-variable.patch rename to 0061-Make-efi-machines-load-an-env-block-from-a-variable.patch index cf4e42d1..3d119689 100644 --- a/0013-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0061-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -1,7 +1,7 @@ -From e14c5369fea76d1e067ca9f7e5e55bfe615cb639 Mon Sep 17 00:00:00 2001 +From 3166b161eb1b6ea023558067cf58c1872f52ec0c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 7 Dec 2015 14:20:49 -0500 -Subject: [PATCH 13/90] Make efi machines load an env block from a variable +Subject: [PATCH 061/176] Make efi machines load an env block from a variable Signed-off-by: Peter Jones --- @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 58b4208..f8d4634 100644 +index 1d86bd22e..5df543d79 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -173,6 +173,7 @@ kernel = { +@@ -191,6 +191,7 @@ kernel = { efi = term/efi/console.c; efi = kern/acpi.c; efi = kern/efi/acpi.c; @@ -22,7 +22,7 @@ index 58b4208..f8d4634 100644 i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index e9c85de..a5b6c1d 100644 +index 2c31847bf..f7782b6e1 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -25,9 +25,40 @@ @@ -80,5 +80,5 @@ index e9c85de..a5b6c1d 100644 char **path); -- -2.9.3 +2.13.0 diff --git a/0014-DHCP-client-ID-and-UUID-options-added.patch b/0062-DHCP-client-ID-and-UUID-options-added.patch similarity index 92% rename from 0014-DHCP-client-ID-and-UUID-options-added.patch rename to 0062-DHCP-client-ID-and-UUID-options-added.patch index aefc4af4..3e08fe3a 100644 --- a/0014-DHCP-client-ID-and-UUID-options-added.patch +++ b/0062-DHCP-client-ID-and-UUID-options-added.patch @@ -1,7 +1,7 @@ -From 12fb24b4d8a8f0fd7f79bc224157c290ebab31f4 Mon Sep 17 00:00:00 2001 +From 653191c5d89a6b3e0b70c339fb6dca0f0b682030 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:18:53 -0200 -Subject: [PATCH 14/90] DHCP client ID and UUID options added. +Subject: [PATCH 062/176] DHCP client ID and UUID options added. --- grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----- @@ -9,7 +9,7 @@ Subject: [PATCH 14/90] DHCP client ID and UUID options added. 2 files changed, 81 insertions(+), 8 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 189551a..a9c8f47 100644 +index 9e2fdb795..f03eeab2f 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -25,6 +25,49 @@ @@ -112,7 +112,7 @@ index 189551a..a9c8f47 100644 /* If you need any other options please contact GRUB development team. */ } -@@ -298,14 +377,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, +@@ -302,14 +381,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, } } @@ -128,10 +128,10 @@ index 189551a..a9c8f47 100644 grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) diff --git a/include/grub/net.h b/include/grub/net.h -index 6ac9d72..96aa9fa 100644 +index 1096b2432..e266bae23 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -456,6 +456,8 @@ enum +@@ -457,6 +457,8 @@ enum GRUB_NET_BOOTP_DOMAIN = 0x0f, GRUB_NET_BOOTP_ROOT_PATH = 0x11, GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, @@ -141,5 +141,5 @@ index 6ac9d72..96aa9fa 100644 }; -- -2.9.3 +2.13.0 diff --git a/0015-trim-arp-packets-with-abnormal-size.patch b/0063-trim-arp-packets-with-abnormal-size.patch similarity index 77% rename from 0015-trim-arp-packets-with-abnormal-size.patch rename to 0063-trim-arp-packets-with-abnormal-size.patch index fed31b48..6dbf6586 100644 --- a/0015-trim-arp-packets-with-abnormal-size.patch +++ b/0063-trim-arp-packets-with-abnormal-size.patch @@ -1,7 +1,7 @@ -From a6f4624278357f853e3e8888e538eb0ef3654556 Mon Sep 17 00:00:00 2001 +From 27f7b88ae111b6b0e32fc97b1e4584ba110497c3 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 5 Feb 2014 09:42:42 -0200 -Subject: [PATCH 15/90] trim arp packets with abnormal size +Subject: [PATCH 063/176] trim arp packets with abnormal size GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it. @@ -10,10 +10,10 @@ is foobared, GRUB needs to trim the arp response packet before sending it. 1 file changed, 6 insertions(+) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 4b68c41..f7c59d3 100644 +index 54306e3b1..d1c69ed2b 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c -@@ -142,6 +142,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, +@@ -150,6 +150,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) { @@ -27,5 +27,5 @@ index 4b68c41..f7c59d3 100644 struct grub_net_buff nb_reply; struct arppkt *arp_reply; -- -2.9.3 +2.13.0 diff --git a/0016-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/0064-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch similarity index 87% rename from 0016-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch rename to 0064-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch index 011204ec..57cdd324 100644 --- a/0016-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +++ b/0064-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch @@ -1,7 +1,7 @@ -From c22139b340f1a306ad718646a4cd4bc1d4039d7b Mon Sep 17 00:00:00 2001 +From b1e1f3bfdf2c7fa0b44cf0294e21b8c1730434f2 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Wed, 12 Mar 2014 10:58:16 -0400 -Subject: [PATCH 16/90] Fix bad test on GRUB_DISABLE_SUBMENU. +Subject: [PATCH 064/176] Fix bad test on GRUB_DISABLE_SUBMENU. The file /etc/grub.d/10_linux does @@ -20,7 +20,7 @@ Resolves: rhbz#1063414 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index de9044c..cf6331f 100644 +index de9044c7f..cf6331f2a 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -224,7 +224,11 @@ while [ "x$list" != "x" ] ; do @@ -37,5 +37,5 @@ index de9044c..cf6331f 100644 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -- -2.9.3 +2.13.0 diff --git a/0017-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/0065-Add-support-for-UEFI-operating-systems-returned-by-o.patch similarity index 86% rename from 0017-Add-support-for-UEFI-operating-systems-returned-by-o.patch rename to 0065-Add-support-for-UEFI-operating-systems-returned-by-o.patch index fb49bb74..e714ae81 100644 --- a/0017-Add-support-for-UEFI-operating-systems-returned-by-o.patch +++ b/0065-Add-support-for-UEFI-operating-systems-returned-by-o.patch @@ -1,7 +1,7 @@ -From f0daa044a90c508f8f60d23e5ef39597ec80c2cc Mon Sep 17 00:00:00 2001 +From be89ae5b3140ecad260c3c4374db7dc0a714d92d Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 12 Jun 2013 11:51:49 -0400 -Subject: [PATCH 17/90] Add support for UEFI operating systems returned by +Subject: [PATCH 065/176] Add support for UEFI operating systems returned by os-prober os-prober returns UEFI operating systems in the form: @@ -15,7 +15,7 @@ contrast to legacy OSes, where path is the device string. Handle this case. 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 515a68c..9b8f596 100644 +index 515a68c7a..9b8f5968e 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -328,8 +328,23 @@ EOF @@ -46,5 +46,5 @@ index 515a68c..9b8f596 100644 esac done -- -2.9.3 +2.13.0 diff --git a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0066-Migrate-PPC-from-Yaboot-to-Grub2.patch similarity index 95% rename from 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch rename to 0066-Migrate-PPC-from-Yaboot-to-Grub2.patch index f605f686..1a13a616 100644 --- a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0066-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -1,7 +1,7 @@ -From 0e433858169473aa7a042c28dd6f0d4e1adab8d7 Mon Sep 17 00:00:00 2001 +From 305051dcc08e238d1c06b46009206154521ab60f Mon Sep 17 00:00:00 2001 From: Mark Hamzy Date: Wed, 28 Mar 2012 14:46:41 -0500 -Subject: [PATCH 18/90] Migrate PPC from Yaboot to Grub2 +Subject: [PATCH 066/176] Migrate PPC from Yaboot to Grub2 Add configuration support for serial terminal consoles. This will set the maximum screen size so that text is not overwritten. @@ -12,7 +12,7 @@ maximum screen size so that text is not overwritten. create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index f9caccb..6d452da 100644 +index f9caccb97..6d452da02 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -487,6 +487,13 @@ script = { @@ -31,7 +31,7 @@ index f9caccb..6d452da 100644 installdir = grubconf; diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in new file mode 100644 -index 0000000..10d6658 +index 000000000..10d665868 --- /dev/null +++ b/util/grub.d/20_ppc_terminfo.in @@ -0,0 +1,114 @@ @@ -150,5 +150,5 @@ index 0000000..10d6658 + terminfo -g ${X}x${Y} ${TERMINAL} +EOF -- -2.9.3 +2.13.0 diff --git a/0019-Add-fw_path-variable-revised.patch b/0067-Add-fw_path-variable-revised.patch similarity index 91% rename from 0019-Add-fw_path-variable-revised.patch rename to 0067-Add-fw_path-variable-revised.patch index 8724bf30..6212172d 100644 --- a/0019-Add-fw_path-variable-revised.patch +++ b/0067-Add-fw_path-variable-revised.patch @@ -1,7 +1,7 @@ -From fdc52554d998170f56ed45856082f4a3bfeb3e2a Mon Sep 17 00:00:00 2001 +From 6064284af113b8ed940d1a44680f8b7f7d5db884 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 19 Sep 2012 21:22:55 -0300 -Subject: [PATCH 19/90] Add fw_path variable (revised) +Subject: [PATCH 067/176] Add fw_path variable (revised) This patch makes grub look for its config file on efi where the app was found. It was originally written by Matthew Garrett, and adapted to fix the @@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=857936 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 9cad0c4..8ab7794 100644 +index 9cad0c448..8ab7794c4 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -127,16 +127,15 @@ grub_set_prefix_and_root (void) @@ -41,7 +41,7 @@ index 9cad0c4..8ab7794 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 249e19b..759c475 100644 +index 249e19bc7..759c475c4 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -338,7 +338,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -77,5 +77,5 @@ index 249e19b..759c475 100644 prefix = grub_env_get ("prefix"); if (prefix) -- -2.9.3 +2.13.0 diff --git a/0020-Add-support-for-linuxefi.patch b/0068-Add-support-for-linuxefi.patch similarity index 97% rename from 0020-Add-support-for-linuxefi.patch rename to 0068-Add-support-for-linuxefi.patch index 19940a60..4c56ddbd 100644 --- a/0020-Add-support-for-linuxefi.patch +++ b/0068-Add-support-for-linuxefi.patch @@ -1,7 +1,7 @@ -From a64179016df64b72cc956fd6085ca3ed1a41baac Mon Sep 17 00:00:00 2001 +From f43b4a38c130038880b86566a82c38434e6bb55d Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 10 Jul 2012 11:58:52 -0400 -Subject: [PATCH 20/90] Add support for linuxefi +Subject: [PATCH 068/176] Add support for linuxefi --- grub-core/Makefile.core.def | 8 + @@ -13,10 +13,10 @@ Subject: [PATCH 20/90] Add support for linuxefi create mode 100644 grub-core/loader/i386/efi/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index f8d4634..de8c9df 100644 +index 5df543d79..cca824256 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1732,6 +1732,14 @@ module = { +@@ -1765,6 +1765,14 @@ module = { }; module = { @@ -32,7 +32,7 @@ index f8d4634..de8c9df 100644 efi = loader/efi/chainloader.c; i386_pc = loader/i386/pc/chainloader.c; diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 20a47aa..efb15cc 100644 +index 20a47aaf5..efb15cc1b 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size; @@ -76,7 +76,7 @@ index 20a47aa..efb15cc 100644 grub_efi_allocate_pages (grub_efi_physical_address_t address, diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c new file mode 100644 -index 0000000..b79e632 +index 000000000..b79e6320b --- /dev/null +++ b/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,371 @@ @@ -452,7 +452,7 @@ index 0000000..b79e632 + grub_unregister_command (cmd_initrd); +} diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 0e6fd86..9a2da0e 100644 +index e9c601f34..764cd11f5 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds); @@ -466,7 +466,7 @@ index 0e6fd86..9a2da0e 100644 grub_efi_uintn_t pages); int diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index da0ca3b..fc36bda 100644 +index da0ca3b83..fc36bdaf3 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -139,6 +139,7 @@ struct linux_kernel_header @@ -478,5 +478,5 @@ index da0ca3b..fc36bda 100644 /* Boot parameters for Linux based on 2.6.12. This is used by the setup -- -2.9.3 +2.13.0 diff --git a/0068-ppc64le-sync-mkconfig-to-disk-1212114.patch b/0068-ppc64le-sync-mkconfig-to-disk-1212114.patch deleted file mode 100644 index 9af7bc60..00000000 --- a/0068-ppc64le-sync-mkconfig-to-disk-1212114.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 63efe6a207f59ffa9e55cc10a0aed272f3571227 Mon Sep 17 00:00:00 2001 -From: Don Zickus -Date: Wed, 22 Jul 2015 13:59:55 -0400 -Subject: [PATCH 68/90] ppc64le sync mkconfig to disk (#1212114) - -If creating a new grub2 entry using grub2-mkconfig, the entry is not -immediately sync'd to disk. If a crash happens before the writeback, -the subsequent reboot fails because the grub2.cfg is corrupted. - -Address this by forcing all the changes (mainly the fs meta data) to disk -before finishing the grub2 conf changes. - -Tested by 'grub2-mkconfig -o /etc/grub22.cfg; echo c > /proc/sysrq-trigger'. - -Before, the machine would panic and on reboot be stuck without a grub.cfg -to read. After, works as expected. - -Resolves: rhbz#1212114 ---- - util/grub-mkconfig.in | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index fb87247..73a18f7 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -294,3 +294,12 @@ fi - - gettext "done" >&2 - echo >&2 -+ -+# make sure changes make it to the disk. -+# if /boot is a mountpoint, force the meta data on disk -+# to by-pass writeback delay. -+# PPC64LE-only to deal with Petitboot issues -+ARCH=$(uname -m) -+if [ "${ARCH}" = "ppc64le" ]; then -+ sync && mountpoint -q /boot &&fsfreeze -f /boot && fsfreeze -u /boot -+fi --- -2.9.3 - diff --git a/0021-Use-linuxefi-and-initrdefi-where-appropriate.patch b/0069-Use-linuxefi-and-initrdefi-where-appropriate.patch similarity index 89% rename from 0021-Use-linuxefi-and-initrdefi-where-appropriate.patch rename to 0069-Use-linuxefi-and-initrdefi-where-appropriate.patch index 1af6eb26..6ace331b 100644 --- a/0021-Use-linuxefi-and-initrdefi-where-appropriate.patch +++ b/0069-Use-linuxefi-and-initrdefi-where-appropriate.patch @@ -1,14 +1,14 @@ -From 5894e3bfaf055554c786b4c1a9452d4e3bb9f568 Mon Sep 17 00:00:00 2001 +From 7759ceeceef6a2c1c90e6e5d51e9efd56aacd508 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 16 Jul 2012 18:57:11 -0400 -Subject: [PATCH 21/90] Use "linuxefi" and "initrdefi" where appropriate. +Subject: [PATCH 069/176] Use "linuxefi" and "initrdefi" where appropriate. --- util/grub.d/10_linux.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index cf6331f..8ccf012 100644 +index cf6331f2a..8ccf012f7 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -129,17 +129,31 @@ linux_entry () @@ -46,5 +46,5 @@ index cf6331f..8ccf012 100644 sed "s/^/$submenu_indentation/" << EOF } -- -2.9.3 +2.13.0 diff --git a/0022-Don-t-allow-insmod-when-secure-boot-is-enabled.patch b/0070-Don-t-allow-insmod-when-secure-boot-is-enabled.patch similarity index 93% rename from 0022-Don-t-allow-insmod-when-secure-boot-is-enabled.patch rename to 0070-Don-t-allow-insmod-when-secure-boot-is-enabled.patch index 4ff26a8b..afcc4800 100644 --- a/0022-Don-t-allow-insmod-when-secure-boot-is-enabled.patch +++ b/0070-Don-t-allow-insmod-when-secure-boot-is-enabled.patch @@ -1,7 +1,7 @@ -From 9d70f7f9a356d965ed48963e2ead12af8de97615 Mon Sep 17 00:00:00 2001 +From 085e51ec31d08c9b7e027fe8a25a9894765b9547 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 23 Oct 2012 10:40:49 -0400 -Subject: [PATCH 22/90] Don't allow insmod when secure boot is enabled. +Subject: [PATCH 070/176] Don't allow insmod when secure boot is enabled. Hi, @@ -23,7 +23,7 @@ moves the check into grub_dl_load_file. 3 files changed, 51 insertions(+) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index e394cd9..6210709 100644 +index e394cd96f..621070918 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -32,12 +32,21 @@ @@ -69,7 +69,7 @@ index e394cd9..6210709 100644 file = grub_file_open (filename); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 101307f..0859910 100644 +index 684ca93f8..2588b481e 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -269,6 +269,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -108,7 +108,7 @@ index 101307f..0859910 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 9a2da0e..2245632 100644 +index 764cd11f5..62a3d9726 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -76,6 +76,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, @@ -120,5 +120,5 @@ index 9a2da0e..2245632 100644 EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, const grub_efi_device_path_t *dp2); -- -2.9.3 +2.13.0 diff --git a/0023-Pass-x-hex-hex-straight-through-unmolested.patch b/0071-Pass-x-hex-hex-straight-through-unmolested.patch similarity index 94% rename from 0023-Pass-x-hex-hex-straight-through-unmolested.patch rename to 0071-Pass-x-hex-hex-straight-through-unmolested.patch index ac6cd8b9..d869ee3a 100644 --- a/0023-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0071-Pass-x-hex-hex-straight-through-unmolested.patch @@ -1,7 +1,7 @@ -From c2a19ee447623af8765254b87ff83cbb5b8253bc Mon Sep 17 00:00:00 2001 +From 11d4cc5648c1de0aa7acdf530829b66c03013f6a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 1 Oct 2012 13:24:37 -0400 -Subject: [PATCH 23/90] Pass "\x[[:hex:]][[:hex:]]" straight through +Subject: [PATCH 071/176] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. --- @@ -11,7 +11,7 @@ Subject: [PATCH 23/90] Pass "\x[[:hex:]][[:hex:]]" straight through 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index 9b4e727..02c46f9 100644 +index 9b4e72766..02c46f9fd 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c @@ -462,6 +462,12 @@ check_file (const char *dir, const char *basename) @@ -45,7 +45,7 @@ index 9b4e727..02c46f9 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index d5e10ee..0a5b2af 100644 +index d5e10ee87..0a5b2afb9 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -104,7 +104,7 @@ index d5e10ee..0a5b2af 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ab78ca8..cf6cd66 100644 +index ab78ca87f..cf6cd6601 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -55,6 +55,12 @@ static struct grub_script_scope *scope = 0; @@ -179,5 +179,5 @@ index ab78ca8..cf6cd66 100644 case '$': if (escaped) -- -2.9.3 +2.13.0 diff --git a/0024-Add-X-option-to-printf-functions.patch b/0072-Add-X-option-to-printf-functions.patch similarity index 69% rename from 0024-Add-X-option-to-printf-functions.patch rename to 0072-Add-X-option-to-printf-functions.patch index be1dc64d..0bfd0f14 100644 --- a/0024-Add-X-option-to-printf-functions.patch +++ b/0072-Add-X-option-to-printf-functions.patch @@ -1,17 +1,17 @@ -From c482ec700b2ba4b1fabccaa5848cccae466d3a12 Mon Sep 17 00:00:00 2001 +From 18328806280391c8219ccbea80ca513ffcdaab6e Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 16:58:39 -0200 -Subject: [PATCH 24/90] Add %X option to printf functions. +Subject: [PATCH 072/176] Add %X option to printf functions. --- grub-core/kern/misc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 6bb0351..81be344 100644 +index 952411d5d..8344526be 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -587,7 +587,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) +@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) static inline char * grub_lltoa (char *str, int c, unsigned long long n) { @@ -20,7 +20,7 @@ index 6bb0351..81be344 100644 char *p; if ((long long) n < 0 && c == 'd') -@@ -602,7 +602,7 @@ grub_lltoa (char *str, int c, unsigned long long n) +@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned long long n) do { unsigned d = (unsigned) (n & 0xf); @@ -29,7 +29,7 @@ index 6bb0351..81be344 100644 } while (n >>= 4); else -@@ -675,6 +675,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, +@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, { case 'p': case 'x': @@ -37,7 +37,7 @@ index 6bb0351..81be344 100644 case 'u': case 'd': case 'c': -@@ -761,6 +762,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, +@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, switch (c) { case 'x': @@ -45,7 +45,7 @@ index 6bb0351..81be344 100644 case 'u': args->ptr[curn].type = UNSIGNED_INT + longfmt; break; -@@ -899,6 +901,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, +@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, c = 'x'; /* Fall through. */ case 'x': @@ -54,5 +54,5 @@ index 6bb0351..81be344 100644 case 'd': { -- -2.9.3 +2.13.0 diff --git a/0025-Search-for-specific-config-file-for-netboot.patch b/0073-Search-for-specific-config-file-for-netboot.patch similarity index 95% rename from 0025-Search-for-specific-config-file-for-netboot.patch rename to 0073-Search-for-specific-config-file-for-netboot.patch index 0e6d0422..89eab2e7 100644 --- a/0025-Search-for-specific-config-file-for-netboot.patch +++ b/0073-Search-for-specific-config-file-for-netboot.patch @@ -1,7 +1,7 @@ -From 70a8c5e075d59ec13fdee4c3868b3862a8cd8aa4 Mon Sep 17 00:00:00 2001 +From 61094fbc07ee8cd2eac49ca844fc42fa5f55fb5f Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Tue, 27 Nov 2012 17:22:07 -0200 -Subject: [PATCH 25/90] Search for specific config file for netboot +Subject: [PATCH 073/176] Search for specific config file for netboot This patch implements a search for a specific configuration when the config file is on a remoteserver. It uses the following order: @@ -22,7 +22,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=873406 3 files changed, 135 insertions(+), 4 deletions(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 10773fc..0769bf8 100644 +index 10773fc34..0769bf850 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1735,6 +1735,124 @@ grub_net_restore_hw (void) @@ -151,7 +151,7 @@ index 10773fc..0769bf8 100644 static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 759c475..b2654ef 100644 +index 759c475c4..b2654ef62 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -33,6 +33,7 @@ @@ -187,10 +187,10 @@ index 759c475..b2654ef 100644 grub_enter_normal_mode (config); grub_free (config); diff --git a/include/grub/net.h b/include/grub/net.h -index 96aa9fa..e13ae1e 100644 +index e266bae23..50d62ab0c 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -565,4 +565,7 @@ extern char *grub_net_default_server; +@@ -566,4 +566,7 @@ extern char *grub_net_default_server; #define VLANTAG_IDENTIFIER 0x8100 @@ -199,5 +199,5 @@ index 96aa9fa..e13ae1e 100644 + #endif /* ! GRUB_NET_HEADER */ -- -2.9.3 +2.13.0 diff --git a/0026-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0074-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similarity index 96% rename from 0026-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch rename to 0074-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index af5efe37..5952a353 100644 --- a/0026-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0074-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -1,7 +1,7 @@ -From 8992c2812e1e914e803429314b9164a19af4398b Mon Sep 17 00:00:00 2001 +From f5adf9dbcd30817b69b83650ab8417cd7388d65c Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Tue, 22 Jan 2013 06:31:38 +0100 -Subject: [PATCH 26/90] blscfg: add blscfg module to parse Boot Loader +Subject: [PATCH 074/176] blscfg: add blscfg module to parse Boot Loader Specification snippets http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec @@ -21,10 +21,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/blscfg.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index de8c9df..e79bb0c 100644 +index cca824256..3a05683d2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -741,6 +741,14 @@ module = { +@@ -769,6 +769,14 @@ module = { }; module = { @@ -41,7 +41,7 @@ index de8c9df..e79bb0c 100644 i386_pc = lib/i386/pc/biosnum.c; diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 0000000..4274aca +index 000000000..4274aca5a --- /dev/null +++ b/grub-core/commands/blscfg.c @@ -0,0 +1,201 @@ @@ -247,5 +247,5 @@ index 0000000..4274aca + grub_unregister_extcmd (cmd); +} -- -2.9.3 +2.13.0 diff --git a/0027-Don-t-write-messages-to-the-screen.patch b/0075-Don-t-write-messages-to-the-screen.patch similarity index 94% rename from 0027-Don-t-write-messages-to-the-screen.patch rename to 0075-Don-t-write-messages-to-the-screen.patch index 3b889cd4..551233d6 100644 --- a/0027-Don-t-write-messages-to-the-screen.patch +++ b/0075-Don-t-write-messages-to-the-screen.patch @@ -1,7 +1,7 @@ -From 3e83ff704af9a967fa55d60cc3917bc4ccd85f32 Mon Sep 17 00:00:00 2001 +From d55a786428c9cd17779a26597a22b8c1e9dc139f Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:30:20 -0400 -Subject: [PATCH 27/90] Don't write messages to the screen +Subject: [PATCH 075/176] Don't write messages to the screen Writing messages to the screen before the menus or boot splash happens so quickly it looks like something is wrong and isn't @@ -15,7 +15,7 @@ very appealing. 5 files changed, 5 insertions(+), 40 deletions(-) diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index 2bd0b2d..ea167fe 100644 +index 2bd0b2d28..ea167fe12 100644 --- a/grub-core/boot/i386/pc/boot.S +++ b/grub-core/boot/i386/pc/boot.S @@ -249,9 +249,6 @@ real_start: @@ -29,7 +29,7 @@ index 2bd0b2d..ea167fe 100644 movw $disk_address_packet, %si diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index 1ee4cf5..c8b87ed 100644 +index 1ee4cf5b2..c8b87ed29 100644 --- a/grub-core/boot/i386/pc/diskboot.S +++ b/grub-core/boot/i386/pc/diskboot.S @@ -50,11 +50,6 @@ _start: @@ -45,7 +45,7 @@ index 1ee4cf5..c8b87ed 100644 movw $LOCAL(firstlist), %di diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4880cef..b22e1bc 100644 +index 4880cefe3..b22e1bcc9 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -434,16 +434,12 @@ static char * @@ -127,7 +127,7 @@ index 4880cef..b22e1bc 100644 grub_register_variable_hook ("locale_dir", NULL, read_main); grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary); diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 8ab7794..da47b18 100644 +index 8ab7794c4..da47b18b5 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -268,11 +268,6 @@ grub_main (void) @@ -143,7 +143,7 @@ index 8ab7794..da47b18 100644 grub_boot_time ("Before loading embedded modules."); diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 8ccf012..a3d9711 100644 +index 8ccf012f7..a3d9711d6 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -128,29 +128,22 @@ linux_entry () @@ -177,5 +177,5 @@ index 8ccf012..a3d9711 100644 EOF fi -- -2.9.3 +2.13.0 diff --git a/0028-Don-t-print-GNU-GRUB-header.patch b/0076-Don-t-print-GNU-GRUB-header.patch similarity index 86% rename from 0028-Don-t-print-GNU-GRUB-header.patch rename to 0076-Don-t-print-GNU-GRUB-header.patch index 7c9fbb7c..2131525b 100644 --- a/0028-Don-t-print-GNU-GRUB-header.patch +++ b/0076-Don-t-print-GNU-GRUB-header.patch @@ -1,7 +1,7 @@ -From 9bd3d2fb49a6b8e3807ce7275876fd4b416545c9 Mon Sep 17 00:00:00 2001 +From b73ce71e5a7d899484963c0eaf8617684d1b95be Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 13:53:48 -0400 -Subject: [PATCH 28/90] Don't print GNU GRUB header +Subject: [PATCH 076/176] Don't print GNU GRUB header No one cares. --- @@ -9,7 +9,7 @@ No one cares. 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index b2654ef..f57b750 100644 +index b2654ef62..f57b7508a 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -202,15 +202,16 @@ read_config_file (const char *config) @@ -41,5 +41,5 @@ index b2654ef..f57b750 100644 static void -- -2.9.3 +2.13.0 diff --git a/0029-Don-t-add-to-highlighted-row.patch b/0077-Don-t-add-to-highlighted-row.patch similarity index 80% rename from 0029-Don-t-add-to-highlighted-row.patch rename to 0077-Don-t-add-to-highlighted-row.patch index 96218b38..e0cd4620 100644 --- a/0029-Don-t-add-to-highlighted-row.patch +++ b/0077-Don-t-add-to-highlighted-row.patch @@ -1,7 +1,7 @@ -From dd2c80ddd0e5e57b33a9d06894225e629b1b8b5e Mon Sep 17 00:00:00 2001 +From a52abfacfeaf1c8c26363a2aaefbd2e13c95787e Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 17:49:45 -0400 -Subject: [PATCH 29/90] Don't add '*' to highlighted row +Subject: [PATCH 077/176] Don't add '*' to highlighted row It is already highlighted. --- @@ -9,7 +9,7 @@ It is already highlighted. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index e22bb91..a3d1f23 100644 +index e22bb91f6..a3d1f23f6 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, @@ -22,5 +22,5 @@ index e22bb91..a3d1f23 100644 grub_print_ucs4_menu (unicode_title, unicode_title + len, -- -2.9.3 +2.13.0 diff --git a/0030-Message-string-cleanups.patch b/0078-Message-string-cleanups.patch similarity index 94% rename from 0030-Message-string-cleanups.patch rename to 0078-Message-string-cleanups.patch index 51f80fdc..338834d2 100644 --- a/0030-Message-string-cleanups.patch +++ b/0078-Message-string-cleanups.patch @@ -1,7 +1,7 @@ -From 4cc90ad7d495b896e0b6b2677285ced8ce70cee1 Mon Sep 17 00:00:00 2001 +From b3fa0ec8279efce103cf073073174fd085d0b66e Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 11:09:04 -0400 -Subject: [PATCH 30/90] Message string cleanups +Subject: [PATCH 078/176] Message string cleanups Make use of terminology consistent. Remove jargon. --- @@ -9,7 +9,7 @@ Make use of terminology consistent. Remove jargon. 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index a3d1f23..64a8386 100644 +index a3d1f23f6..64a83862f 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) @@ -67,5 +67,5 @@ index a3d1f23..64a8386 100644 { grub_print_error (); -- -2.9.3 +2.13.0 diff --git a/0031-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0079-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch similarity index 82% rename from 0031-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch rename to 0079-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch index 6a7ec273..1c4004e1 100644 --- a/0031-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +++ b/0079-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch @@ -1,14 +1,14 @@ -From ee01481e906071d01649b61925eaac0348f9a9a7 Mon Sep 17 00:00:00 2001 +From e2528ce11f002c288a83caa473fcd26052c5f054 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:23 -0400 -Subject: [PATCH 31/90] Fix border spacing now that we aren't displaying it +Subject: [PATCH 079/176] Fix border spacing now that we aren't displaying it --- grub-core/normal/menu_text.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 64a8386..1062d64 100644 +index 64a83862f..1062d64ee 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit, @@ -28,5 +28,5 @@ index 64a8386..1062d64 100644 geo->timeout_lines = 2; -- -2.9.3 +2.13.0 diff --git a/0032-Use-the-correct-indentation-for-the-term-help-text.patch b/0080-Use-the-correct-indentation-for-the-term-help-text.patch similarity index 83% rename from 0032-Use-the-correct-indentation-for-the-term-help-text.patch rename to 0080-Use-the-correct-indentation-for-the-term-help-text.patch index 168471d4..fc28c2e6 100644 --- a/0032-Use-the-correct-indentation-for-the-term-help-text.patch +++ b/0080-Use-the-correct-indentation-for-the-term-help-text.patch @@ -1,7 +1,7 @@ -From 748c629f47f4191c66011646e010cdf5ab506b90 Mon Sep 17 00:00:00 2001 +From f2287ba01076360a2fcd8e614ac73212036dd484 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:08:49 -0400 -Subject: [PATCH 32/90] Use the correct indentation for the term help text +Subject: [PATCH 080/176] Use the correct indentation for the term help text That is consistent with the menu help text --- @@ -9,7 +9,7 @@ That is consistent with the menu help text 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index f57b750..0ce59fd 100644 +index f57b7508a..0ce59fdc3 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -426,8 +426,8 @@ grub_normal_reader_init (int nested) @@ -24,5 +24,5 @@ index f57b750..0ce59fd 100644 grub_print_message_indented (msg_formatted, 0, 0, term); grub_putcode ('\n', term); -- -2.9.3 +2.13.0 diff --git a/0033-Indent-menu-entries.patch b/0081-Indent-menu-entries.patch similarity index 81% rename from 0033-Indent-menu-entries.patch rename to 0081-Indent-menu-entries.patch index 8af01f6d..9f133fd9 100644 --- a/0033-Indent-menu-entries.patch +++ b/0081-Indent-menu-entries.patch @@ -1,14 +1,14 @@ -From 93092c8a33db0cb36392c9684a60c12fbc823554 Mon Sep 17 00:00:00 2001 +From fc110aa2245aa53b305c14c789c66dd93c8b489e Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:30:55 -0400 -Subject: [PATCH 33/90] Indent menu entries +Subject: [PATCH 081/176] Indent menu entries --- grub-core/normal/menu_text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 1062d64..ecc60f9 100644 +index 1062d64ee..ecc60f99f 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, @@ -22,5 +22,5 @@ index 1062d64..ecc60f9 100644 grub_print_ucs4_menu (unicode_title, unicode_title + len, -- -2.9.3 +2.13.0 diff --git a/0034-Fix-margins.patch b/0082-Fix-margins.patch similarity index 88% rename from 0034-Fix-margins.patch rename to 0082-Fix-margins.patch index f9541afa..69baf333 100644 --- a/0034-Fix-margins.patch +++ b/0082-Fix-margins.patch @@ -1,14 +1,14 @@ -From ee7064d8667cf51d12f2cc5ead9b428446c563ad Mon Sep 17 00:00:00 2001 +From 861c159caf2f7ef552ff0bab773c5dc7bd061513 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 14:59:36 -0400 -Subject: [PATCH 34/90] Fix margins +Subject: [PATCH 082/176] Fix margins --- grub-core/normal/menu_text.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index ecc60f9..0e43f2c 100644 +index ecc60f99f..0e43f2c10 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit, @@ -33,5 +33,5 @@ index ecc60f9..0e43f2c 100644 - geo->timeout_lines /* timeout */ - 1 /* empty final line */; -- -2.9.3 +2.13.0 diff --git a/0035-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0083-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch similarity index 79% rename from 0035-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch rename to 0083-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch index 1d9a608f..1caee2c9 100644 --- a/0035-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +++ b/0083-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch @@ -1,7 +1,7 @@ -From 712f456d542ec913c4a5bc13f86443f79912cbf3 Mon Sep 17 00:00:00 2001 +From 726aa93d1ecf9de8b3d4a63d1834c91c14d30676 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 21 Jun 2013 14:44:08 -0400 -Subject: [PATCH 35/90] Use -2 instead of -1 for our right-hand margin, so +Subject: [PATCH 083/176] Use -2 instead of -1 for our right-hand margin, so linewrapping works (#976643). Signed-off-by: Peter Jones @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 0e43f2c..537d4bf 100644 +index 0e43f2c10..537d4bf86 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit, @@ -23,5 +23,5 @@ index 0e43f2c..537d4bf 100644 geo->first_entry_y = 3; /* three empty lines*/ -- -2.9.3 +2.13.0 diff --git a/0036-Use-linux16-when-appropriate-880840.patch b/0084-Use-linux16-when-appropriate-880840.patch similarity index 87% rename from 0036-Use-linux16-when-appropriate-880840.patch rename to 0084-Use-linux16-when-appropriate-880840.patch index c8958924..9c5ea30d 100644 --- a/0036-Use-linux16-when-appropriate-880840.patch +++ b/0084-Use-linux16-when-appropriate-880840.patch @@ -1,7 +1,7 @@ -From aedb9655a10717fe3678a9e2fc720b55f5b0ffbc Mon Sep 17 00:00:00 2001 +From 432d7de1c208de5afe53f2aff43a307867150461 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:05:07 -0400 -Subject: [PATCH 36/90] Use linux16 when appropriate (#880840) +Subject: [PATCH 084/176] Use linux16 when appropriate (#880840) The kernel group really would prefer that we use the 16 bit entry point on x86 bios machines. @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index a3d9711..f3bf6ac 100644 +index a3d9711d6..f3bf6acd8 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -76,6 +76,11 @@ linux_entry () @@ -48,5 +48,5 @@ index a3d9711..f3bf6ac 100644 fi fi -- -2.9.3 +2.13.0 diff --git a/0037-Enable-pager-by-default.-985860.patch b/0085-Enable-pager-by-default.-985860.patch similarity index 78% rename from 0037-Enable-pager-by-default.-985860.patch rename to 0085-Enable-pager-by-default.-985860.patch index 948b5ea1..b8166b20 100644 --- a/0037-Enable-pager-by-default.-985860.patch +++ b/0085-Enable-pager-by-default.-985860.patch @@ -1,7 +1,7 @@ -From 0b72348759eaec7d1d488e9788e724a2d48ce3f7 Mon Sep 17 00:00:00 2001 +From e59ce0d1e5e94a761d7238bad2537dff2a8e89ab Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:09:27 -0400 -Subject: [PATCH 37/90] Enable pager by default. (#985860) +Subject: [PATCH 085/176] Enable pager by default. (#985860) Signed-off-by: Peter Jones --- @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 93a9023..858b526 100644 +index 93a90233e..858b526c9 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_ @@ -22,5 +22,5 @@ index 93a9023..858b526 100644 load_env fi -- -2.9.3 +2.13.0 diff --git a/0038-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0086-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch similarity index 82% rename from 0038-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch rename to 0086-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch index a3b66dc2..07d717c5 100644 --- a/0038-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +++ b/0086-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch @@ -1,7 +1,7 @@ -From 55d0f5f5fdecfab6c8439520491e08a0178bd5dc Mon Sep 17 00:00:00 2001 +From 929ad582b4546319866cd75f4abfe1096676278a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 28 Oct 2013 10:13:27 -0400 -Subject: [PATCH 38/90] F10 doesn't work on serial, so don't tell the user to +Subject: [PATCH 086/176] F10 doesn't work on serial, so don't tell the user to hit it (#987443) Signed-off-by: Peter Jones @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 537d4bf..452d55b 100644 +index 537d4bf86..452d55bf9 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) @@ -23,5 +23,5 @@ index 537d4bf..452d55b 100644 STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); -- -2.9.3 +2.13.0 diff --git a/0086-ppc64le-has-no-separate-boot-mount-1261926.patch b/0086-ppc64le-has-no-separate-boot-mount-1261926.patch deleted file mode 100644 index 2b04641d..00000000 --- a/0086-ppc64le-has-no-separate-boot-mount-1261926.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 12a2215a6f13f2503a9e38d84fff64789c6a34b7 Mon Sep 17 00:00:00 2001 -From: Robert Marshall -Date: Fri, 17 Jun 2016 11:47:34 -0400 -Subject: [PATCH 86/90] ppc64le has no separate /boot mount (#1261926) - -The patch for rhbz#1212114 ensures that ppc64le systems sync grub config -changes to disk prior to grub-mkconfig completion and a reboot. - -This patch required checking for /boot as its own mount point because -issuing fsfreeze to a root partition is unwise. For administrators who -configured a ppc64le system with no separate /boot partition, the failed -check results in an error message. The file is written and would work -most of the time, however, it also introduces a corner case where the -behavior manifested in rhbz#1212114 could re-appear on these systems. - -The system call issued by fsfreeeze is being issued by methods within -the anaconda installer and can be removed from GRUB proper. - -Related: rhbz#1315468 -Resolves: rhbz#1261926 ---- - util/grub-mkconfig.in | 9 --------- - 1 file changed, 9 deletions(-) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 73a18f7..fb87247 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -294,12 +294,3 @@ fi - - gettext "done" >&2 - echo >&2 -- --# make sure changes make it to the disk. --# if /boot is a mountpoint, force the meta data on disk --# to by-pass writeback delay. --# PPC64LE-only to deal with Petitboot issues --ARCH=$(uname -m) --if [ "${ARCH}" = "ppc64le" ]; then -- sync && mountpoint -q /boot &&fsfreeze -f /boot && fsfreeze -u /boot --fi --- -2.9.3 - diff --git a/0039-Don-t-say-GNU-Linux-in-generated-menus.patch b/0087-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 86% rename from 0039-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0087-Don-t-say-GNU-Linux-in-generated-menus.patch index 59486cc4..31bb8090 100644 --- a/0039-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0087-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -1,7 +1,7 @@ -From d110064c73c1604b07cdaa3d41751074b2701142 Mon Sep 17 00:00:00 2001 +From cd6bcdd2a4f67e9e5e5f1ccc6c5311dc6cb1ba14 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 14 Mar 2011 14:27:42 -0400 -Subject: [PATCH 39/90] Don't say "GNU/Linux" in generated menus. +Subject: [PATCH 087/176] Don't say "GNU/Linux" in generated menus. --- util/grub.d/10_linux.in | 4 ++-- @@ -9,7 +9,7 @@ Subject: [PATCH 39/90] Don't say "GNU/Linux" in generated menus. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index f3bf6ac..ef52cf3 100644 +index f3bf6acd8..ef52cf3db 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -25,7 +25,7 @@ index f3bf6ac..ef52cf3 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index c48af94..25e3c41 100644 +index c002fc9f9..54f1ec8a2 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -41,5 +41,5 @@ index c48af94..25e3c41 100644 fi -- -2.9.3 +2.13.0 diff --git a/0040-Don-t-draw-a-border-around-the-menu.patch b/0088-Don-t-draw-a-border-around-the-menu.patch similarity index 93% rename from 0040-Don-t-draw-a-border-around-the-menu.patch rename to 0088-Don-t-draw-a-border-around-the-menu.patch index 4ae7d290..6b7527d5 100644 --- a/0040-Don-t-draw-a-border-around-the-menu.patch +++ b/0088-Don-t-draw-a-border-around-the-menu.patch @@ -1,7 +1,7 @@ -From fbd9d8969c059d6e5572b1acfa42ba48bc4299e2 Mon Sep 17 00:00:00 2001 +From 48544cac5507f9cfdbedfe3c576f164375436f3d Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Wed, 15 May 2013 16:47:33 -0400 -Subject: [PATCH 40/90] Don't draw a border around the menu +Subject: [PATCH 088/176] Don't draw a border around the menu It looks cleaner without it. --- @@ -9,7 +9,7 @@ It looks cleaner without it. 1 file changed, 43 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 452d55b..1ed2bd9 100644 +index 452d55bf9..1ed2bd92c 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right, @@ -70,5 +70,5 @@ index 452d55b..1ed2bd9 100644 grub_term_highlight_color = old_color_highlight; geo->timeout_y = geo->first_entry_y + geo->num_entries -- -2.9.3 +2.13.0 diff --git a/0041-Use-the-standard-margin-for-the-timeout-string.patch b/0089-Use-the-standard-margin-for-the-timeout-string.patch similarity index 88% rename from 0041-Use-the-standard-margin-for-the-timeout-string.patch rename to 0089-Use-the-standard-margin-for-the-timeout-string.patch index e79707ae..e5206d7a 100644 --- a/0041-Use-the-standard-margin-for-the-timeout-string.patch +++ b/0089-Use-the-standard-margin-for-the-timeout-string.patch @@ -1,7 +1,7 @@ -From 3aeba4760755b9b263ed4ba60dc0431352b63fe7 Mon Sep 17 00:00:00 2001 +From 200dbe4bade3d87ddce65ac2063fe0a1ea0304cd Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 7 Jun 2013 10:52:32 -0400 -Subject: [PATCH 41/90] Use the standard margin for the timeout string +Subject: [PATCH 089/176] Use the standard margin for the timeout string So that it aligns with the other messages --- @@ -9,7 +9,7 @@ So that it aligns with the other messages 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 1ed2bd9..7681f7d 100644 +index 1ed2bd92c..7681f7d28 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -372,7 +372,7 @@ grub_menu_init_page (int nested, int edit, @@ -39,5 +39,5 @@ index 1ed2bd9..7681f7d 100644 } -- -2.9.3 +2.13.0 diff --git a/0042-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0090-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 84% rename from 0042-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0090-Add-.eh_frame-to-list-of-relocations-stripped.patch index 6946f201..a0177ea5 100644 --- a/0042-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0090-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -1,14 +1,14 @@ -From 333159a74035a726841c6c888f43d983a40ed959 Mon Sep 17 00:00:00 2001 +From a3e874dfb2e9a671f04bd162291be16ac9a578bd Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 13 Jan 2014 21:50:59 -0500 -Subject: [PATCH 42/90] Add .eh_frame to list of relocations stripped +Subject: [PATCH 090/176] Add .eh_frame to list of relocations stripped --- conf/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 11296b5..a476ab5 100644 +index 311da61c6..044ab3abe 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding @@ -21,5 +21,5 @@ index 11296b5..a476ab5 100644 CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d -- -2.9.3 +2.13.0 diff --git a/0043-Make-10_linux-work-with-our-changes-for-linux16-and-.patch b/0091-Make-10_linux-work-with-our-changes-for-linux16-and-.patch similarity index 92% rename from 0043-Make-10_linux-work-with-our-changes-for-linux16-and-.patch rename to 0091-Make-10_linux-work-with-our-changes-for-linux16-and-.patch index e00cec76..2999d7f5 100644 --- a/0043-Make-10_linux-work-with-our-changes-for-linux16-and-.patch +++ b/0091-Make-10_linux-work-with-our-changes-for-linux16-and-.patch @@ -1,7 +1,7 @@ -From 5fa65416bae89efb88015e72cb21c28fe3833fc8 Mon Sep 17 00:00:00 2001 +From 50c4c2eaa5cdc53b8a9e6a7bd06bbb36731fccfe Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 13:12:23 -0500 -Subject: [PATCH 43/90] Make 10_linux work with our changes for linux16 and +Subject: [PATCH 091/176] Make 10_linux work with our changes for linux16 and linuxefi on aarch64 Signed-off-by: Peter Jones @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index ef52cf3..191aebe 100644 +index ef52cf3db..191aebe80 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -77,8 +77,18 @@ linux_entry () @@ -81,5 +81,5 @@ index ef52cf3..191aebe 100644 for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do if test -e "${i}" ; then -- -2.9.3 +2.13.0 diff --git a/0044-Don-t-print-during-fdt-loading-method.patch b/0092-Don-t-print-during-fdt-loading-method.patch similarity index 77% rename from 0044-Don-t-print-during-fdt-loading-method.patch rename to 0092-Don-t-print-during-fdt-loading-method.patch index 273cba80..33e2330d 100644 --- a/0044-Don-t-print-during-fdt-loading-method.patch +++ b/0092-Don-t-print-during-fdt-loading-method.patch @@ -1,7 +1,7 @@ -From e89fd78bb3f62064d930c82ad14cd490166d1a2c Mon Sep 17 00:00:00 2001 +From d483a287db875a4ba8d8d6dd387243dd64f4ba97 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jan 2014 16:15:46 -0500 -Subject: [PATCH 44/90] Don't print during fdt loading method. +Subject: [PATCH 092/176] Don't print during fdt loading method. Signed-off-by: Peter Jones --- @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 191aebe..452a9f6 100644 +index 191aebe80..452a9f69d 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -164,9 +164,7 @@ EOF @@ -23,5 +23,5 @@ index 191aebe..452a9f6 100644 EOF fi -- -2.9.3 +2.13.0 diff --git a/0045-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/0093-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch similarity index 81% rename from 0045-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch rename to 0093-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch index a8807eba..3c936041 100644 --- a/0045-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +++ b/0093-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch @@ -1,7 +1,7 @@ -From 7683e149c587abf2d35de11c39ddb0810572b2e4 Mon Sep 17 00:00:00 2001 +From c2bfcc48a47098e68a8264e54bcf2bdc2e305cd0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 30 Jun 2014 14:16:46 -0400 -Subject: [PATCH 45/90] Don't munge raw spaces when we're doing our cmdline +Subject: [PATCH 093/176] Don't munge raw spaces when we're doing our cmdline escaping (#923374) Signed-off-by: Peter Jones @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index 0a5b2af..970ea86 100644 +index 0a5b2afb9..970ea868c 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -97,16 +97,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, @@ -32,5 +32,5 @@ index 0a5b2af..970ea86 100644 { *buf++ = *c++; -- -2.9.3 +2.13.0 diff --git a/0046-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0094-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 81% rename from 0046-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0094-Don-t-require-a-password-to-boot-entries-generated-b.patch index b144fbf1..9c1bffa0 100644 --- a/0046-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0094-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -1,7 +1,7 @@ -From 8a11a21d904e7e823ee6f17faedbf45a8e28044a Mon Sep 17 00:00:00 2001 +From f4347358e0d42afb3d260b7e20167e1b04150091 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 11 Feb 2014 11:14:50 -0500 -Subject: [PATCH 46/90] Don't require a password to boot entries generated by +Subject: [PATCH 094/176] Don't require a password to boot entries generated by grub-mkconfig. When we set a password, we just want that to mean you can't /edit/ an entry. @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 452a9f6..79a747e 100644 +index 452a9f69d..79a747ebd 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" @@ -27,5 +27,5 @@ index 452a9f6..79a747e 100644 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS="$(sed 's, release .*$,,g' /etc/system-release)" -- -2.9.3 +2.13.0 diff --git a/0047-Don-t-emit-Booting-.-message.patch b/0095-Don-t-emit-Booting-.-message.patch similarity index 87% rename from 0047-Don-t-emit-Booting-.-message.patch rename to 0095-Don-t-emit-Booting-.-message.patch index d8cbae1d..dfb587c5 100644 --- a/0047-Don-t-emit-Booting-.-message.patch +++ b/0095-Don-t-emit-Booting-.-message.patch @@ -1,7 +1,7 @@ -From 5468ac6eef409220e59741ccf1073d92916cdddf Mon Sep 17 00:00:00 2001 +From 8cb813959ad6cd108000e03488f37ba26bdd5062 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 09:37:49 -0500 -Subject: [PATCH 47/90] Don't emit "Booting ..." message. +Subject: [PATCH 095/176] Don't emit "Booting ..." message. UI team still hates this stuff, so we're disabling it for RHEL 7. @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 2e8a7bd..004711d 100644 +index 2e8a7bd89..004711dce 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) @@ -34,7 +34,7 @@ index 2e8a7bd..004711d 100644 /* Callback invoked when a default menu entry executed because of a timeout diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index eeeee55..8349049 100644 +index eeeee5580..83490494e 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -1167,9 +1167,6 @@ run (struct screen *screen) @@ -48,5 +48,5 @@ index eeeee55..8349049 100644 errs_before = grub_err_printed_errors; -- -2.9.3 +2.13.0 diff --git a/0048-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0096-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch similarity index 96% rename from 0048-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename to 0096-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index b4972d3c..a60dbff7 100644 --- a/0048-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0096-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -1,7 +1,7 @@ -From cce065ff19272aa908a293632a265211201d7237 Mon Sep 17 00:00:00 2001 +From 360fb73a43a5d42cdca2dbb2d9d83da6ff1fca3d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 4 Mar 2014 11:00:23 -0500 -Subject: [PATCH 48/90] Replace a lot of man pages with slightly nicer ones. +Subject: [PATCH 096/176] Replace a lot of man pages with slightly nicer ones. Replace a bunch of machine generated ones with ones that look nicer. --- @@ -122,7 +122,7 @@ Replace a bunch of machine generated ones with ones that look nicer. create mode 100644 util/grub-sparc64-setup.8 diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index b16bd92..39eb94b 100644 +index b16bd9253..39eb94bde 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -11,7 +11,6 @@ EXTRA_DIST += unicode @@ -134,7 +134,7 @@ index b16bd92..39eb94b 100644 EXTRA_DIST += docs/grub.cfg EXTRA_DIST += docs/osdetect.cfg diff --git a/configure.ac b/configure.ac -index ab9134c..9937a82 100644 +index 9ae97f026..0cb971a92 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default]) @@ -168,7 +168,7 @@ index ab9134c..9937a82 100644 # Optimization flag. Allow user to override. if test "x$TARGET_CFLAGS" = x; then diff --git a/docs/Makefile.am b/docs/Makefile.am -index 93eb396..ab28f19 100644 +index 93eb39627..ab28f1996 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -5,5 +5,3 @@ info_TEXINFOS = grub.texi grub-dev.texi @@ -179,7 +179,7 @@ index 93eb396..ab28f19 100644 - diff --git a/docs/man/grub-bios-setup.h2m b/docs/man/grub-bios-setup.h2m deleted file mode 100644 -index ac6ede3..0000000 +index ac6ede362..000000000 --- a/docs/man/grub-bios-setup.h2m +++ /dev/null @@ -1,6 +0,0 @@ @@ -191,7 +191,7 @@ index ac6ede3..0000000 -.BR grub-mkrescue (1) diff --git a/docs/man/grub-editenv.h2m b/docs/man/grub-editenv.h2m deleted file mode 100644 -index 3859d3d..0000000 +index 3859d3d4c..000000000 --- a/docs/man/grub-editenv.h2m +++ /dev/null @@ -1,5 +0,0 @@ @@ -202,7 +202,7 @@ index 3859d3d..0000000 -.BR grub-set-default (8) diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m deleted file mode 100644 -index ef1c000..0000000 +index ef1c00065..000000000 --- a/docs/man/grub-emu.h2m +++ /dev/null @@ -1,6 +0,0 @@ @@ -214,7 +214,7 @@ index ef1c000..0000000 -rather than this program. diff --git a/docs/man/grub-file.h2m b/docs/man/grub-file.h2m deleted file mode 100644 -index e09bb4d..0000000 +index e09bb4d31..000000000 --- a/docs/man/grub-file.h2m +++ /dev/null @@ -1,2 +0,0 @@ @@ -222,7 +222,7 @@ index e09bb4d..0000000 -grub-file \- check file type diff --git a/docs/man/grub-fstest.h2m b/docs/man/grub-fstest.h2m deleted file mode 100644 -index 9676b15..0000000 +index 9676b159a..000000000 --- a/docs/man/grub-fstest.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -232,7 +232,7 @@ index 9676b15..0000000 -.BR grub-probe (8) diff --git a/docs/man/grub-glue-efi.h2m b/docs/man/grub-glue-efi.h2m deleted file mode 100644 -index c1c6ded..0000000 +index c1c6ded49..000000000 --- a/docs/man/grub-glue-efi.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -242,7 +242,7 @@ index c1c6ded..0000000 -grub-glue-efi processes ia32 and amd64 EFI images and glues them according to Apple format. diff --git a/docs/man/grub-install.h2m b/docs/man/grub-install.h2m deleted file mode 100644 -index 8cbbc87..0000000 +index 8cbbc87a0..000000000 --- a/docs/man/grub-install.h2m +++ /dev/null @@ -1,6 +0,0 @@ @@ -254,7 +254,7 @@ index 8cbbc87..0000000 -.BR grub-mkrescue (1) diff --git a/docs/man/grub-kbdcomp.h2m b/docs/man/grub-kbdcomp.h2m deleted file mode 100644 -index d81f915..0000000 +index d81f9157e..000000000 --- a/docs/man/grub-kbdcomp.h2m +++ /dev/null @@ -1,10 +0,0 @@ @@ -270,7 +270,7 @@ index d81f915..0000000 -.BR grub-mklayout (8) diff --git a/docs/man/grub-macbless.h2m b/docs/man/grub-macbless.h2m deleted file mode 100644 -index 0197c00..0000000 +index 0197c0087..000000000 --- a/docs/man/grub-macbless.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -280,7 +280,7 @@ index 0197c00..0000000 -.BR grub-install (1) diff --git a/docs/man/grub-macho2img.h2m b/docs/man/grub-macho2img.h2m deleted file mode 100644 -index d79aaee..0000000 +index d79aaeed8..000000000 --- a/docs/man/grub-macho2img.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -290,7 +290,7 @@ index d79aaee..0000000 -.BR grub-mkimage (1) diff --git a/docs/man/grub-menulst2cfg.h2m b/docs/man/grub-menulst2cfg.h2m deleted file mode 100644 -index c2e0055..0000000 +index c2e0055ed..000000000 --- a/docs/man/grub-menulst2cfg.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -300,7 +300,7 @@ index c2e0055..0000000 -.BR grub-mkconfig (8) diff --git a/docs/man/grub-mkconfig.h2m b/docs/man/grub-mkconfig.h2m deleted file mode 100644 -index 9b42f81..0000000 +index 9b42f8130..000000000 --- a/docs/man/grub-mkconfig.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -310,7 +310,7 @@ index 9b42f81..0000000 -.BR grub-install (8) diff --git a/docs/man/grub-mkfont.h2m b/docs/man/grub-mkfont.h2m deleted file mode 100644 -index d46fe60..0000000 +index d46fe600e..000000000 --- a/docs/man/grub-mkfont.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -320,7 +320,7 @@ index d46fe60..0000000 -.BR grub-mkconfig (8) diff --git a/docs/man/grub-mkimage.h2m b/docs/man/grub-mkimage.h2m deleted file mode 100644 -index f0fbc2b..0000000 +index f0fbc2bb1..000000000 --- a/docs/man/grub-mkimage.h2m +++ /dev/null @@ -1,6 +0,0 @@ @@ -332,7 +332,7 @@ index f0fbc2b..0000000 -.BR grub-mknetdir (8) diff --git a/docs/man/grub-mklayout.h2m b/docs/man/grub-mklayout.h2m deleted file mode 100644 -index 1e43409..0000000 +index 1e43409c0..000000000 --- a/docs/man/grub-mklayout.h2m +++ /dev/null @@ -1,10 +0,0 @@ @@ -348,7 +348,7 @@ index 1e43409..0000000 -.BR grub-mkconfig (8) diff --git a/docs/man/grub-mknetdir.h2m b/docs/man/grub-mknetdir.h2m deleted file mode 100644 -index a2ef13e..0000000 +index a2ef13ec1..000000000 --- a/docs/man/grub-mknetdir.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -358,7 +358,7 @@ index a2ef13e..0000000 -.BR grub-mkimage (1) diff --git a/docs/man/grub-mkpasswd-pbkdf2.h2m b/docs/man/grub-mkpasswd-pbkdf2.h2m deleted file mode 100644 -index 4d202f3..0000000 +index 4d202f3da..000000000 --- a/docs/man/grub-mkpasswd-pbkdf2.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -368,7 +368,7 @@ index 4d202f3..0000000 -.BR grub-mkconfig (8) diff --git a/docs/man/grub-mkrelpath.h2m b/docs/man/grub-mkrelpath.h2m deleted file mode 100644 -index d01f396..0000000 +index d01f3961e..000000000 --- a/docs/man/grub-mkrelpath.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -378,7 +378,7 @@ index d01f396..0000000 -.BR grub-probe (8) diff --git a/docs/man/grub-mkrescue.h2m b/docs/man/grub-mkrescue.h2m deleted file mode 100644 -index a427f02..0000000 +index a427f02e3..000000000 --- a/docs/man/grub-mkrescue.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -388,7 +388,7 @@ index a427f02..0000000 -.BR grub-mkimage (1) diff --git a/docs/man/grub-mkstandalone.h2m b/docs/man/grub-mkstandalone.h2m deleted file mode 100644 -index c773139..0000000 +index c77313978..000000000 --- a/docs/man/grub-mkstandalone.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -398,7 +398,7 @@ index c773139..0000000 -.BR grub-mkimage (1) diff --git a/docs/man/grub-mount.h2m b/docs/man/grub-mount.h2m deleted file mode 100644 -index 8d16898..0000000 +index 8d168982d..000000000 --- a/docs/man/grub-mount.h2m +++ /dev/null @@ -1,2 +0,0 @@ @@ -406,7 +406,7 @@ index 8d16898..0000000 -grub-mount \- export GRUB filesystem with FUSE diff --git a/docs/man/grub-ofpathname.h2m b/docs/man/grub-ofpathname.h2m deleted file mode 100644 -index 74b43ee..0000000 +index 74b43eea0..000000000 --- a/docs/man/grub-ofpathname.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -416,7 +416,7 @@ index 74b43ee..0000000 -.BR grub-probe (8) diff --git a/docs/man/grub-pe2elf.h2m b/docs/man/grub-pe2elf.h2m deleted file mode 100644 -index 7ca29bd..0000000 +index 7ca29bd70..000000000 --- a/docs/man/grub-pe2elf.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -426,7 +426,7 @@ index 7ca29bd..0000000 -.BR grub-mkimage (1) diff --git a/docs/man/grub-probe.h2m b/docs/man/grub-probe.h2m deleted file mode 100644 -index 6e1ffdc..0000000 +index 6e1ffdcf9..000000000 --- a/docs/man/grub-probe.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -436,7 +436,7 @@ index 6e1ffdc..0000000 -.BR grub-fstest (1) diff --git a/docs/man/grub-reboot.h2m b/docs/man/grub-reboot.h2m deleted file mode 100644 -index e4acace..0000000 +index e4acace65..000000000 --- a/docs/man/grub-reboot.h2m +++ /dev/null @@ -1,5 +0,0 @@ @@ -447,7 +447,7 @@ index e4acace..0000000 -.BR grub-editenv (1) diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m deleted file mode 100644 -index 50ae524..0000000 +index 50ae5247c..000000000 --- a/docs/man/grub-render-label.h2m +++ /dev/null @@ -1,3 +0,0 @@ @@ -456,7 +456,7 @@ index 50ae524..0000000 - diff --git a/docs/man/grub-script-check.h2m b/docs/man/grub-script-check.h2m deleted file mode 100644 -index 3653682..0000000 +index 365368267..000000000 --- a/docs/man/grub-script-check.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -466,7 +466,7 @@ index 3653682..0000000 -.BR grub-mkconfig (8) diff --git a/docs/man/grub-set-default.h2m b/docs/man/grub-set-default.h2m deleted file mode 100644 -index 7945001..0000000 +index 7945001c1..000000000 --- a/docs/man/grub-set-default.h2m +++ /dev/null @@ -1,5 +0,0 @@ @@ -477,7 +477,7 @@ index 7945001..0000000 -.BR grub-editenv (1) diff --git a/docs/man/grub-sparc64-setup.h2m b/docs/man/grub-sparc64-setup.h2m deleted file mode 100644 -index 18f803a..0000000 +index 18f803a50..000000000 --- a/docs/man/grub-sparc64-setup.h2m +++ /dev/null @@ -1,6 +0,0 @@ @@ -489,7 +489,7 @@ index 18f803a..0000000 -.BR grub-mkrescue (1) diff --git a/docs/man/grub-syslinux2cfg.h2m b/docs/man/grub-syslinux2cfg.h2m deleted file mode 100644 -index ad25c8a..0000000 +index ad25c8ab7..000000000 --- a/docs/man/grub-syslinux2cfg.h2m +++ /dev/null @@ -1,4 +0,0 @@ @@ -498,10 +498,10 @@ index ad25c8a..0000000 -[SEE ALSO] -.BR grub-menulst2cfg (8) diff --git a/gentpl.py b/gentpl.py -index f08bcc4..f069585 100644 +index da67965a4..bf8439fa7 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -800,10 +800,7 @@ def manpage(defn, adddeps): +@@ -802,10 +802,7 @@ def manpage(defn, adddeps): output("if COND_MAN_PAGES\n") gvar_add("man_MANS", name + "." + mansection) @@ -515,7 +515,7 @@ index f08bcc4..f069585 100644 diff --git a/util/grub-bios-setup.8 b/util/grub-bios-setup.8 new file mode 100644 -index 0000000..56f582b +index 000000000..56f582b3d --- /dev/null +++ b/util/grub-bios-setup.8 @@ -0,0 +1,54 @@ @@ -575,7 +575,7 @@ index 0000000..56f582b +.BR "info grub" diff --git a/util/grub-editenv.1 b/util/grub-editenv.1 new file mode 100644 -index 0000000..d28ba03 +index 000000000..d28ba03ba --- /dev/null +++ b/util/grub-editenv.1 @@ -0,0 +1,46 @@ @@ -627,7 +627,7 @@ index 0000000..d28ba03 +.BR "info grub" diff --git a/util/grub-file.1 b/util/grub-file.1 new file mode 100644 -index 0000000..b29cb32 +index 000000000..b29cb3278 --- /dev/null +++ b/util/grub-file.1 @@ -0,0 +1,165 @@ @@ -798,7 +798,7 @@ index 0000000..b29cb32 +.BR "info grub" diff --git a/util/grub-fstest.1 b/util/grub-fstest.1 new file mode 100644 -index 0000000..792fa78 +index 000000000..792fa7863 --- /dev/null +++ b/util/grub-fstest.1 @@ -0,0 +1,99 @@ @@ -903,7 +903,7 @@ index 0000000..792fa78 +.BR "info grub" diff --git a/util/grub-glue-efi.1 b/util/grub-glue-efi.1 new file mode 100644 -index 0000000..72bd555 +index 000000000..72bd555d5 --- /dev/null +++ b/util/grub-glue-efi.1 @@ -0,0 +1,31 @@ @@ -940,7 +940,7 @@ index 0000000..72bd555 +.BR "info grub" diff --git a/util/grub-install.8 b/util/grub-install.8 new file mode 100644 -index 0000000..76272a3 +index 000000000..76272a39d --- /dev/null +++ b/util/grub-install.8 @@ -0,0 +1,129 @@ @@ -1075,7 +1075,7 @@ index 0000000..76272a3 +.BR "info grub" diff --git a/util/grub-kbdcomp.1 b/util/grub-kbdcomp.1 new file mode 100644 -index 0000000..0bb969a +index 000000000..0bb969a5b --- /dev/null +++ b/util/grub-kbdcomp.1 @@ -0,0 +1,19 @@ @@ -1100,7 +1100,7 @@ index 0000000..0bb969a +.BR "info grub" diff --git a/util/grub-macbless.1 b/util/grub-macbless.1 new file mode 100644 -index 0000000..41a9618 +index 000000000..41a96186f --- /dev/null +++ b/util/grub-macbless.1 @@ -0,0 +1,22 @@ @@ -1128,7 +1128,7 @@ index 0000000..41a9618 +.BR "info grub" diff --git a/util/grub-menulst2cfg.1 b/util/grub-menulst2cfg.1 new file mode 100644 -index 0000000..91e2ef8 +index 000000000..91e2ef871 --- /dev/null +++ b/util/grub-menulst2cfg.1 @@ -0,0 +1,12 @@ @@ -1146,7 +1146,7 @@ index 0000000..91e2ef8 +.BR "info grub" diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 new file mode 100644 -index 0000000..a2d1f57 +index 000000000..a2d1f577b --- /dev/null +++ b/util/grub-mkconfig.8 @@ -0,0 +1,17 @@ @@ -1169,7 +1169,7 @@ index 0000000..a2d1f57 +.BR "info grub" diff --git a/util/grub-mkfont.1 b/util/grub-mkfont.1 new file mode 100644 -index 0000000..3494857 +index 000000000..349485798 --- /dev/null +++ b/util/grub-mkfont.1 @@ -0,0 +1,87 @@ @@ -1262,7 +1262,7 @@ index 0000000..3494857 +.BR "info grub" diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1 new file mode 100644 -index 0000000..4dea4f5 +index 000000000..4dea4f545 --- /dev/null +++ b/util/grub-mkimage.1 @@ -0,0 +1,95 @@ @@ -1363,7 +1363,7 @@ index 0000000..4dea4f5 +.BR "info grub" diff --git a/util/grub-mklayout.1 b/util/grub-mklayout.1 new file mode 100644 -index 0000000..d1bbc2e +index 000000000..d1bbc2ec5 --- /dev/null +++ b/util/grub-mklayout.1 @@ -0,0 +1,27 @@ @@ -1396,7 +1396,7 @@ index 0000000..d1bbc2e +.BR "info grub" diff --git a/util/grub-mknetdir.1 b/util/grub-mknetdir.1 new file mode 100644 -index 0000000..fa7e8d4 +index 000000000..fa7e8d4ef --- /dev/null +++ b/util/grub-mknetdir.1 @@ -0,0 +1,12 @@ @@ -1414,7 +1414,7 @@ index 0000000..fa7e8d4 +.BR "info grub" diff --git a/util/grub-mkpasswd-pbkdf2.1 b/util/grub-mkpasswd-pbkdf2.1 new file mode 100644 -index 0000000..73c437c +index 000000000..73c437c15 --- /dev/null +++ b/util/grub-mkpasswd-pbkdf2.1 @@ -0,0 +1,27 @@ @@ -1447,7 +1447,7 @@ index 0000000..73c437c +.BR "info grub" diff --git a/util/grub-mkrelpath.1 b/util/grub-mkrelpath.1 new file mode 100644 -index 0000000..85f1113 +index 000000000..85f111362 --- /dev/null +++ b/util/grub-mkrelpath.1 @@ -0,0 +1,12 @@ @@ -1465,7 +1465,7 @@ index 0000000..85f1113 +.BR "info grub" diff --git a/util/grub-mkrescue.1 b/util/grub-mkrescue.1 new file mode 100644 -index 0000000..4ed9fc7 +index 000000000..4ed9fc723 --- /dev/null +++ b/util/grub-mkrescue.1 @@ -0,0 +1,123 @@ @@ -1594,7 +1594,7 @@ index 0000000..4ed9fc7 +.BR "info grub" diff --git a/util/grub-mkstandalone.1 b/util/grub-mkstandalone.1 new file mode 100644 -index 0000000..ba2d2bd +index 000000000..ba2d2bdf2 --- /dev/null +++ b/util/grub-mkstandalone.1 @@ -0,0 +1,100 @@ @@ -1700,7 +1700,7 @@ index 0000000..ba2d2bd +.BR "info grub" diff --git a/util/grub-ofpathname.8 b/util/grub-ofpathname.8 new file mode 100644 -index 0000000..bf3743a +index 000000000..bf3743aeb --- /dev/null +++ b/util/grub-ofpathname.8 @@ -0,0 +1,12 @@ @@ -1718,7 +1718,7 @@ index 0000000..bf3743a +.BR "info grub" diff --git a/util/grub-probe.8 b/util/grub-probe.8 new file mode 100644 -index 0000000..04e26c8 +index 000000000..04e26c832 --- /dev/null +++ b/util/grub-probe.8 @@ -0,0 +1,80 @@ @@ -1804,7 +1804,7 @@ index 0000000..04e26c8 +.BR "info grub" diff --git a/util/grub-reboot.8 b/util/grub-reboot.8 new file mode 100644 -index 0000000..faa5e4e +index 000000000..faa5e4eec --- /dev/null +++ b/util/grub-reboot.8 @@ -0,0 +1,21 @@ @@ -1831,7 +1831,7 @@ index 0000000..faa5e4e +.BR "info grub" diff --git a/util/grub-render-label.1 b/util/grub-render-label.1 new file mode 100644 -index 0000000..4d51c8a +index 000000000..4d51c8abf --- /dev/null +++ b/util/grub-render-label.1 @@ -0,0 +1,51 @@ @@ -1888,7 +1888,7 @@ index 0000000..4d51c8a +.BR "info grub" diff --git a/util/grub-script-check.1 b/util/grub-script-check.1 new file mode 100644 -index 0000000..0f1f625 +index 000000000..0f1f625b0 --- /dev/null +++ b/util/grub-script-check.1 @@ -0,0 +1,21 @@ @@ -1915,7 +1915,7 @@ index 0000000..0f1f625 +.BR "info grub" diff --git a/util/grub-set-default.8 b/util/grub-set-default.8 new file mode 100644 -index 0000000..a96265a +index 000000000..a96265a15 --- /dev/null +++ b/util/grub-set-default.8 @@ -0,0 +1,21 @@ @@ -1942,7 +1942,7 @@ index 0000000..a96265a +.BR "info grub" diff --git a/util/grub-sparc64-setup.8 b/util/grub-sparc64-setup.8 new file mode 100644 -index 0000000..37ea2dd +index 000000000..37ea2dd5e --- /dev/null +++ b/util/grub-sparc64-setup.8 @@ -0,0 +1,12 @@ @@ -1959,5 +1959,5 @@ index 0000000..37ea2dd +.SH SEE ALSO +.BR "info grub" -- -2.9.3 +2.13.0 diff --git a/0049-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0097-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 88% rename from 0049-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0097-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 626253f7..580b64b4 100644 --- a/0049-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0097-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -1,7 +1,7 @@ -From c28ddef07d11d790d89ee6ec8e3a8cc7e1aace0d Mon Sep 17 00:00:00 2001 +From f6319b18918458b54a9a717af070aade15b27b98 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 19 Feb 2014 15:58:43 -0500 -Subject: [PATCH 49/90] use fw_path prefix when fallback searching for grub +Subject: [PATCH 097/176] use fw_path prefix when fallback searching for grub config When PXE booting via UEFI firmware, grub was searching for grub.cfg @@ -18,7 +18,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 0ce59fd..a3713ef 100644 +index 0ce59fdc3..a3713efcd 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -41,5 +41,5 @@ index 0ce59fd..a3713ef 100644 { grub_size_t config_len; -- -2.9.3 +2.13.0 diff --git a/0050-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0098-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 93% rename from 0050-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0098-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 4dabe638..b8e598be 100644 --- a/0050-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0098-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -1,7 +1,8 @@ -From 82812e4ade82c9aa4f2e8f091b60b714ecfd82e5 Mon Sep 17 00:00:00 2001 +From 8ead76471f0b971efbbeb756d8274b2d0984e611 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 6 Mar 2014 11:51:33 -0500 -Subject: [PATCH 50/90] Try mac/guid/etc before grub.cfg on tftp config files. +Subject: [PATCH 098/176] Try mac/guid/etc before grub.cfg on tftp config + files. Signed-off-by: Peter Jones --- @@ -9,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index a3713ef..7d9c4f0 100644 +index a3713efcd..7d9c4f09b 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -341,53 +341,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -110,5 +111,5 @@ index a3713ef..7d9c4f0 100644 else grub_enter_normal_mode (argv[0]); -- -2.9.3 +2.13.0 diff --git a/0051-Fix-convert-function-to-support-NVMe-devices.patch b/0099-Fix-convert-function-to-support-NVMe-devices.patch similarity index 88% rename from 0051-Fix-convert-function-to-support-NVMe-devices.patch rename to 0099-Fix-convert-function-to-support-NVMe-devices.patch index 8cda91ae..415e80ee 100644 --- a/0051-Fix-convert-function-to-support-NVMe-devices.patch +++ b/0099-Fix-convert-function-to-support-NVMe-devices.patch @@ -1,7 +1,7 @@ -From b954efc0812579f973031b24c68a2f593bd89ba1 Mon Sep 17 00:00:00 2001 +From 6ea677bb5656a84ea72d42ad4959b0b188f678b8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 18 Feb 2014 11:34:00 -0500 -Subject: [PATCH 51/90] Fix convert function to support NVMe devices +Subject: [PATCH 099/176] Fix convert function to support NVMe devices This is adapted from the patch at https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against @@ -18,7 +18,7 @@ Signed-off-by: Peter Jones 1 file changed, 19 insertions(+) diff --git a/util/getroot.c b/util/getroot.c -index 92c0d70..bf317a2 100644 +index 847406fba..fa3460d6c 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -153,6 +153,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part) @@ -55,5 +55,5 @@ index 92c0d70..bf317a2 100644 return grub_util_devmapper_part_to_disk (&st, is_part, os_dev); -- -2.9.3 +2.13.0 diff --git a/0052-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch b/0100-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch similarity index 79% rename from 0052-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch rename to 0100-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch index 9228cd23..2be83583 100644 --- a/0052-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch +++ b/0100-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch @@ -1,7 +1,7 @@ -From 6900527741a21097f57a72854944f3e078a0ee42 Mon Sep 17 00:00:00 2001 +From bb37b095c87a7c773ffce409d88e57924b8e8e99 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Mon, 10 Feb 2014 16:13:10 -0500 -Subject: [PATCH 52/90] Switch to use APM Mustang device tree, for hardware +Subject: [PATCH 100/176] Switch to use APM Mustang device tree, for hardware testing. Signed-off-by: David A. Marlin @@ -10,7 +10,7 @@ Signed-off-by: David A. Marlin 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 79a747e..462b461 100644 +index 79a747ebd..462b461ff 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -232,8 +232,8 @@ while [ "x$list" != "x" ] ; do @@ -25,5 +25,5 @@ index 79a747e..462b461 100644 fi done -- -2.9.3 +2.13.0 diff --git a/0053-Use-the-default-device-tree-from-the-grub-default-fi.patch b/0101-Use-the-default-device-tree-from-the-grub-default-fi.patch similarity index 83% rename from 0053-Use-the-default-device-tree-from-the-grub-default-fi.patch rename to 0101-Use-the-default-device-tree-from-the-grub-default-fi.patch index 2ba5537b..99bb1c3a 100644 --- a/0053-Use-the-default-device-tree-from-the-grub-default-fi.patch +++ b/0101-Use-the-default-device-tree-from-the-grub-default-fi.patch @@ -1,7 +1,8 @@ -From 823290f622902f1ae06efa29efbe4ca15af1aafe Mon Sep 17 00:00:00 2001 +From f158ae5fa54ff3bdaf8720ee2667430037d978c6 Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Wed, 12 Feb 2014 14:54:04 -0500 -Subject: [PATCH 53/90] Use the default device tree from the grub default file +Subject: [PATCH 101/176] Use the default device tree from the grub default + file instead of hardcoding a value. @@ -12,7 +13,7 @@ Signed-off-by: David A. Marlin 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index c088b70..9d595ac 100644 +index c088b7054..9d595ac05 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -235,7 +235,8 @@ export GRUB_DEFAULT \ @@ -26,7 +27,7 @@ index c088b70..9d595ac 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 462b461..a9692a0 100644 +index 462b461ff..a9692a0c2 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -232,8 +232,8 @@ while [ "x$list" != "x" ] ; do @@ -41,5 +42,5 @@ index 462b461..a9692a0 100644 fi done -- -2.9.3 +2.13.0 diff --git a/0054-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0102-reopen-SNP-protocol-for-exclusive-use-by-grub.patch similarity index 88% rename from 0054-reopen-SNP-protocol-for-exclusive-use-by-grub.patch rename to 0102-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index b5cc9675..4246f17b 100644 --- a/0054-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0102-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,14 +1,14 @@ -From e119353dad1eadc771a011f82bf90bd04fc00f9a Mon Sep 17 00:00:00 2001 +From 6d9ce9d5bb1d2cf5ae0b81f4dea62a9da1671daf Mon Sep 17 00:00:00 2001 From: Fedora Ninjas Date: Sat, 15 Feb 2014 15:10:22 -0500 -Subject: [PATCH 54/90] reopen SNP protocol for exclusive use by grub +Subject: [PATCH 102/176] reopen SNP protocol for exclusive use by grub --- grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f95..ea0e0ca 100644 +index 5388f952b..ea0e0ca36 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -330,6 +330,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -42,5 +42,5 @@ index 5388f95..ea0e0ca 100644 } } -- -2.9.3 +2.13.0 diff --git a/0055-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0103-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch similarity index 89% rename from 0055-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch rename to 0103-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch index 76b86355..4f533367 100644 --- a/0055-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +++ b/0103-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -1,7 +1,8 @@ -From 5d47b56198754190c62179ae10ef175c00d1474d Mon Sep 17 00:00:00 2001 +From 94bd63821b5bb9e3c95de006a5f7527a86bc53a9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Mar 2016 15:13:59 -0500 -Subject: [PATCH 55/90] Revert "reopen SNP protocol for exclusive use by grub" +Subject: [PATCH 103/176] Revert "reopen SNP protocol for exclusive use by + grub" This reverts commit a3f2c756ce34c9666bddef35e3b3b85ccecdcffc , which is obsoleted by these: @@ -16,7 +17,7 @@ Signed-off-by: Peter Jones 1 file changed, 16 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index ea0e0ca..5388f95 100644 +index ea0e0ca36..5388f952b 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -330,7 +330,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -50,5 +51,5 @@ index ea0e0ca..5388f95 100644 } } -- -2.9.3 +2.13.0 diff --git a/0056-Add-grub_util_readlink.patch b/0104-Add-grub_util_readlink.patch similarity index 99% rename from 0056-Add-grub_util_readlink.patch rename to 0104-Add-grub_util_readlink.patch index f15414a0..92511157 100644 --- a/0056-Add-grub_util_readlink.patch +++ b/0104-Add-grub_util_readlink.patch @@ -1,7 +1,7 @@ -From 5a69c7fbfff14bcea80e781fcd6acad07c904e22 Mon Sep 17 00:00:00 2001 +From 576498550cbfb335c6754a04e838818f670cdfe4 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:01:03 -0400 -Subject: [PATCH 56/90] Add grub_util_readlink() +Subject: [PATCH 104/176] Add grub_util_readlink() Add grub_util_readlink(). This requires pulling in stat and readlink from gnulib, which pulls in stat and related headers, but after that the @@ -53,7 +53,7 @@ Reviewed-by: Adam Jackson create mode 100644 m4/time_h.m4 diff --git a/grub-core/gnulib/Makefile.am b/grub-core/gnulib/Makefile.am -index 3444397..b7c5e60 100644 +index 3444397fe..b7c5e60e1 100644 --- a/grub-core/gnulib/Makefile.am +++ b/grub-core/gnulib/Makefile.am @@ -21,7 +21,7 @@ @@ -284,7 +284,7 @@ index 3444397..b7c5e60 100644 BUILT_SOURCES += unistd.h diff --git a/grub-core/gnulib/gettimeofday.c b/grub-core/gnulib/gettimeofday.c new file mode 100644 -index 0000000..8b2058e +index 000000000..8b2058e8c --- /dev/null +++ b/grub-core/gnulib/gettimeofday.c @@ -0,0 +1,154 @@ @@ -444,7 +444,7 @@ index 0000000..8b2058e +} diff --git a/grub-core/gnulib/pathmax.h b/grub-core/gnulib/pathmax.h new file mode 100644 -index 0000000..33fc355 +index 000000000..33fc3553d --- /dev/null +++ b/grub-core/gnulib/pathmax.h @@ -0,0 +1,83 @@ @@ -533,7 +533,7 @@ index 0000000..33fc355 +#endif /* _PATHMAX_H */ diff --git a/grub-core/gnulib/readlink.c b/grub-core/gnulib/readlink.c new file mode 100644 -index 0000000..4c49639 +index 000000000..4c4963951 --- /dev/null +++ b/grub-core/gnulib/readlink.c @@ -0,0 +1,74 @@ @@ -613,7 +613,7 @@ index 0000000..4c49639 +#endif /* HAVE_READLINK */ diff --git a/grub-core/gnulib/stat.c b/grub-core/gnulib/stat.c new file mode 100644 -index 0000000..35f4b0b +index 000000000..35f4b0b1a --- /dev/null +++ b/grub-core/gnulib/stat.c @@ -0,0 +1,138 @@ @@ -757,7 +757,7 @@ index 0000000..35f4b0b +} diff --git a/grub-core/gnulib/sys_stat.in.h b/grub-core/gnulib/sys_stat.in.h new file mode 100644 -index 0000000..b47a7ff +index 000000000..b47a7ff0a --- /dev/null +++ b/grub-core/gnulib/sys_stat.in.h @@ -0,0 +1,732 @@ @@ -1495,7 +1495,7 @@ index 0000000..b47a7ff +#endif diff --git a/grub-core/gnulib/sys_time.in.h b/grub-core/gnulib/sys_time.in.h new file mode 100644 -index 0000000..30057ad +index 000000000..30057ad49 --- /dev/null +++ b/grub-core/gnulib/sys_time.in.h @@ -0,0 +1,213 @@ @@ -1713,7 +1713,7 @@ index 0000000..30057ad +#endif /* _CYGWIN_SYS_TIME_H */ +#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ diff --git a/grub-core/gnulib/sys_types.in.h b/grub-core/gnulib/sys_types.in.h -index d7da356..9520c09 100644 +index d7da35623..9520c0903 100644 --- a/grub-core/gnulib/sys_types.in.h +++ b/grub-core/gnulib/sys_types.in.h @@ -23,7 +23,9 @@ @@ -1728,7 +1728,7 @@ index d7da356..9520c09 100644 #define _@GUARD_PREFIX@_SYS_TYPES_H diff --git a/grub-core/gnulib/time.h b/grub-core/gnulib/time.h new file mode 100644 -index 0000000..b9203d5 +index 000000000..b9203d556 --- /dev/null +++ b/grub-core/gnulib/time.h @@ -0,0 +1,586 @@ @@ -2320,7 +2320,7 @@ index 0000000..b9203d5 +#endif diff --git a/grub-core/gnulib/time.in.h b/grub-core/gnulib/time.in.h new file mode 100644 -index 0000000..81abdf4 +index 000000000..81abdf46e --- /dev/null +++ b/grub-core/gnulib/time.in.h @@ -0,0 +1,274 @@ @@ -2599,7 +2599,7 @@ index 0000000..81abdf4 + +#endif diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c -index 85507af..6f49df4 100644 +index 85507af88..6f49df465 100644 --- a/grub-core/osdep/windows/hostdisk.c +++ b/grub-core/osdep/windows/hostdisk.c @@ -353,6 +353,12 @@ grub_util_mkdir (const char *dir) @@ -2616,7 +2616,7 @@ index 85507af..6f49df4 100644 grub_util_rename (const char *from, const char *to) { diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h -index a059c0f..161fbb7 100644 +index a059c0fa4..161fbb7bd 100644 --- a/include/grub/osdep/hostfile_aros.h +++ b/include/grub/osdep/hostfile_aros.h @@ -68,6 +68,12 @@ grub_util_rename (const char *from, const char *to) @@ -2633,7 +2633,7 @@ index a059c0f..161fbb7 100644 struct grub_util_fd diff --git a/include/grub/osdep/hostfile_unix.h b/include/grub/osdep/hostfile_unix.h -index 9ffe46f..17cd3aa 100644 +index 9ffe46fa3..17cd3aa8b 100644 --- a/include/grub/osdep/hostfile_unix.h +++ b/include/grub/osdep/hostfile_unix.h @@ -71,6 +71,12 @@ grub_util_rename (const char *from, const char *to) @@ -2650,7 +2650,7 @@ index 9ffe46f..17cd3aa 100644 #if defined (__NetBSD__) diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h -index bf6451b..8c92d05 100644 +index bf6451b6d..8c92d0591 100644 --- a/include/grub/osdep/hostfile_windows.h +++ b/include/grub/osdep/hostfile_windows.h @@ -41,6 +41,8 @@ typedef struct grub_util_fd_dir *grub_util_fd_dir_t; @@ -2664,7 +2664,7 @@ index bf6451b..8c92d05 100644 void diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 new file mode 100644 -index 0000000..1c2d66e +index 000000000..1c2d66ee2 --- /dev/null +++ b/m4/gettimeofday.m4 @@ -0,0 +1,138 @@ @@ -2807,7 +2807,7 @@ index 0000000..1c2d66e + AC_CHECK_FUNCS([_ftime]) +]) diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 -index 4089184..ef2ec5b 100644 +index 408918440..ef2ec5bcc 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ @@ -2828,7 +2828,7 @@ index 4089184..ef2ec5b 100644 ]) gl_AVOID([]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 -index 7a19f60..66fd0ed 100644 +index 7a19f60d8..66fd0eda9 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -60,10 +60,13 @@ AC_DEFUN([gl_EARLY], @@ -3035,7 +3035,7 @@ index 7a19f60..66fd0ed 100644 m4/vasnprintf.m4 diff --git a/m4/largefile.m4 b/m4/largefile.m4 new file mode 100644 -index 0000000..a1b564a +index 000000000..a1b564ad9 --- /dev/null +++ b/m4/largefile.m4 @@ -0,0 +1,146 @@ @@ -3187,7 +3187,7 @@ index 0000000..a1b564a +]) diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 new file mode 100644 -index 0000000..114f91f +index 000000000..114f91f04 --- /dev/null +++ b/m4/pathmax.m4 @@ -0,0 +1,42 @@ @@ -3235,7 +3235,7 @@ index 0000000..114f91f +]) diff --git a/m4/readlink.m4 b/m4/readlink.m4 new file mode 100644 -index 0000000..f9ce868 +index 000000000..f9ce868c2 --- /dev/null +++ b/m4/readlink.m4 @@ -0,0 +1,71 @@ @@ -3312,7 +3312,7 @@ index 0000000..f9ce868 +]) diff --git a/m4/stat.m4 b/m4/stat.m4 new file mode 100644 -index 0000000..1ae327b +index 000000000..1ae327b36 --- /dev/null +++ b/m4/stat.m4 @@ -0,0 +1,71 @@ @@ -3389,7 +3389,7 @@ index 0000000..1ae327b +AC_DEFUN([gl_PREREQ_STAT], [:]) diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 new file mode 100644 -index 0000000..eaa7642 +index 000000000..eaa7642ba --- /dev/null +++ b/m4/sys_stat_h.m4 @@ -0,0 +1,96 @@ @@ -3491,7 +3491,7 @@ index 0000000..eaa7642 +]) diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 new file mode 100644 -index 0000000..5c79300 +index 000000000..5c79300f8 --- /dev/null +++ b/m4/sys_time_h.m4 @@ -0,0 +1,110 @@ @@ -3607,7 +3607,7 @@ index 0000000..5c79300 +]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 new file mode 100644 -index 0000000..9852778 +index 000000000..9852778f9 --- /dev/null +++ b/m4/time_h.m4 @@ -0,0 +1,118 @@ @@ -3730,5 +3730,5 @@ index 0000000..9852778 + REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) +]) -- -2.9.3 +2.13.0 diff --git a/0057-Make-editenv-chase-symlinks-including-those-across-d.patch b/0105-Make-editenv-chase-symlinks-including-those-across-d.patch similarity index 92% rename from 0057-Make-editenv-chase-symlinks-including-those-across-d.patch rename to 0105-Make-editenv-chase-symlinks-including-those-across-d.patch index 689baec6..f76dff56 100644 --- a/0057-Make-editenv-chase-symlinks-including-those-across-d.patch +++ b/0105-Make-editenv-chase-symlinks-including-those-across-d.patch @@ -1,7 +1,7 @@ -From a867dc42c711385634d86f04176cf3193d548f1d Mon Sep 17 00:00:00 2001 +From 0a62851dcb02d4a059713ae36ea97f13f01000d5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Sep 2014 10:38:00 -0400 -Subject: [PATCH 57/90] Make editenv chase symlinks including those across +Subject: [PATCH 105/176] Make editenv chase symlinks including those across devices. This lets us make /boot/grub2/grubenv a symlink to @@ -17,7 +17,7 @@ Reviewed-by: Adam Jackson 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/Makefile.util.def b/Makefile.util.def -index 6d452da..2061104 100644 +index 6d452da02..206110458 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -230,8 +230,17 @@ program = { @@ -39,7 +39,7 @@ index 6d452da..2061104 100644 ldadd = libgrubgcry.a; ldadd = libgrubkern.a; diff --git a/util/editenv.c b/util/editenv.c -index c6f8d22..d8d1dad 100644 +index c6f8d2298..d8d1dad6a 100644 --- a/util/editenv.c +++ b/util/editenv.c @@ -37,6 +37,7 @@ grub_util_create_envblk_file (const char *name) @@ -102,5 +102,5 @@ index c6f8d22..d8d1dad 100644 + free (rename_target); } -- -2.9.3 +2.13.0 diff --git a/0058-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0106-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 85% rename from 0058-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0106-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index 354a91fd..bb0ca91d 100644 --- a/0058-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0106-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -1,7 +1,8 @@ -From 14b8db374bfc41fffa278ec33084324008384417 Mon Sep 17 00:00:00 2001 +From db8335f73dea6432fa9f87b5e1a25adf011ae62c Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 14:23:23 -0400 -Subject: [PATCH 58/90] Generate OS and CLASS in 10_linux from /etc/os-release +Subject: [PATCH 106/176] Generate OS and CLASS in 10_linux from + /etc/os-release This makes us use pretty names in the titles we generate in grub2-mkconfig when GRUB_DISTRIBUTOR isn't set. @@ -14,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index a9692a0..c662726 100644 +index a9692a0c2..c6627268c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" @@ -28,5 +29,5 @@ index a9692a0..c662726 100644 OS="${GRUB_DISTRIBUTOR}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -- -2.9.3 +2.13.0 diff --git a/0059-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0107-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 84% rename from 0059-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0107-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index e24ee4a9..ca1b1b37 100644 --- a/0059-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0107-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -1,7 +1,7 @@ -From 700c631b4c887778951503346afe5b7ee70bf7dd Mon Sep 17 00:00:00 2001 +From e7b099e5a78ffc103d53ff37b7a9a9175aea8e97 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Sep 2014 15:52:08 -0400 -Subject: [PATCH 59/90] Minimize the sort ordering for .debug and -rescue- +Subject: [PATCH 107/176] Minimize the sort ordering for .debug and -rescue- kernels. Resolves: rhbz#1065360 @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 8 insertions(+) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index cf35e41..10fabee 100644 +index cf35e4174..10fabee5e 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -248,6 +248,14 @@ version_test_gt () @@ -30,5 +30,5 @@ index cf35e41..10fabee 100644 version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" return "$?" -- -2.9.3 +2.13.0 diff --git a/0060-Load-arm-with-SB-enabled.patch b/0108-Load-arm-with-SB-enabled.patch similarity index 97% rename from 0060-Load-arm-with-SB-enabled.patch rename to 0108-Load-arm-with-SB-enabled.patch index 4a31029a..9b797d62 100644 --- a/0060-Load-arm-with-SB-enabled.patch +++ b/0108-Load-arm-with-SB-enabled.patch @@ -1,7 +1,7 @@ -From cae0d2cdb28017df75358e0839c60a9c2521cb82 Mon Sep 17 00:00:00 2001 +From 13b617ad326bf90d713cfde77a668f20939bce1a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 18 Sep 2014 11:26:14 -0400 -Subject: [PATCH 60/90] Load arm with SB enabled. +Subject: [PATCH 108/176] Load arm with SB enabled. Make sure we actually try to validate secure boot on this platform (even though we're not shipping it enabled by default.) @@ -21,10 +21,10 @@ is enabled. create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index e79bb0c..7fba196 100644 +index 3a05683d2..f111f95ef 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1676,6 +1676,8 @@ module = { +@@ -1709,6 +1709,8 @@ module = { ia64_efi = loader/ia64/efi/linux.c; arm = loader/arm/linux.c; arm64 = loader/arm64/linux.c; @@ -33,7 +33,7 @@ index e79bb0c..7fba196 100644 common = loader/linux.c; common = lib/cmdline.c; enable = noemu; -@@ -1743,6 +1745,7 @@ module = { +@@ -1776,6 +1778,7 @@ module = { name = linuxefi; efi = loader/i386/efi/linux.c; efi = lib/cmdline.c; @@ -42,7 +42,7 @@ index e79bb0c..7fba196 100644 enable = x86_64_efi; }; diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 9519d2e..4756ef7 100644 +index 9519d2e4d..4756ef71f 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -28,6 +28,7 @@ @@ -226,7 +226,7 @@ index 9519d2e..4756ef7 100644 if (!linux_args) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c new file mode 100644 -index 0000000..aea378a +index 000000000..aea378adf --- /dev/null +++ b/grub-core/loader/efi/linux.c @@ -0,0 +1,65 @@ @@ -296,7 +296,7 @@ index 0000000..aea378a + return GRUB_ERR_BUG; +} diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index b79e632..e5b7785 100644 +index b79e6320b..e5b778577 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -26,6 +26,7 @@ @@ -363,7 +363,7 @@ index b79e632..e5b7785 100644 static grub_err_t diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 1ea2369..a2ba24e 100644 +index 1ea23696e..a2ba24e9f 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -20,6 +20,7 @@ @@ -388,7 +388,7 @@ index 1ea2369..a2ba24e 100644 #endif /* ! GRUB_LINUX_CPU_HEADER */ diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h new file mode 100644 -index 0000000..d9ede36 +index 000000000..d9ede3677 --- /dev/null +++ b/include/grub/efi/linux.h @@ -0,0 +1,31 @@ @@ -424,5 +424,5 @@ index 0000000..d9ede36 + +#endif /* ! GRUB_EFI_LINUX_HEADER */ -- -2.9.3 +2.13.0 diff --git a/0061-Try-prefix-if-fw_path-doesn-t-work.patch b/0109-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 94% rename from 0061-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0109-Try-prefix-if-fw_path-doesn-t-work.patch index e107208a..9493d975 100644 --- a/0061-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0109-Try-prefix-if-fw_path-doesn-t-work.patch @@ -1,7 +1,7 @@ -From d255a98813193eb2c23f9217106b121278843023 Mon Sep 17 00:00:00 2001 +From 0373b3186da513480a745a17013eceff4f9914c9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 3 Oct 2014 11:08:03 -0400 -Subject: [PATCH 61/90] Try $prefix if $fw_path doesn't work. +Subject: [PATCH 109/176] Try $prefix if $fw_path doesn't work. Related: rhbz#1148652 @@ -13,10 +13,10 @@ Signed-off-by: Peter Jones 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 8a3ecd5..8efa1a6 100644 +index e69c0133e..4dfa41a37 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -139,23 +139,25 @@ grub_machine_get_bootlocation (char **device, char **path) +@@ -138,23 +138,25 @@ grub_machine_get_bootlocation (char **device, char **path) grub_free (canon); } else @@ -57,7 +57,7 @@ index 8a3ecd5..8efa1a6 100644 } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0769bf8..16d2ce0 100644 +index 0769bf850..16d2ce06d 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1850,7 +1850,7 @@ grub_net_search_configfile (char *config) @@ -70,7 +70,7 @@ index 0769bf8..16d2ce0 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7d9c4f0..b69f9e7 100644 +index 7d9c4f09b..b69f9e738 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -331,74 +331,72 @@ grub_enter_normal_mode (const char *config) @@ -207,5 +207,5 @@ index 7d9c4f0..b69f9e7 100644 } -- -2.9.3 +2.13.0 diff --git a/0064-Update-info-with-grub.cfg-netboot-selection-order-11.patch b/0110-Update-info-with-grub.cfg-netboot-selection-order-11.patch similarity index 91% rename from 0064-Update-info-with-grub.cfg-netboot-selection-order-11.patch rename to 0110-Update-info-with-grub.cfg-netboot-selection-order-11.patch index 8f534510..1eb3a442 100644 --- a/0064-Update-info-with-grub.cfg-netboot-selection-order-11.patch +++ b/0110-Update-info-with-grub.cfg-netboot-selection-order-11.patch @@ -1,7 +1,7 @@ -From c4be6106eae8c1b479c325f531a1f81188f400e8 Mon Sep 17 00:00:00 2001 +From e78f55562f260c474d2a536c28c531a3191bacad Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 16:34:51 -0400 -Subject: [PATCH 64/90] Update info with grub.cfg netboot selection order +Subject: [PATCH 110/176] Update info with grub.cfg netboot selection order (#1148650) Added documentation to the grub info page that specifies the order @@ -13,7 +13,7 @@ Resolves rhbz#1148650 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 98d4d0d..4c6323b 100644 +index 6fdd2a041..15a90b26e 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2414,6 +2414,48 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 @@ -66,5 +66,5 @@ index 98d4d0d..4c6323b 100644 @samp{(tftp)} device. -- -2.9.3 +2.13.0 diff --git a/0065-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0111-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch similarity index 91% rename from 0065-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0111-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index 1d5d6224..02269333 100644 --- a/0065-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0111-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -1,7 +1,7 @@ -From 11abe391636d0819902357591aebf0ea01b88130 Mon Sep 17 00:00:00 2001 +From 63b928b291dd5ddf81ca885d3e23fb566a2bb816 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH 65/90] Use Distribution Package Sort for grub2-mkconfig +Subject: [PATCH 111/176] Use Distribution Package Sort for grub2-mkconfig (#1124074) Users reported that newly installed kernels on their systems installed @@ -14,27 +14,27 @@ Resolves rhbz#1124074 .gitignore | 1 + Makefile.util.def | 16 +++ configure.ac | 29 +++++ - util/grub-mkconfig_lib.in | 11 +- + util/grub-mkconfig_lib.in | 8 +- util/grub-rpm-sort.8 | 12 ++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 349 insertions(+), 1 deletion(-) + 6 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 util/grub-rpm-sort.8 create mode 100644 util/grub-rpm-sort.c diff --git a/.gitignore b/.gitignore -index 06c9f3a..7697877 100644 +index e82aa55b1..af431b74f 100644 --- a/.gitignore +++ b/.gitignore -@@ -124,6 +124,7 @@ grub-ofpathname - grub-probe - grub-reboot - grub-render-label +@@ -233,6 +233,7 @@ po/POTFILES.in + po/POTFILES-shell.in + /grub-glue-efi + /grub-render-label +grub-rpm-sort - grub-script-check - grub-set-default - grub-shell + /grub-glue-efi.exe + /grub-render-label.exe + grub-core/gnulib/locale.h diff --git a/Makefile.util.def b/Makefile.util.def -index 2061104..d846b81 100644 +index 206110458..d846b81b5 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -684,6 +684,22 @@ program = { @@ -61,7 +61,7 @@ index 2061104..d846b81 100644 name = grub-mkconfig; common = util/grub-mkconfig.in; diff --git a/configure.ac b/configure.ac -index 9937a82..d5e8d90 100644 +index 0cb971a92..49427cbf9 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -80,14 +80,14 @@ index 9937a82..d5e8d90 100644 grub_TRANSFORM([grub-reboot.3]) grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) -@@ -1743,6 +1745,33 @@ fi +@@ -1789,6 +1791,33 @@ fi AC_SUBST([LIBDEVMAPPER]) +AC_ARG_ENABLE([rpm-sort], + [AS_HELP_STRING([--enable-rpm-sort], + [enable native rpm sorting of kernels in grub (default=guessed)])]) -+if test x"$enable_rpm_sort" = xno ; then ++if test x"$enable_rpm-sort" = xno ; then + rpm_sort_excuse="explicitly disabled" +fi + @@ -115,33 +115,23 @@ index 9937a82..d5e8d90 100644 if test x$host_kernel = xkfreebsd; then AC_CHECK_LIB([geom], [geom_gettree], [], diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 10fabee..9c410ea 100644 +index 10fabee5e..954844d2d 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -33,6 +33,9 @@ fi - if test "x$grub_mkrelpath" = x; then - grub_mkrelpath="${bindir}/@grub_mkrelpath@" - fi -+if test "x$grub_rpm_sort" = x; then -+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@" -+fi - - if which gettext >/dev/null 2>/dev/null; then - : -@@ -213,6 +216,12 @@ version_sort () +@@ -213,6 +213,12 @@ version_sort () esac } -+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then -+ kernel_sort="$grub_rpm_sort" -+else ++if [ "x$RPMLIB" = x ]; then + kernel_sort=version_sort ++else ++ kernel_sort="${sbindir}/grub-rpm-sort" +fi + version_test_numeric () { version_test_numeric_a="$1" -@@ -229,7 +238,7 @@ version_test_numeric () +@@ -229,7 +235,7 @@ version_test_numeric () version_test_numeric_a="$version_test_numeric_b" version_test_numeric_b="$version_test_numeric_c" fi @@ -152,7 +142,7 @@ index 10fabee..9c410ea 100644 return 1 diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8 new file mode 100644 -index 0000000..8ce2148 +index 000000000..8ce214884 --- /dev/null +++ b/util/grub-rpm-sort.8 @@ -0,0 +1,12 @@ @@ -170,7 +160,7 @@ index 0000000..8ce2148 +.BR "info grub" diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c new file mode 100644 -index 0000000..f33bd1e +index 000000000..f33bd1ed5 --- /dev/null +++ b/util/grub-rpm-sort.c @@ -0,0 +1,281 @@ @@ -456,5 +446,5 @@ index 0000000..f33bd1e + return 0; +} -- -2.9.3 +2.13.0 diff --git a/0079-Handle-rssd-storage-devices.patch b/0112-Handle-rssd-storage-devices.patch similarity index 79% rename from 0079-Handle-rssd-storage-devices.patch rename to 0112-Handle-rssd-storage-devices.patch index c37338cc..12c2ce23 100644 --- a/0079-Handle-rssd-storage-devices.patch +++ b/0112-Handle-rssd-storage-devices.patch @@ -1,7 +1,7 @@ -From 90e2d3fbb161d494cdfc0ad0da740a6a4f651d70 Mon Sep 17 00:00:00 2001 +From cf31c945475c070cec65f04cc6fc0629f115afd2 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 30 Jun 2015 15:50:41 -0400 -Subject: [PATCH 79/90] Handle rssd storage devices. +Subject: [PATCH 112/176] Handle rssd storage devices. Resolves: rhbz#1087962 @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 09e7e6e..ad7b774 100644 +index 90d92d3ad..6d9f4e5fa 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c -@@ -898,6 +898,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, +@@ -921,6 +921,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, return path; } @@ -35,5 +35,5 @@ index 09e7e6e..ad7b774 100644 if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') { -- -2.9.3 +2.13.0 diff --git a/0062-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch b/0113-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch similarity index 90% rename from 0062-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch rename to 0113-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch index 515e1f81..2d33a306 100644 --- a/0062-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch +++ b/0113-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch @@ -1,8 +1,8 @@ -From 8e6fc0ea14aa01817cc9103ffd5e328a78e56857 Mon Sep 17 00:00:00 2001 +From 31a01c3811c176913ae11fd8d27f8ac3d5e32fde Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 27 Oct 2014 09:22:55 -0400 -Subject: [PATCH 62/90] Try to emit linux16/initrd16 and linuxefi/initrdefi in - 30-os_prober. +Subject: [PATCH 113/176] Try to emit linux16/initrd16 and linuxefi/initrdefi + in 30-os_prober. Resolves: rhbz#1108296 @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 9b8f596..dc98eac 100644 +index 9b8f5968e..dc98eace9 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -141,6 +141,28 @@ for OS in ${OSPROBED} ; do @@ -73,5 +73,5 @@ index 9b8f596..dc98eac 100644 fi cat << EOF -- -2.9.3 +2.13.0 diff --git a/0063-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0114-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 90% rename from 0063-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0114-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 15349d85..92c84db9 100644 --- a/0063-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0114-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -1,8 +1,8 @@ -From b6e3ffe7ae7e4222cc15876cb72c691112f3c4b0 Mon Sep 17 00:00:00 2001 +From 2071b0575dd4a9b18244b7b5175a41ce39c3f8b9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 28 Apr 2015 11:15:03 -0400 -Subject: [PATCH 63/90] Make grub2-mkconfig construct titles that look like the - ones we want elsewhere. +Subject: [PATCH 114/176] Make grub2-mkconfig construct titles that look like + the ones we want elsewhere. Resolves: rhbz#1215839 @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index c662726..1215241 100644 +index c6627268c..121524185 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -68,6 +68,15 @@ case x"$GRUB_FS" in @@ -50,5 +50,5 @@ index c662726..1215241 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else -- -2.9.3 +2.13.0 diff --git a/0066-Add-friendly-grub2-password-config-tool-985962.patch b/0115-Add-friendly-grub2-password-config-tool-985962.patch similarity index 94% rename from 0066-Add-friendly-grub2-password-config-tool-985962.patch rename to 0115-Add-friendly-grub2-password-config-tool-985962.patch index 156666cc..f3dbeda7 100644 --- a/0066-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0115-Add-friendly-grub2-password-config-tool-985962.patch @@ -1,7 +1,7 @@ -From f7574b40f89ded29d82e5cfdb7494f8884bc1cdb Mon Sep 17 00:00:00 2001 +From 1a93a7ffc010e413c8b43b6554e308c45fda203f Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Thu, 25 Jun 2015 11:13:11 -0400 -Subject: [PATCH 66/90] Add friendly grub2 password config tool (#985962) +Subject: [PATCH 115/176] Add friendly grub2 password config tool (#985962) Provided a tool for users to reset the grub2 root user password without having to alter the grub.cfg. The hashed password now @@ -22,11 +22,11 @@ Resolves: rhbz#985962 create mode 100644 util/grub.d/01_users.in diff --git a/.gitignore b/.gitignore -index 7697877..53a391e 100644 +index af431b74f..302be1e8f 100644 --- a/.gitignore +++ b/.gitignore -@@ -127,6 +127,7 @@ grub-render-label - grub-rpm-sort +@@ -126,6 +126,7 @@ grub-reboot + grub-render-label grub-script-check grub-set-default +grub-setpassword @@ -34,7 +34,7 @@ index 7697877..53a391e 100644 grub-shell-tester grub-sparc64-setup diff --git a/Makefile.util.def b/Makefile.util.def -index d846b81..226c46b 100644 +index d846b81b5..226c46b2d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -440,6 +440,12 @@ script = { @@ -65,7 +65,7 @@ index d846b81..226c46b 100644 common = util/grub-mkconfig_lib.in; installdir = noinst; diff --git a/configure.ac b/configure.ac -index d5e8d90..67ff20c 100644 +index 49427cbf9..196084004 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -77,7 +77,7 @@ index d5e8d90..67ff20c 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 9d595ac..fb87247 100644 +index 9d595ac05..fb8724708 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -263,6 +263,8 @@ for i in "${grub_mkconfig_dir}"/* ; do @@ -91,7 +91,7 @@ index 9d595ac..fb87247 100644 echo diff --git a/util/grub-setpassword.8 b/util/grub-setpassword.8 new file mode 100644 -index 0000000..49200a8 +index 000000000..49200a848 --- /dev/null +++ b/util/grub-setpassword.8 @@ -0,0 +1,28 @@ @@ -125,7 +125,7 @@ index 0000000..49200a8 +.BR "info grub2-mkpasswd-pbkdf2" diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in new file mode 100644 -index 0000000..dd76f00 +index 000000000..dd76f00fc --- /dev/null +++ b/util/grub-setpassword.in @@ -0,0 +1,123 @@ @@ -254,7 +254,7 @@ index 0000000..dd76f00 +echo "GRUB2_PASSWORD=${MYPASS}" > "${grubdir}/user.cfg" diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in new file mode 100644 -index 0000000..db2f44b +index 000000000..db2f44bfb --- /dev/null +++ b/util/grub.d/01_users.in @@ -0,0 +1,11 @@ @@ -270,5 +270,5 @@ index 0000000..db2f44b +fi +EOF -- -2.9.3 +2.13.0 diff --git a/0116-calibrate_tsc-use-the-Stall-EFI-boot-service-on-GRUB.patch b/0116-calibrate_tsc-use-the-Stall-EFI-boot-service-on-GRUB.patch new file mode 100644 index 00000000..31a5ba10 --- /dev/null +++ b/0116-calibrate_tsc-use-the-Stall-EFI-boot-service-on-GRUB.patch @@ -0,0 +1,103 @@ +From 703ac12cc7b710cf5fd8ed08fdaaa760ffdff501 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 10 Oct 2014 11:11:09 +0200 +Subject: [PATCH 116/176] calibrate_tsc(): use the Stall() EFI boot service on + GRUB_MACHINE_EFI + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1150698 + +HyperV Gen2 virtual machines have no PIT; guest code should rely on UEFI +services instead. + +Signed-off-by: RHEL Ninjas +--- + grub-core/kern/i386/tsc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 57 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c +index 2e85289d8..0787b6f3e 100644 +--- a/grub-core/kern/i386/tsc.c ++++ b/grub-core/kern/i386/tsc.c +@@ -24,6 +24,17 @@ + #include + #include + #include ++#ifdef GRUB_MACHINE_XEN ++# include ++#else ++# ifdef GRUB_MACHINE_EFI ++# include ++# include ++# else ++# include ++# endif ++#endif ++#include + + /* This defines the value TSC had at the epoch (that is, when we calibrated it). */ + static grub_uint64_t tsc_boot_time; +@@ -33,6 +44,44 @@ static grub_uint64_t tsc_boot_time; + in 32-bit. */ + grub_uint32_t grub_tsc_rate; + ++#ifndef GRUB_MACHINE_XEN ++ ++static void ++grub_stall (grub_uint16_t tics) ++{ ++# ifdef GRUB_MACHINE_EFI ++ grub_uint64_t microseconds; ++ ++ microseconds = (grub_uint64_t)tics * 1000 * 1000 * 3 / 3579545; ++ efi_call_1 (grub_efi_system_table->boot_services->stall, microseconds); ++# else ++ /* Disable timer2 gate and speaker. */ ++ grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) ++ & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), ++ GRUB_PIT_SPEAKER_PORT); ++ ++ /* Set tics. */ ++ grub_outb (GRUB_PIT_CTRL_SELECT_2 | GRUB_PIT_CTRL_READLOAD_WORD, ++ GRUB_PIT_CTRL); ++ grub_outb (tics & 0xff, GRUB_PIT_COUNTER_2); ++ grub_outb (tics >> 8, GRUB_PIT_COUNTER_2); ++ ++ /* Enable timer2 gate, keep speaker disabled. */ ++ grub_outb ((grub_inb (GRUB_PIT_SPEAKER_PORT) & ~ GRUB_PIT_SPK_DATA) ++ | GRUB_PIT_SPK_TMR2, ++ GRUB_PIT_SPEAKER_PORT); ++ ++ /* Wait. */ ++ while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00); ++ ++ /* Disable timer2 gate and speaker. */ ++ grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) ++ & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), ++ GRUB_PIT_SPEAKER_PORT); ++# endif ++} ++#endif ++ + static grub_uint64_t + grub_tsc_get_time_ms (void) + { +@@ -46,8 +95,14 @@ grub_tsc_get_time_ms (void) + static int + calibrate_tsc_hardcode (void) + { +- grub_tsc_rate = 5368;/* 800 MHz */ +- return 1; ++ /* First calibrate the TSC rate (relative, not absolute time). */ ++ grub_uint64_t end_tsc; ++ ++ tsc_boot_time = grub_get_tsc (); ++ grub_stall (0xffff); ++ end_tsc = grub_get_tsc (); ++ ++ grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0); + } + + void +-- +2.13.0 + diff --git a/0117-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0117-Make-grub2-mkconfig-construct-titles-that-look-like-.patch new file mode 100644 index 00000000..4d00a21b --- /dev/null +++ b/0117-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -0,0 +1,68 @@ +From 85de6a1e7740161c10b000964d098d62cee8e19f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 28 Apr 2015 11:15:03 -0400 +Subject: [PATCH 117/176] Make grub2-mkconfig construct titles that look like + the ones we want elsewhere. + +Resolves: rhbz#1215839 + +Signed-off-by: Peter Jones +--- + util/grub.d/10_linux.in | 34 +++++++++++++++++++++++----------- + 1 file changed, 23 insertions(+), 11 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 121524185..584ad1f46 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -70,11 +70,28 @@ esac + + mktitle () + { +- local OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})" +- local OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" +- +- local titlestr="${OS_NAME} (%s) ${OS_VERS}" +- echo -n ${titlestr} ++ local title_type ++ local version ++ local OS_NAME ++ local OS_VERS ++ ++ title_type=$1 && shift ++ version=$1 && shift ++ ++ OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})" ++ OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" ++ ++ case $title_type in ++ recovery) ++ title=$(printf '%s (%s) %s (recovery mode)' \ ++ "${OS_NAME}" "${version}" "${OS_VERS}") ++ ;; ++ *) ++ title=$(printf '%s (%s) %s' \ ++ "${OS_NAME}" "${version}" "${OS_VERS}") ++ ;; ++ esac ++ echo -n ${title} + } + + title_correction_code= +@@ -105,12 +122,7 @@ linux_entry () + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" + fi + if [ x$type != xsimple ] ; then +- case $type in +- recovery) +- title="$(printf "$(mktitle) (recovery mode)" "${version}")" ;; +- *) +- title="$(printf "$(mktitle)" "${version}")" ;; +- esac ++ title=$(mktitle "$type" "$version") + if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then + replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" + quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" +-- +2.13.0 + diff --git a/0118-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch b/0118-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch new file mode 100644 index 00000000..81306e5b --- /dev/null +++ b/0118-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch @@ -0,0 +1,61 @@ +From d49a8ee11c2bec63bcc63f318609ba003f5687f5 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 3 Aug 2015 11:46:42 -0400 +Subject: [PATCH 118/176] Try to make sure configure.ac and grub-rpm-sort play + nice. + +Apparently the test for whether to use grub-rpm-sort and also the +renaming of it to grub2-rpm-sort on the runtime side weren't right. + +Related: rhbz#1124074 + +Signed-off-by: Peter Jones +--- + configure.ac | 2 +- + util/grub-mkconfig_lib.in | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 196084004..3c4b9a19b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1795,7 +1795,7 @@ AC_SUBST([LIBDEVMAPPER]) + AC_ARG_ENABLE([rpm-sort], + [AS_HELP_STRING([--enable-rpm-sort], + [enable native rpm sorting of kernels in grub (default=guessed)])]) +-if test x"$enable_rpm-sort" = xno ; then ++if test x"$enable_rpm_sort" = xno ; then + rpm_sort_excuse="explicitly disabled" + fi + +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 954844d2d..9c410eae4 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -33,6 +33,9 @@ fi + if test "x$grub_mkrelpath" = x; then + grub_mkrelpath="${bindir}/@grub_mkrelpath@" + fi ++if test "x$grub_rpm_sort" = x; then ++ grub_rpm_sort="${sbindir}/@grub_rpm_sort@" ++fi + + if which gettext >/dev/null 2>/dev/null; then + : +@@ -213,10 +216,10 @@ version_sort () + esac + } + +-if [ "x$RPMLIB" = x ]; then +- kernel_sort=version_sort ++if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then ++ kernel_sort="$grub_rpm_sort" + else +- kernel_sort="${sbindir}/grub-rpm-sort" ++ kernel_sort=version_sort + fi + + version_test_numeric () +-- +2.13.0 + diff --git a/0119-tcp-add-window-scaling-support.patch b/0119-tcp-add-window-scaling-support.patch new file mode 100644 index 00000000..f2ee8672 --- /dev/null +++ b/0119-tcp-add-window-scaling-support.patch @@ -0,0 +1,90 @@ +From 75c2a677f927515e68899022941084be830462ac Mon Sep 17 00:00:00 2001 +From: Josef Bacik +Date: Wed, 12 Aug 2015 08:57:55 -0700 +Subject: [PATCH 119/176] tcp: add window scaling support + +Sometimes we have to provision boxes across regions, such as California to +Sweden. The http server has a 10 minute timeout, so if we can't get our 250mb +image transferred fast enough our provisioning fails, which is not ideal. So +add tcp window scaling on open connections and set the window size to 1mb. With +this change we're able to get higher sustained transfers between regions and can +transfer our image in well below 10 minutes. Without this patch we'd time out +every time halfway through the transfer. Thanks, + +Signed-off-by: Josef Bacik +--- + grub-core/net/tcp.c | 42 +++++++++++++++++++++++++++++------------- + 1 file changed, 29 insertions(+), 13 deletions(-) + +diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c +index e8ad34b84..7d4b82262 100644 +--- a/grub-core/net/tcp.c ++++ b/grub-core/net/tcp.c +@@ -106,6 +106,18 @@ struct tcphdr + grub_uint16_t urgent; + } GRUB_PACKED; + ++struct tcp_scale_opt { ++ grub_uint8_t kind; ++ grub_uint8_t length; ++ grub_uint8_t scale; ++} GRUB_PACKED; ++ ++struct tcp_synhdr { ++ struct tcphdr tcphdr; ++ struct tcp_scale_opt scale_opt; ++ grub_uint8_t padding; ++}; ++ + struct tcp_pseudohdr + { + grub_uint32_t src; +@@ -566,7 +578,7 @@ grub_net_tcp_open (char *server, + grub_net_tcp_socket_t socket; + static grub_uint16_t in_port = 21550; + struct grub_net_buff *nb; +- struct tcphdr *tcph; ++ struct tcp_synhdr *tcph; + int i; + grub_uint8_t *nbd; + grub_net_link_level_address_t ll_target_addr; +@@ -635,20 +647,24 @@ grub_net_tcp_open (char *server, + } + + tcph = (void *) nb->data; ++ grub_memset(tcph, 0, sizeof (*tcph)); + socket->my_start_seq = grub_get_time_ms (); + socket->my_cur_seq = socket->my_start_seq + 1; +- socket->my_window = 8192; +- tcph->seqnr = grub_cpu_to_be32 (socket->my_start_seq); +- tcph->ack = grub_cpu_to_be32_compile_time (0); +- tcph->flags = grub_cpu_to_be16_compile_time ((5 << 12) | TCP_SYN); +- tcph->window = grub_cpu_to_be16 (socket->my_window); +- tcph->urgent = 0; +- tcph->src = grub_cpu_to_be16 (socket->in_port); +- tcph->dst = grub_cpu_to_be16 (socket->out_port); +- tcph->checksum = 0; +- tcph->checksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_TCP, +- &socket->inf->address, +- &socket->out_nla); ++ socket->my_window = 32768; ++ tcph->tcphdr.seqnr = grub_cpu_to_be32 (socket->my_start_seq); ++ tcph->tcphdr.ack = grub_cpu_to_be32_compile_time (0); ++ tcph->tcphdr.flags = grub_cpu_to_be16_compile_time ((6 << 12) | TCP_SYN); ++ tcph->tcphdr.window = grub_cpu_to_be16 (socket->my_window); ++ tcph->tcphdr.urgent = 0; ++ tcph->tcphdr.src = grub_cpu_to_be16 (socket->in_port); ++ tcph->tcphdr.dst = grub_cpu_to_be16 (socket->out_port); ++ tcph->tcphdr.checksum = 0; ++ tcph->scale_opt.kind = 3; ++ tcph->scale_opt.length = 3; ++ tcph->scale_opt.scale = 5; ++ tcph->tcphdr.checksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_TCP, ++ &socket->inf->address, ++ &socket->out_nla); + + tcp_socket_register (socket); + +-- +2.13.0 + diff --git a/0120-efinet-retransmit-if-our-device-is-busy.patch b/0120-efinet-retransmit-if-our-device-is-busy.patch new file mode 100644 index 00000000..39ed7f42 --- /dev/null +++ b/0120-efinet-retransmit-if-our-device-is-busy.patch @@ -0,0 +1,48 @@ +From 1c8d555408d928794b1cf356775ebc0a94c62e6f Mon Sep 17 00:00:00 2001 +From: Josef Bacik +Date: Mon, 31 Aug 2015 13:34:35 -0400 +Subject: [PATCH 120/176] efinet: retransmit if our device is busy + +When I fixed the txbuf handling I ripped out the retransmission code since it +was flooding our network when we had the buggy behavior. Turns out this was too +heavy handed as we can still have transient tx timeouts. So instead make sure +we retry our transmission once per timeout. This way we can deal with transient +transmission problems without flooding the box. This fixes an issue we were +seeing in production. Thanks, + +Signed-off-by: Josef Bacik +--- + grub-core/net/drivers/efi/efinet.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 5388f952b..3f112438a 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -38,6 +38,7 @@ send_card_buffer (struct grub_net_card *dev, + grub_efi_simple_network_t *net = dev->efi_net; + grub_uint64_t limit_time = grub_get_time_ms () + 4000; + void *txbuf; ++ int retry = 0; + + if (dev->txbusy) + while (1) +@@ -60,6 +61,15 @@ send_card_buffer (struct grub_net_card *dev, + dev->txbusy = 0; + break; + } ++ if (!retry) ++ { ++ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size, ++ dev->txbuf, NULL, NULL, NULL); ++ if (st != GRUB_EFI_SUCCESS) ++ return grub_error (GRUB_ERR_IO, ++ N_("couldn't send network packet")); ++ retry = 1; ++ } + if (limit_time < grub_get_time_ms ()) + return grub_error (GRUB_ERR_TIMEOUT, + N_("couldn't send network packet")); +-- +2.13.0 + diff --git a/0121-Be-more-aggro-about-actually-using-the-configured-ne.patch b/0121-Be-more-aggro-about-actually-using-the-configured-ne.patch new file mode 100644 index 00000000..89ac28bf --- /dev/null +++ b/0121-Be-more-aggro-about-actually-using-the-configured-ne.patch @@ -0,0 +1,224 @@ +From 096244a4746dd33e033d7076598d97d9592f1f75 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 11 Sep 2015 17:30:49 -0400 +Subject: [PATCH 121/176] Be more aggro about actually using the *configured* + network device. + +Right now we use any SNP device with the same mac+IP block, but when +it's discovered there will be more than one of them. We need to pick +the same one we were loaded with, so that it'll be configured the same +way as it was before, and won't be re-used by the system firmware later. + +Resolves: rhbz#1257475 + +Signed-off-by: Peter Jones +--- + grub-core/net/drivers/efi/efinet.c | 124 +++++++++++++++++++++++++++++-------- + include/grub/efi/api.h | 4 ++ + 2 files changed, 102 insertions(+), 26 deletions(-) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 3f112438a..a3ce4c67c 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -239,46 +239,85 @@ grub_efinet_get_device_handle (struct grub_net_card *card) + return card->efi_handle; + } + +-static void +-grub_efinet_findcards (void) ++static int ++grub_efinet_find_snp_cards (int preferred_only, grub_efi_handle_t preferred, ++ int *i) + { +- grub_efi_uintn_t num_handles; +- grub_efi_handle_t *handles; ++ grub_efi_uintn_t num_handles = 0; ++ grub_efi_handle_t *handles = NULL; + grub_efi_handle_t *handle; +- int i = 0; ++ grub_efi_device_path_t *pdp = NULL, *pp = NULL, *pc = NULL; ++ int ret = 0; ++ ++ if (preferred) ++ { ++ grub_efi_device_path_t *pdpc; ++ pdpc = pdp = grub_efi_get_device_path (preferred); ++ if (pdp == NULL) ++ { ++ grub_print_error (); ++ return -1; ++ } + +- /* Find handles which support the disk io interface. */ ++ for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (pdpc); ++ pdpc = GRUB_EFI_NEXT_DEVICE_PATH (pdpc)) ++ { ++ pp = pc; ++ pc = pdpc; ++ } ++ } ++ ++ /* Find handles which support the SNP interface. */ + handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &net_io_guid, + 0, &num_handles); +- if (! handles) +- return; +- for (handle = handles; num_handles--; handle++) ++ ++ for (handle = handles; handle && num_handles--; handle++) + { + grub_efi_simple_network_t *net; + struct grub_net_card *card; + grub_efi_device_path_t *dp, *parent = NULL, *child = NULL; + +- /* EDK2 UEFI PXE driver creates IPv4 and IPv6 messaging devices as +- children of main MAC messaging device. We only need one device with +- bound SNP per physical card, otherwise they compete with each other +- when polling for incoming packets. +- */ ++ /* if we're looking for only the preferred handle, skip anything that ++ isn't it. */ ++ if (preferred_only && preferred != NULL && *handle != preferred) ++ continue; ++ ++ /* if we're not looking for the preferred handle, skip it if it's ++ found. */ ++ if (!preferred_only && *handle == preferred) ++ continue; ++ + dp = grub_efi_get_device_path (*handle); + if (!dp) + continue; +- for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp); dp = GRUB_EFI_NEXT_DEVICE_PATH (dp)) ++ ++ for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp); ++ dp = GRUB_EFI_NEXT_DEVICE_PATH (dp)) + { + parent = child; + child = dp; + } +- if (child +- && GRUB_EFI_DEVICE_PATH_TYPE (child) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE +- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE +- || GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) +- && parent +- && GRUB_EFI_DEVICE_PATH_TYPE (parent) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE +- && GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE) +- continue; ++ ++ if (!preferred_only) ++ { ++ if (pp && pc ++ && grub_efi_compare_device_paths (pp, parent) == 0 ++ && grub_efi_compare_device_paths (pc, child) == 0) ++ continue; ++ ++ if (child ++ && (GRUB_EFI_DEVICE_PATH_IS_TYPE(child, ++ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE, ++ GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) || ++ GRUB_EFI_DEVICE_PATH_IS_TYPE(child, ++ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE, ++ GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE)) ++ && parent ++ && (GRUB_EFI_DEVICE_PATH_IS_TYPE(parent, ++ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE, ++ GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE))) ++ continue; ++ } + + net = grub_efi_open_protocol (*handle, &net_io_guid, + GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); +@@ -302,7 +341,7 @@ grub_efinet_findcards (void) + { + grub_print_error (); + grub_free (handles); +- return; ++ return -1; + } + + card->mtu = net->mode->max_packet_size; +@@ -313,13 +352,14 @@ grub_efinet_findcards (void) + grub_print_error (); + grub_free (handles); + grub_free (card); +- return; ++ return -1; + } + card->txbusy = 0; + + card->rcvbufsize = ALIGN_UP (card->mtu, 64) + 256; + +- card->name = grub_xasprintf ("efinet%d", i++); ++ card->name = grub_xasprintf ("efinet%d", *i); ++ *i = (*i)+1; + card->driver = &efidriver; + card->flags = 0; + card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; +@@ -330,8 +370,38 @@ grub_efinet_findcards (void) + card->efi_handle = *handle; + + grub_net_card_register (card); ++ ret++; + } + grub_free (handles); ++ ++ return ret; ++} ++ ++static void ++grub_efinet_findcards (void) ++{ ++ grub_efi_loaded_image_t *image = NULL; ++ int rc; ++ int efinet_number = 0; ++ ++ image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ ++ if (image && image->device_handle) ++ { ++ rc = grub_efinet_find_snp_cards (1, image->device_handle, &efinet_number); ++ if (rc < 0) ++ return; ++ ++ rc = grub_efinet_find_snp_cards (0, image->device_handle, &efinet_number); ++ if (rc < 0) ++ return; ++ } ++ else ++ { ++ rc = grub_efinet_find_snp_cards (0, NULL, &efinet_number); ++ if (rc < 0) ++ return; ++ } + } + + static void +@@ -352,6 +422,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + struct grub_efi_pxe_mode *pxe_mode; + if (card->driver != &efidriver) + continue; ++ if (hnd != card->efi_handle) ++ continue; + cdp = grub_efi_get_device_path (card->efi_handle); + if (! cdp) + continue; +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index c7c9f0e1d..97b9aa7a4 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -622,6 +622,10 @@ typedef struct grub_efi_device_path grub_efi_device_path_t; + It seems to be identical to EFI_DEVICE_PATH. */ + typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; + ++#define GRUB_EFI_DEVICE_PATH_IS_TYPE(dp, type, subtype) \ ++ ((GRUB_EFI_DEVICE_PATH_TYPE(dp) == (type)) && \ ++ (GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) == (subtype))) ++ + #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f) + #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) + #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length) +-- +2.13.0 + diff --git a/0122-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch b/0122-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch new file mode 100644 index 00000000..aef63dac --- /dev/null +++ b/0122-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch @@ -0,0 +1,63 @@ +From e9db498504e103587c3bc908b240b5e7baf68436 Mon Sep 17 00:00:00 2001 +From: RHEL Ninjas +Date: Fri, 25 Sep 2015 16:24:23 +0900 +Subject: [PATCH 122/176] efinet: add filter for the first exclusive reopen of + SNP + +--- + grub-core/net/drivers/efi/efinet.c | 39 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index a3ce4c67c..b870d3f19 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -465,6 +465,45 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + &pxe_mode->dhcp_ack, + sizeof (pxe_mode->dhcp_ack), + 1, device, path); ++ net = grub_efi_open_protocol (card->efi_handle, &net_io_guid, ++ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE); ++ if (net) { ++ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED ++ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS) ++ continue; ++ ++ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED) ++ continue; ++ ++ if (net->mode->state == GRUB_EFI_NETWORK_STARTED ++ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS) ++ continue; ++ ++ /* Enable hardware receive filters if driver declares support for it. ++ We need unicast and broadcast and additionaly all nodes and ++ solicited multicast for IPv6. Solicited multicast is per-IPv6 ++ address and we currently do not have API to do it so simply ++ try to enable receive of all multicast packets or evertyhing in ++ the worst case (i386 PXE driver always enables promiscuous too). ++ ++ This does trust firmware to do what it claims to do. ++ */ ++ if (net->mode->receive_filter_mask) ++ { ++ grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | ++ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST | ++ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; ++ ++ filters &= net->mode->receive_filter_mask; ++ if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST)) ++ filters |= (net->mode->receive_filter_mask & ++ GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS); ++ ++ efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL); ++ } ++ ++ card->efi_net = net; ++ } + return; + } + } +-- +2.13.0 + diff --git a/0072-Fix-security-issue-when-reading-username-and-passwor.patch b/0123-Fix-security-issue-when-reading-username-and-passwor.patch similarity index 82% rename from 0072-Fix-security-issue-when-reading-username-and-passwor.patch rename to 0123-Fix-security-issue-when-reading-username-and-passwor.patch index 7f2b486b..6d58d952 100644 --- a/0072-Fix-security-issue-when-reading-username-and-passwor.patch +++ b/0123-Fix-security-issue-when-reading-username-and-passwor.patch @@ -1,7 +1,7 @@ -From 5a0d703884a73f93a68753c6ed64bdf08797c82a Mon Sep 17 00:00:00 2001 +From 291aab5a07c51ecdfc386cfd7fdabb009375ce0d Mon Sep 17 00:00:00 2001 From: Hector Marco-Gisbert Date: Fri, 13 Nov 2015 16:21:09 +0100 -Subject: [PATCH 72/90] Fix security issue when reading username and password +Subject: [PATCH 123/176] Fix security issue when reading username and password This patch fixes two integer underflows at: * grub-core/lib/crypto.c @@ -17,7 +17,7 @@ Signed-off-by: Ismael Ripoll-Ripoll 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index 683a8aa..c5ab9eb 100644 +index 683a8aaa7..c5ab9eb18 100644 --- a/grub-core/lib/crypto.c +++ b/grub-core/lib/crypto.c @@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size) @@ -30,7 +30,7 @@ index 683a8aa..c5ab9eb 100644 if (cur_len) cur_len--; diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c -index 7338f82..6d6dc7d 100644 +index 7338f8245..6d6dc7ded 100644 --- a/grub-core/normal/auth.c +++ b/grub-core/normal/auth.c @@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size) @@ -43,5 +43,5 @@ index 7338f82..6d6dc7d 100644 if (cur_len) { -- -2.9.3 +2.13.0 diff --git a/0080-Warn-if-grub-password-will-not-be-read-1290803.patch b/0124-Warn-if-grub-password-will-not-be-read-1290803.patch similarity index 85% rename from 0080-Warn-if-grub-password-will-not-be-read-1290803.patch rename to 0124-Warn-if-grub-password-will-not-be-read-1290803.patch index 44c210dd..df8399f4 100644 --- a/0080-Warn-if-grub-password-will-not-be-read-1290803.patch +++ b/0124-Warn-if-grub-password-will-not-be-read-1290803.patch @@ -1,7 +1,7 @@ -From f46e9b0378cfaced22f0de5e8061ddb0c6829ee8 Mon Sep 17 00:00:00 2001 +From 5cee642bc2d950c453cdf97d0bcac566063c6c7b Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 22 Feb 2016 15:30:05 -0500 -Subject: [PATCH 80/90] Warn if grub password will not be read (#1290803) +Subject: [PATCH 124/176] Warn if grub password will not be read (#1290803) It is possible for a system to have never run grub-mkconfig and add the section that reads the user.cfg file which contains a user set GRUB @@ -14,7 +14,7 @@ Resolves: rhbz#1290803 1 file changed, 5 insertions(+) diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in -index 2923f43..dd7b793 100644 +index dd76f00fc..fb9d3a3b6 100644 --- a/util/grub-setpassword.in +++ b/util/grub-setpassword.in @@ -121,3 +121,8 @@ fi @@ -27,5 +27,5 @@ index 2923f43..dd7b793 100644 + echo "Update your configuration with @grub_mkconfig@ to support this feature." +fi -- -2.9.3 +2.13.0 diff --git a/0081-Clean-up-grub-setpassword-documentation-1290799.patch b/0125-Clean-up-grub-setpassword-documentation-1290799.patch similarity index 89% rename from 0081-Clean-up-grub-setpassword-documentation-1290799.patch rename to 0125-Clean-up-grub-setpassword-documentation-1290799.patch index aa217ae6..c8bbff74 100644 --- a/0081-Clean-up-grub-setpassword-documentation-1290799.patch +++ b/0125-Clean-up-grub-setpassword-documentation-1290799.patch @@ -1,7 +1,7 @@ -From f41adcd85164ef8a0d0918f0508f29dcf3c7467d Mon Sep 17 00:00:00 2001 +From d170636244244428bf5a257682be98fc2b46c7d4 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Tue, 26 Jan 2016 10:28:35 -0500 -Subject: [PATCH 81/90] Clean up grub-setpassword documentation (#1290799) +Subject: [PATCH 125/176] Clean up grub-setpassword documentation (#1290799) The output for --help had some errors. Corrected those and polished the text to be a little easier to follow. Carried verbage over to man page @@ -14,7 +14,7 @@ Resolves: rhbz#1290799 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/util/grub-setpassword.8 b/util/grub-setpassword.8 -index 49200a8..dc91dd6 100644 +index 49200a848..dc91dd669 100644 --- a/util/grub-setpassword.8 +++ b/util/grub-setpassword.8 @@ -19,7 +19,7 @@ Display program usage and exit. @@ -27,7 +27,7 @@ index 49200a8..dc91dd6 100644 .SH SEE ALSO diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in -index dd7b793..d7924af 100644 +index fb9d3a3b6..c8c0fa419 100644 --- a/util/grub-setpassword.in +++ b/util/grub-setpassword.in @@ -16,15 +16,14 @@ grub_mkpasswd="${bindir}/@grub_mkpasswd_pbkdf2@" @@ -54,5 +54,5 @@ index dd7b793..d7924af 100644 Report bugs at https://bugzilla.redhat.com. EOF -- -2.9.3 +2.13.0 diff --git a/0077-Fix-locale-issue-in-grub-setpassword-1294243.patch b/0126-Fix-locale-issue-in-grub-setpassword-1294243.patch similarity index 74% rename from 0077-Fix-locale-issue-in-grub-setpassword-1294243.patch rename to 0126-Fix-locale-issue-in-grub-setpassword-1294243.patch index 90703927..808734d1 100644 --- a/0077-Fix-locale-issue-in-grub-setpassword-1294243.patch +++ b/0126-Fix-locale-issue-in-grub-setpassword-1294243.patch @@ -1,7 +1,7 @@ -From d2f552900d87b62ca0dbc740902d561bc32f32be Mon Sep 17 00:00:00 2001 +From 04d7ca10eb39d3c09dd2a8c701ff2764a3c6093d Mon Sep 17 00:00:00 2001 From: Robert Marshall -Date: Fri, 29 Jan 2016 17:34:02 -0500 -Subject: [PATCH 77/90] Fix locale issue in grub-setpassword (#1294243) +Date: Fri, 29 Jan 2016 16:56:11 -0500 +Subject: [PATCH 126/176] Fix locale issue in grub-setpassword (#1294243) A shell substitution was expecting non-translated output to grab the hashed password and put it in the user.cfg file. Modified code to force @@ -13,10 +13,10 @@ Resolves: rhbz#1294243 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in -index dd76f00..2923f43 100644 +index c8c0fa419..d7924af51 100644 --- a/util/grub-setpassword.in +++ b/util/grub-setpassword.in -@@ -105,7 +105,7 @@ getpass() { +@@ -104,7 +104,7 @@ getpass() { P1="$1" && shift ( echo ${P0} ; echo ${P1} ) | \ @@ -26,5 +26,5 @@ index dd76f00..2923f43 100644 sed -e "s/PBKDF2 hash of your password is //" } -- -2.9.3 +2.13.0 diff --git a/0127-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch b/0127-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch new file mode 100644 index 00000000..a039382f --- /dev/null +++ b/0127-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch @@ -0,0 +1,31 @@ +From ce78e6dd0ab8326b48919d98662a7319ce34dd8f Mon Sep 17 00:00:00 2001 +From: Robert Elliott +Date: Fri, 22 Jan 2016 13:32:30 +0100 +Subject: [PATCH 127/176] efiemu: Handle persistent RAM and unknown possible + future additions. + +(cherry picked from commit ae3b83a4d4df75a01198a2fed7542391e7c449e0) + +Resolves: rhbz#1288608 +--- + grub-core/efiemu/mm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c +index 52a032f7b..92e7df7e5 100644 +--- a/grub-core/efiemu/mm.c ++++ b/grub-core/efiemu/mm.c +@@ -410,8 +410,8 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + return grub_efiemu_add_to_mmap (addr, size, + GRUB_EFI_ACPI_MEMORY_NVS); + +- case GRUB_MEMORY_PERSISTENT: +- case GRUB_MEMORY_PERSISTENT_LEGACY: ++ case GRUB_MEMORY_PRAM: ++ case GRUB_MEMORY_PMEM: + return grub_efiemu_add_to_mmap (addr, size, + GRUB_EFI_PERSISTENT_MEMORY); + default: +-- +2.13.0 + diff --git a/0128-efiemu-Fix-compilation-failure.patch b/0128-efiemu-Fix-compilation-failure.patch new file mode 100644 index 00000000..9ce30625 --- /dev/null +++ b/0128-efiemu-Fix-compilation-failure.patch @@ -0,0 +1,30 @@ +From eee547e70fb44915cc4787548753bd68a350f4d9 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Fri, 22 Jan 2016 14:10:30 +0100 +Subject: [PATCH 128/176] efiemu: Fix compilation failure + +(cherry picked from commit b6a03dfd327489d53ee07c6d7d593b99c7b7cb62) + +Resolves: rhbz#1288608 +--- + grub-core/efiemu/mm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c +index 92e7df7e5..52a032f7b 100644 +--- a/grub-core/efiemu/mm.c ++++ b/grub-core/efiemu/mm.c +@@ -410,8 +410,8 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + return grub_efiemu_add_to_mmap (addr, size, + GRUB_EFI_ACPI_MEMORY_NVS); + +- case GRUB_MEMORY_PRAM: +- case GRUB_MEMORY_PMEM: ++ case GRUB_MEMORY_PERSISTENT: ++ case GRUB_MEMORY_PERSISTENT_LEGACY: + return grub_efiemu_add_to_mmap (addr, size, + GRUB_EFI_PERSISTENT_MEMORY); + default: +-- +2.13.0 + diff --git a/0129-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/0129-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch new file mode 100644 index 00000000..79a94465 --- /dev/null +++ b/0129-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch @@ -0,0 +1,69 @@ +From 91a2c66635f7a1b9fb94736e098f76dfc01a9df8 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 7 Apr 2016 10:58:06 -0400 +Subject: [PATCH 129/176] Revert "reopen SNP protocol for exclusive use by + grub" + +I *think* this should have been replaced by upstream's +49426e9fd2e562c73a4f1206f32eff9e424a1a73, so I'm reverting for now. + +May resolve rhbz#1273974. + +This reverts commit 147daeab22db793978f952b6f0d832919a1b0081. +--- + grub-core/net/drivers/efi/efinet.c | 39 -------------------------------------- + 1 file changed, 39 deletions(-) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index b870d3f19..a3ce4c67c 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -465,45 +465,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + &pxe_mode->dhcp_ack, + sizeof (pxe_mode->dhcp_ack), + 1, device, path); +- net = grub_efi_open_protocol (card->efi_handle, &net_io_guid, +- GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE); +- if (net) { +- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED +- && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS) +- continue; +- +- if (net->mode->state == GRUB_EFI_NETWORK_STOPPED) +- continue; +- +- if (net->mode->state == GRUB_EFI_NETWORK_STARTED +- && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS) +- continue; +- +- /* Enable hardware receive filters if driver declares support for it. +- We need unicast and broadcast and additionaly all nodes and +- solicited multicast for IPv6. Solicited multicast is per-IPv6 +- address and we currently do not have API to do it so simply +- try to enable receive of all multicast packets or evertyhing in +- the worst case (i386 PXE driver always enables promiscuous too). +- +- This does trust firmware to do what it claims to do. +- */ +- if (net->mode->receive_filter_mask) +- { +- grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | +- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST | +- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; +- +- filters &= net->mode->receive_filter_mask; +- if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST)) +- filters |= (net->mode->receive_filter_mask & +- GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS); +- +- efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL); +- } +- +- card->efi_net = net; +- } + return; + } + } +-- +2.13.0 + diff --git a/0130-Add-a-url-parser.patch b/0130-Add-a-url-parser.patch new file mode 100644 index 00000000..8c8afc08 --- /dev/null +++ b/0130-Add-a-url-parser.patch @@ -0,0 +1,1024 @@ +From 1e213423df01e2daeddadd9dfa6b68dcf036abbd Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 14 Jun 2016 16:18:44 -0400 +Subject: [PATCH 130/176] Add a url parser. + +This patch adds a url parser that can parse http, https, tftp, and tftps +urls, and is easily extensible to handle more types. + +It's a little ugly in terms of the arguments it takes. + +Signed-off-by: Peter Jones +--- + grub-core/Makefile.core.def | 1 + + grub-core/kern/misc.c | 13 + + grub-core/net/url.c | 861 ++++++++++++++++++++++++++++++++++++++++++++ + include/grub/misc.h | 45 +++ + include/grub/net/url.h | 28 ++ + 5 files changed, 948 insertions(+) + create mode 100644 grub-core/net/url.c + create mode 100644 include/grub/net/url.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index f111f95ef..630db675c 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2199,6 +2199,7 @@ module = { + common = net/ethernet.c; + common = net/arp.c; + common = net/netbuff.c; ++ common = net/url.c; + }; + + module = { +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 8344526be..f1fab7000 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -296,6 +296,19 @@ grub_strrchr (const char *s, int c) + return p; + } + ++char * ++grub_strchrnul (const char *s, int c) ++{ ++ do ++ { ++ if (*s == c) ++ break; ++ } ++ while (*s++); ++ ++ return (char *) s; ++} ++ + int + grub_strword (const char *haystack, const char *needle) + { +diff --git a/grub-core/net/url.c b/grub-core/net/url.c +new file mode 100644 +index 000000000..146858284 +--- /dev/null ++++ b/grub-core/net/url.c +@@ -0,0 +1,861 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#ifdef URL_TEST ++ ++#define _GNU_SOURCE 1 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define N_(x) x ++ ++#define grub_malloc(x) malloc(x) ++#define grub_free(x) ({if (x) free(x);}) ++#define grub_error(a, fmt, args...) printf(fmt "\n", ## args) ++#define grub_dprintf(a, fmt, args...) printf(a ": " fmt, ## args) ++#define grub_strlen(x) strlen(x) ++#define grub_strdup(x) strdup(x) ++#define grub_strstr(x,y) strstr(x,y) ++#define grub_memcpy(x,y,z) memcpy(x,y,z) ++#define grub_strcmp(x,y) strcmp(x,y) ++#define grub_strncmp(x,y,z) strncmp(x,y,z) ++#define grub_strcasecmp(x,y) strcasecmp(x,y) ++#define grub_strchrnul(x,y) strchrnul(x,y) ++#define grub_strchr(x,y) strchr(x,y) ++#define grub_strndup(x,y) strndup(x,y) ++#define grub_strtoul(x,y,z) strtoul(x,y,z) ++#define grub_memmove(x,y,z) memmove(x,y,z) ++#define grub_size_t size_t ++#define grub_errno errno ++ ++#else ++#include ++#include ++#include ++#include ++#endif ++ ++static char * ++translate_slashes(char *str) ++{ ++ int i, j; ++ if (str == NULL) ++ return str; ++ ++ for (i = 0, j = 0; str[i] != '\0'; i++, j++) ++ { ++ if (str[i] == '\\') ++ { ++ str[j] = '/'; ++ if (str[i+1] == '\\') ++ i++; ++ } ++ } ++ ++ return str; ++} ++ ++static inline int ++hex2int (char c) ++{ ++ if (c >= '0' && c <= '9') ++ return c - '0'; ++ c |= 0x20; ++ if (c >= 'a' && c <= 'f') ++ return c - 'a' + 10; ++ return -1; ++} ++ ++static int ++url_unescape (char *buf, grub_size_t len) ++{ ++ int c, rc; ++ unsigned int i; ++ ++ ++ if (len < 3) ++ { ++ for (i = 0; i < len; i++) ++ if (buf[i] == '%') ++ return -1; ++ return 0; ++ } ++ ++ for (i = 0; len > 2 && i < len - 2; i++) ++ { ++ if (buf[i] == '%') ++ { ++ unsigned int j; ++ for (j = i+1; j < i+3; j++) ++ { ++ if (!(buf[j] >= '0' && buf[j] <= '9') && ++ !(buf[j] >= 'a' && buf[j] <= 'f') && ++ !(buf[j] >= 'A' && buf[j] <= 'F')) ++ return -1; ++ } ++ i += 2; ++ } ++ } ++ if (i == len - 2) ++ { ++ if (buf[i+1] == '%' || buf[i+2] == '%') ++ return -1; ++ } ++ for (i = 0; i < len - 2; i++) ++ { ++ if (buf[i] == '%') ++ { ++ rc = hex2int (buf[i+1]); ++ if (rc < 0) ++ return -1; ++ c = (rc & 0xf) << 4; ++ rc = hex2int (buf[i+2]); ++ if (rc < 0) ++ return -1; ++ c |= (rc & 0xf); ++ ++ buf[i] = c; ++ grub_memmove (buf+i+1, buf+i+3, len-(i+2)); ++ len -= 2; ++ } ++ } ++ return 0; ++} ++ ++static int ++extract_http_url_info (char *url, int ssl, ++ char **userinfo, char **host, int *port, ++ char **file) ++{ ++ char *colon, *slash, *query, *at = NULL, *separator, *auth_end; ++ ++ char *userinfo_off = NULL; ++ char *userinfo_end; ++ char *host_off = NULL; ++ char *host_end; ++ char *port_off = NULL; ++ char *port_end; ++ char *file_off = NULL; ++ ++ grub_size_t l; ++ int c; ++ ++ if (!url || !userinfo || !host || !port || !file) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); ++ ++ *userinfo = *host = *file = NULL; ++ *port = -1; ++ ++ userinfo_off = url; ++ ++ slash = grub_strchrnul (userinfo_off, '/'); ++ query = grub_strchrnul (userinfo_off, '?'); ++ auth_end = slash < query ? slash : query; ++ /* auth_end here is one /past/ the last character in the auth section, i.e. ++ * it's the : or / or NUL */ ++ ++ separator = grub_strchrnul (userinfo_off, '@'); ++ if (separator > auth_end) ++ { ++ host_off = userinfo_off; ++ userinfo_off = NULL; ++ userinfo_end = NULL; ++ } ++ else ++ { ++ at = separator; ++ *separator = '\0'; ++ userinfo_end = separator; ++ host_off = separator + 1; ++ } ++ ++ if (*host_off == '[') ++ { ++ separator = grub_strchrnul (host_off, ']'); ++ if (separator >= auth_end) ++ goto fail; ++ ++ separator += 1; ++ host_end = separator; ++ } ++ else ++ { ++ host_end = separator = colon = grub_strchrnul (host_off, ':'); ++ ++ if (colon > auth_end) ++ { ++ separator = NULL; ++ host_end = auth_end; ++ } ++ } ++ ++ if (separator && separator < auth_end) ++ { ++ if (*separator == ':') ++ { ++ port_off = separator + 1; ++ port_end = auth_end; ++ ++ if (auth_end - port_end > 0) ++ goto fail; ++ if (port_end - port_off < 1) ++ goto fail; ++ } ++ else ++ goto fail; ++ } ++ ++ file_off = auth_end; ++ if (port_off) ++ { ++ unsigned long portul; ++ ++ separator = NULL; ++ c = *port_end; ++ *port_end = '\0'; ++ ++ portul = grub_strtoul (port_off, &separator, 10); ++ *port_end = c; ++#ifdef URL_TEST ++ if (portul == ULONG_MAX && errno == ERANGE) ++ goto fail; ++#else ++ if (grub_errno == GRUB_ERR_OUT_OF_RANGE) ++ goto fail; ++#endif ++ if (portul & ~0xfffful) ++ goto fail; ++ if (separator != port_end) ++ goto fail; ++ ++ *port = portul & 0xfffful; ++ } ++ else if (ssl) ++ *port = 443; ++ else ++ *port = 80; ++ ++ if (userinfo_off && *userinfo_off) ++ { ++ l = userinfo_end - userinfo_off + 1; ++ ++ *userinfo = grub_strndup (userinfo_off, l); ++ if (!*userinfo) ++ goto fail; ++ (*userinfo)[l-1]= '\0'; ++ } ++ ++ l = host_end - host_off; ++ ++ if (host_end == NULL) ++ goto fail; ++ else ++ c = *host_end; ++ ++ *host_end = '\0'; ++ *host = grub_strndup (host_off, l); ++ *host_end = c; ++ if (!*host) ++ goto fail; ++ (*host)[l] = '\0'; ++ ++ *file = grub_strdup (file_off); ++ if (!*file) ++ goto fail; ++ ++ if (at) ++ *at = '@'; ++ return 0; ++fail: ++ if (at) ++ *at = '@'; ++ grub_free (*userinfo); ++ grub_free (*host); ++ grub_free (*file); ++ ++ return -1; ++} ++ ++static int ++extract_tftp_url_info (char *url, int ssl, char **host, char **file, int *port) ++{ ++ char *slash, *semi; ++ ++ char *host_off = url; ++ char *host_end; ++ char *file_off; ++ ++ int c; ++ ++ if (!url || !host || !file || !port) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); ++ ++ if (ssl) ++ *port = 3713; ++ else ++ *port = 69; ++ ++ slash = grub_strchr (url, '/'); ++ if (!slash) ++ return -1; ++ ++ host_end = file_off = slash; ++ ++ semi = grub_strchrnul (slash, ';'); ++ if (!grub_strncmp (semi, ";mode=", 6) && grub_strcmp (semi+6, "octet")) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ N_("TFTP mode `%s' is not implemented."), semi+6); ++ return -1; ++ } ++ ++ /* ++ * Maybe somebody added a new method, I dunno. Anyway, semi is a reserved ++ * character, so if it's there, it's the start of the mode block or it's ++ * invalid. So set it to \0 unconditionally, not just for ;mode=octet ++ */ ++ *semi = '\0'; ++ ++ c = *host_end; ++ *host_end = '\0'; ++ *host = grub_strdup (host_off); ++ *host_end = c; ++ ++ *file = grub_strdup (file_off); ++ ++ if (!*file || !*host) ++ { ++ grub_free (*file); ++ grub_free (*host); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++int ++extract_url_info (const char *urlbuf, grub_size_t buflen, ++ char **scheme, char **userinfo, ++ char **host, int *port, char **file) ++{ ++ char *url; ++ char *colon; ++ ++ char *scheme_off; ++ char *specific_off; ++ ++ int rc; ++ int c; ++ ++ int https; ++ ++ if (!urlbuf || !buflen || !scheme || !userinfo || !host || !port || !file) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); ++ ++ *scheme = *userinfo = *host = *file = NULL; ++ *port = -1; ++ ++ /* make sure we have our own coherent grub_string. */ ++ url = grub_malloc (buflen + 1); ++ if (!url) ++ return -1; ++ ++ grub_memcpy (url, urlbuf, buflen); ++ url[buflen] = '\0'; ++ ++ grub_dprintf ("net", "dhcpv6 boot-file-url: `%s'\n", url); ++ ++ /* get rid of any backslashes */ ++ url = translate_slashes (url); ++ ++ /* find the constituent parts */ ++ colon = grub_strstr (url, "://"); ++ if (!colon) ++ goto fail; ++ ++ scheme_off = url; ++ c = *colon; ++ *colon = '\0'; ++ specific_off = colon + 3; ++ ++ https = !grub_strcasecmp (scheme_off, "https"); ++ ++ rc = 0; ++ if (!grub_strcasecmp (scheme_off, "tftp")) ++ { ++ rc = extract_tftp_url_info (specific_off, 0, host, file, port); ++ } ++#ifdef URL_TEST ++ else if (!grub_strcasecmp (scheme_off, "http") || https) ++#else ++ else if (!grub_strcasecmp (scheme_off, "http")) ++#endif ++ { ++ rc = extract_http_url_info (specific_off, ++ https, userinfo, host, port, file); ++ } ++#ifdef URL_TEST ++ else if (!grub_strcasecmp (scheme_off, "iscsi")) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ N_("Unimplemented URL scheme `%s'"), scheme_off); ++ *colon = c; ++ goto fail; ++ } ++ else if (!grub_strcasecmp (scheme_off, "tftps")) ++ { ++ rc = extract_tftp_url_info (specific_off, 1, host, file, port); ++ } ++#endif ++ else ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ N_("Unimplemented URL scheme `%s'"), scheme_off); ++ *colon = c; ++ goto fail; ++ } ++ ++ if (rc < 0) ++ { ++ *colon = c; ++ goto fail; ++ } ++ ++ *scheme = grub_strdup (scheme_off); ++ *colon = c; ++ if (!*scheme) ++ goto fail; ++ ++ if (*userinfo) ++ { ++ rc = url_unescape (*userinfo, grub_strlen (*userinfo)); ++ if (rc < 0) ++ goto fail; ++ } ++ ++ if (*host) ++ { ++ rc = url_unescape (*host, grub_strlen (*host)); ++ if (rc < 0) ++ goto fail; ++ } ++ ++ if (*file) ++ { ++ rc = url_unescape (*file, grub_strlen (*file)); ++ if (rc < 0) ++ goto fail; ++ } ++ ++ grub_free (url); ++ return 0; ++fail: ++ grub_free (*scheme); ++ grub_free (*userinfo); ++ grub_free (*host); ++ grub_free (*file); ++ ++ if (!grub_errno) ++ grub_error (GRUB_ERR_NET_BAD_ADDRESS, N_("Invalid boot-file-url `%s'"), ++ url); ++ grub_free (url); ++ return -1; ++} ++ ++#ifdef URL_TEST ++ ++struct test { ++ char *url; ++ int rc; ++ char *scheme; ++ char *userinfo; ++ char *host; ++ int port; ++ char *file; ++} tests[] = { ++ {.url = "http://foo.example.com/", ++ .rc = 0, ++ .scheme = "http", ++ .host = "foo.example.com", ++ .port = 80, ++ .file = "/", ++ }, ++ {.url = "http://foo.example.com/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .host = "foo.example.com", ++ .port = 80, ++ .file = "/?foobar", ++ }, ++ {.url = "http://[foo.example.com/", ++ .rc = -1, ++ }, ++ {.url = "http://[foo.example.com/?foobar", ++ .rc = -1, ++ }, ++ {.url = "http://foo.example.com:/", ++ .rc = -1, ++ }, ++ {.url = "http://foo.example.com:81/", ++ .rc = 0, ++ .scheme = "http", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "http://foo.example.com:81/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "http://[1234::1]/", ++ .rc = 0, ++ .scheme = "http", ++ .host = "[1234::1]", ++ .port = 80, ++ .file = "/", ++ }, ++ {.url = "http://[1234::1]/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .host = "[1234::1]", ++ .port = 80, ++ .file = "/?foobar", ++ }, ++ {.url = "http://[1234::1]:81/", ++ .rc = 0, ++ .scheme = "http", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "http://[1234::1]:81/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "http://foo@foo.example.com/", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 80, ++ .file = "/", ++ }, ++ {.url = "http://foo@foo.example.com/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 80, ++ .file = "/?foobar", ++ }, ++ {.url = "http://foo@[foo.example.com/", ++ .rc = -1, ++ }, ++ {.url = "http://foo@[foo.example.com/?foobar", ++ .rc = -1, ++ }, ++ {.url = "http://foo@foo.example.com:81/", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "http://foo@foo.example.com:81/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "http://foo@[1234::1]/", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 80, ++ .file = "/", ++ }, ++ {.url = "http://foo@[1234::1]/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 80, ++ .file = "/?foobar", ++ }, ++ {.url = "http://foo@[1234::1]:81/", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "http://foo@[1234::1]:81/?foobar", ++ .rc = 0, ++ .scheme = "http", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "https://foo.example.com/", ++ .rc = 0, ++ .scheme = "https", ++ .host = "foo.example.com", ++ .port = 443, ++ .file = "/", ++ }, ++ {.url = "https://foo.example.com/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .host = "foo.example.com", ++ .port = 443, ++ .file = "/?foobar", ++ }, ++ {.url = "https://[foo.example.com/", ++ .rc = -1, ++ }, ++ {.url = "https://[foo.example.com/?foobar", ++ .rc = -1, ++ }, ++ {.url = "https://foo.example.com:81/", ++ .rc = 0, ++ .scheme = "https", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "https://foo.example.com:81/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "https://[1234::1]/", ++ .rc = 0, ++ .scheme = "https", ++ .host = "[1234::1]", ++ .port = 443, ++ .file = "/", ++ }, ++ {.url = "https://[1234::1]/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .host = "[1234::1]", ++ .port = 443, ++ .file = "/?foobar", ++ }, ++ {.url = "https://[1234::1]:81/", ++ .rc = 0, ++ .scheme = "https", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "https://[1234::1]:81/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "https://foo@foo.example.com/", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 443, ++ .file = "/", ++ }, ++ {.url = "https://foo@foo.example.com/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 443, ++ .file = "/?foobar", ++ }, ++ {.url = "https://foo@[foo.example.com/", ++ .rc = -1, ++ }, ++ {.url = "https://f%6fo@[foo.example.com/?fooba%72", ++ .rc = -1, ++ }, ++ {.url = "https://foo@foo.example.com:81/", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "https://foo@foo.example.com:81/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "foo.example.com", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "https://foo@[1234::1]/", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 443, ++ .file = "/", ++ }, ++ {.url = "https://foo@[1234::1]/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 443, ++ .file = "/?foobar", ++ }, ++ {.url = "https://f%6fo@[12%334::1]:81/", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/", ++ }, ++ {.url = "https://foo@[1234::1]:81/?foobar", ++ .rc = 0, ++ .scheme = "https", ++ .userinfo = "foo", ++ .host = "[1234::1]", ++ .port = 81, ++ .file = "/?foobar", ++ }, ++ {.url = "tftp://foo.e%78ample.com/foo/bar/b%61%7a", ++ .rc = 0, ++ .scheme = "tftp", ++ .host = "foo.example.com", ++ .port = 69, ++ .file = "/foo/bar/baz", ++ }, ++ {.url = "tftp://foo.example.com/foo/bar/baz", ++ .rc = 0, ++ .scheme = "tftp", ++ .host = "foo.example.com", ++ .port = 69, ++ .file = "/foo/bar/baz", ++ }, ++ {.url = "tftps://foo.example.com/foo/bar/baz", ++ .rc = 0, ++ .scheme = "tftps", ++ .host = "foo.example.com", ++ .port = 3713, ++ .file = "/foo/bar/baz", ++ }, ++ {.url = "tftps://foo.example.com/foo/bar/baz;mode=netascii", ++ .rc = -1, ++ }, ++ {.url = "tftps://foo.example.com/foo/bar/baz;mode=octet", ++ .rc = 0, ++ .scheme = "tftps", ++ .host = "foo.example.com", ++ .port = 3713, ++ .file = "/foo/bar/baz", ++ }, ++ {.url = "tftps://foo.example.com/foo/bar/baz;mode=invalid", ++ .rc = -1, ++ }, ++ {.url = "", ++ }, ++}; ++ ++static int ++string_test (char *name, char *a, char *b) ++{ ++ if ((a && !b) || (!a && b)) ++ { ++ printf("expected %s \"%s\", got \"%s\"\n", name, a, b); ++ return -1; ++ } ++ if (a && b && strcmp(a, b)) ++ { ++ printf("expected %s \"%s\", got \"%s\"\n", name, a, b); ++ return -1; ++ } ++ return 0; ++} ++ ++int ++main(void) ++{ ++ unsigned int i; ++ int rc; ++ ++ for (i = 0; tests[i].url[0] != '\0'; i++) ++ { ++ char *scheme, *userinfo, *host, *file; ++ int port; ++ ++ printf("======= url: \"%s\"\n", tests[i].url); ++ rc = extract_url_info(tests[i].url, strlen(tests[i].url) + 1, ++ &scheme, &userinfo, &host, &port, &file); ++ if (tests[i].rc != rc) ++ { ++ printf(" extract_url_info(...) = %d\n", rc); ++ exit(1); ++ } ++ else if (rc >= 0) ++ { ++ if (string_test("scheme", tests[i].scheme, scheme) < 0) ++ exit(1); ++ if (string_test("userinfo", tests[i].userinfo, userinfo) < 0) ++ exit(1); ++ if (string_test("host", tests[i].host, host) < 0) ++ exit(1); ++ if (port != tests[i].port) ++ { ++ printf(" bad port \"%d\" should have been \"%d\"\n", ++ port, tests[i].port); ++ exit(1); ++ } ++ if (string_test("file", tests[i].file, file) < 0) ++ exit(1); ++ } ++ free(scheme); ++ free(userinfo); ++ free(host); ++ free(file); ++ } ++ printf("everything worked?!?\n"); ++} ++#endif +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 062081437..4737da1ea 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -85,6 +85,7 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); + + char *EXPORT_FUNC(grub_strchr) (const char *s, int c); + char *EXPORT_FUNC(grub_strrchr) (const char *s, int c); ++char *EXPORT_FUNC(grub_strchrnul) (const char *s, int c); + int EXPORT_FUNC(grub_strword) (const char *s, const char *w); + + /* Copied from gnulib. +@@ -207,6 +208,50 @@ grub_toupper (int c) + return c; + } + ++static inline char * ++grub_strcasestr (const char *haystack, const char *needle) ++{ ++ /* Be careful not to look at the entire extent of haystack or needle ++ until needed. This is useful because of these two cases: ++ - haystack may be very long, and a match of needle found early, ++ - needle may be very long, and not even a short initial segment of ++ needle may be found in haystack. */ ++ if (*needle != '\0') ++ { ++ /* Speed up the following searches of needle by caching its first ++ character. */ ++ char b = *needle++; ++ ++ for (;; haystack++) ++ { ++ if (*haystack == '\0') ++ /* No match. */ ++ return 0; ++ if (grub_tolower(*haystack) == grub_tolower(b)) ++ /* The first character matches. */ ++ { ++ const char *rhaystack = haystack + 1; ++ const char *rneedle = needle; ++ ++ for (;; rhaystack++, rneedle++) ++ { ++ if (*rneedle == '\0') ++ /* Found a match. */ ++ return (char *) haystack; ++ if (*rhaystack == '\0') ++ /* No match. */ ++ return 0; ++ if (grub_tolower(*rhaystack) != grub_tolower(*rneedle)) ++ /* Nothing in this round. */ ++ break; ++ } ++ } ++ } ++ } ++ else ++ return (char *) haystack; ++} ++ + static inline int + grub_strcasecmp (const char *s1, const char *s2) + { +diff --git a/include/grub/net/url.h b/include/grub/net/url.h +new file mode 100644 +index 000000000..a215fa27d +--- /dev/null ++++ b/include/grub/net/url.h +@@ -0,0 +1,28 @@ ++/* url.h - prototypes for url parsing functions */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2016 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 . ++ */ ++ ++#ifndef GRUB_URL_HEADER ++#define GRUB_URL_HEADER 1 ++ ++int ++EXPORT_FUNC(extract_url_info) (const char *urlbuf, grub_size_t buflen, ++ char **scheme, char **userinfo, ++ char **host, int *port, char **file); ++ ++#endif /* GRUB_URL_HEADER */ +-- +2.13.0 + diff --git a/0131-efinet-and-bootp-add-support-for-dhcpv6.patch b/0131-efinet-and-bootp-add-support-for-dhcpv6.patch new file mode 100644 index 00000000..91063789 --- /dev/null +++ b/0131-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -0,0 +1,667 @@ +From 42223d1e900e73d8ec48f3188f26f3429e421f59 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 8 Jun 2016 21:03:37 -0400 +Subject: [PATCH 131/176] efinet and bootp: add support for dhcpv6 + +Signed-off-by: Peter Jones +--- + grub-core/net/bootp.c | 174 +++++++++++++++++++++++++++++++++++++ + grub-core/net/drivers/efi/efinet.c | 55 ++++++++++-- + grub-core/net/net.c | 72 +++++++++++++++ + grub-core/net/tftp.c | 4 + + include/grub/efi/api.h | 129 +++++++++++++++++++++++++-- + include/grub/net.h | 60 +++++++++++++ + 6 files changed, 480 insertions(+), 14 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index f03eeab2f..da3e45446 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + + static char * +@@ -349,6 +350,179 @@ grub_net_configure_by_dhcp_ack (const char *name, + return inter; + } + ++struct grub_net_network_level_interface * ++grub_net_configure_by_dhcpv6_ack (const char *name, ++ struct grub_net_card *card, ++ grub_net_interface_flags_t flags ++ __attribute__((__unused__)), ++ const grub_net_link_level_address_t *hwaddr, ++ const struct grub_net_dhcpv6_packet *packet, ++ int is_def, char **device, char **path) ++{ ++ struct grub_net_network_level_interface *inter = NULL; ++ struct grub_net_network_level_address addr; ++ int mask = -1; ++ ++ if (!device || !path) ++ return NULL; ++ ++ *device = 0; ++ *path = 0; ++ ++ grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n", ++ hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2], ++ hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]); ++ ++ if (is_def) ++ grub_net_default_server = 0; ++ ++ if (is_def && !grub_net_default_server && packet) ++ { ++ const grub_uint8_t *options = packet->dhcp_options; ++ unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet); ++ unsigned int i; ++ ++ for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); ) ++ { ++ grub_uint16_t num, len; ++ grub_net_dhcpv6_option_t *opt = ++ (grub_net_dhcpv6_option_t *)(options + i); ++ ++ num = grub_be_to_cpu16(opt->option_num); ++ len = grub_be_to_cpu16(opt->option_len); ++ ++ grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len); ++ ++ if (len == 0) ++ break; ++ ++ if (len + i > 1024) ++ break; ++ ++ if (num == GRUB_NET_DHCP6_BOOTFILE_URL) ++ { ++ char *scheme, *userinfo, *host, *file; ++ char *tmp; ++ int hostlen; ++ int port; ++ int rc = extract_url_info ((const char *)opt->option_data, ++ (grub_size_t)len, ++ &scheme, &userinfo, &host, &port, ++ &file); ++ if (rc < 0) ++ continue; ++ ++ /* right now this only handles tftp. */ ++ if (grub_strcmp("tftp", scheme)) ++ { ++ grub_free (scheme); ++ grub_free (userinfo); ++ grub_free (host); ++ grub_free (file); ++ continue; ++ } ++ grub_free (userinfo); ++ ++ hostlen = grub_strlen (host); ++ if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']') ++ { ++ tmp = host+1; ++ host[hostlen-1] = '\0'; ++ } ++ else ++ tmp = host; ++ ++ *device = grub_xasprintf ("%s,%s", scheme, tmp); ++ grub_free (scheme); ++ grub_free (host); ++ ++ if (file && *file) ++ { ++ tmp = grub_strrchr (file, '/'); ++ if (tmp) ++ *(tmp+1) = '\0'; ++ else ++ file[0] = '\0'; ++ } ++ else if (!file) ++ file = grub_strdup (""); ++ ++ if (file[0] == '/') ++ { ++ *path = grub_strdup (file+1); ++ grub_free (file); ++ } ++ else ++ *path = file; ++ } ++ else if (num == GRUB_NET_DHCP6_IA_NA) ++ { ++ const grub_net_dhcpv6_option_t *ia_na_opt; ++ const grub_net_dhcpv6_opt_ia_na_t *ia_na = ++ (const grub_net_dhcpv6_opt_ia_na_t *)opt; ++ unsigned int left = len - OFFSET_OF (options, ia_na); ++ unsigned int j; ++ ++ if ((grub_uint8_t *)ia_na + left > ++ (grub_uint8_t *)options + option_max) ++ left -= ((grub_uint8_t *)ia_na + left) ++ - ((grub_uint8_t *)options + option_max); ++ ++ if (len < OFFSET_OF (option_data, opt) ++ + sizeof (grub_net_dhcpv6_option_t)) ++ { ++ grub_dprintf ("net", ++ "found dhcpv6 ia_na option with no address\n"); ++ continue; ++ } ++ ++ for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); ) ++ { ++ ia_na_opt = (const grub_net_dhcpv6_option_t *) ++ (ia_na->options + j); ++ grub_uint16_t ia_na_opt_num, ia_na_opt_len; ++ ++ ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num); ++ ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len); ++ if (ia_na_opt_len == 0) ++ break; ++ if (j + ia_na_opt_len > left) ++ break; ++ if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS) ++ { ++ const grub_net_dhcpv6_opt_ia_address_t *ia_addr; ++ ++ ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *) ++ ia_na_opt; ++ addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ grub_memcpy(addr.ipv6, ia_addr->ipv6_address, ++ sizeof (ia_addr->ipv6_address)); ++ inter = grub_net_add_addr (name, card, &addr, hwaddr, 0); ++ } ++ ++ j += ia_na_opt_len; ++ left -= ia_na_opt_len; ++ } ++ } ++ ++ i += len + 4; ++ } ++ ++ grub_print_error (); ++ } ++ ++ if (is_def) ++ { ++ grub_env_set ("net_default_interface", name); ++ grub_env_export ("net_default_interface"); ++ } ++ ++ if (inter) ++ grub_net_add_ipv6_local (inter, mask); ++ return inter; ++} ++ ++ + void + grub_net_process_dhcp (struct grub_net_buff *nb, + struct grub_net_card *card) +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index a3ce4c67c..329024b6f 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -18,11 +18,15 @@ + + #include + #include ++#include + #include ++#include + #include + #include + #include + #include ++#include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -409,7 +413,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + char **path) + { + struct grub_net_card *card; +- grub_efi_device_path_t *dp; ++ grub_efi_device_path_t *dp, *ldp = NULL; + + dp = grub_efi_get_device_path (hnd); + if (! dp) +@@ -420,16 +424,22 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + grub_efi_device_path_t *cdp; + struct grub_efi_pxe *pxe; + struct grub_efi_pxe_mode *pxe_mode; ++ + if (card->driver != &efidriver) + continue; ++ + if (hnd != card->efi_handle) + continue; ++ + cdp = grub_efi_get_device_path (card->efi_handle); + if (! cdp) + continue; ++ ++ ldp = grub_efi_find_last_device_path (dp); ++ + if (grub_efi_compare_device_paths (dp, cdp) != 0) + { +- grub_efi_device_path_t *ldp, *dup_dp, *dup_ldp; ++ grub_efi_device_path_t *dup_dp, *dup_ldp; + int match; + + /* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6 +@@ -438,7 +448,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + devices. We skip them when enumerating cards, so here we need to + find matching MAC device. + */ +- ldp = grub_efi_find_last_device_path (dp); + if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) +@@ -455,16 +464,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + if (!match) + continue; + } ++ + pxe = grub_efi_open_protocol (hnd, &pxe_io_guid, + GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (! pxe) + continue; ++ + pxe_mode = pxe->mode; +- grub_net_configure_by_dhcp_ack (card->name, card, 0, +- (struct grub_net_bootp_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), +- 1, device, path); ++ if (pxe_mode->using_ipv6) ++ { ++ grub_net_link_level_address_t hwaddr; ++ struct grub_net_network_level_interface *intf; ++ ++ grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); ++ grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", ++ pxe_mode->dhcp_ack_received ? "yes" : "no", ++ pxe_mode->dhcp_ack_received ? "" : " cannot continue"); ++ if (!pxe_mode->dhcp_ack_received) ++ continue; ++ ++ hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; ++ grub_memcpy (hwaddr.mac, ++ card->efi_net->mode->current_address, ++ sizeof (hwaddr.mac)); ++ ++ intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, ++ (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6, ++ 1, device, path); ++ if (intf && device && path) ++ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); ++ } ++ else ++ { ++ grub_dprintf ("efinet", "using ipv4 and dhcp\n"); ++ grub_net_configure_by_dhcp_ack (card->name, card, 0, ++ (struct grub_net_bootp_packet *) ++ &pxe_mode->dhcp_ack, ++ sizeof (pxe_mode->dhcp_ack), ++ 1, device, path); ++ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); ++ } + return; + } + } +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 16d2ce06d..4be228d95 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -955,6 +955,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa + grub_net_network_level_interfaces = inter; + } + ++int ++grub_ipv6_get_masksize (grub_uint16_t be_mask[8]) ++{ ++ grub_uint8_t *mask; ++ grub_uint16_t mask16[8]; ++ int x, y; ++ int ret = 128; ++ ++ grub_memcpy (mask16, be_mask, sizeof (mask16)); ++ for (x = 0; x < 8; x++) ++ mask16[x] = grub_be_to_cpu16 (mask16[x]); ++ ++ mask = (grub_uint8_t *)mask16; ++ ++ for (x = 15; x >= 0; x--) ++ { ++ grub_uint8_t octet = mask[x]; ++ if (!octet) ++ { ++ ret -= 8; ++ continue; ++ } ++ for (y = 0; y < 8; y++) ++ { ++ if (octet & (1 << y)) ++ break; ++ else ++ ret--; ++ } ++ break; ++ } ++ ++ return ret; ++} ++ ++grub_err_t ++grub_net_add_ipv6_local (struct grub_net_network_level_interface *inter, ++ int mask) ++{ ++ struct grub_net_route *route; ++ ++ if (inter->address.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6) ++ return 0; ++ ++ if (mask == -1) ++ mask = grub_ipv6_get_masksize ((grub_uint16_t *)inter->address.ipv6); ++ ++ if (mask == -1) ++ return 0; ++ ++ route = grub_zalloc (sizeof (*route)); ++ if (!route) ++ return grub_errno; ++ ++ route->name = grub_xasprintf ("%s:local", inter->name); ++ if (!route->name) ++ { ++ grub_free (route); ++ return grub_errno; ++ } ++ ++ route->target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ grub_memcpy (route->target.ipv6.base, inter->address.ipv6, ++ sizeof (inter->address.ipv6)); ++ route->target.ipv6.masksize = mask; ++ route->is_gateway = 0; ++ route->interface = inter; ++ ++ grub_net_route_register (route); ++ ++ return 0; ++} + + grub_err_t + grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 7d90bf66e..1157524fc 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -379,19 +379,23 @@ tftp_open (struct grub_file *file, const char *filename) + return grub_errno; + } + ++ grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server); + err = grub_net_resolve_address (file->device->net->server, &addr); + if (err) + { ++ grub_dprintf("tftp", "Address resolution failed: %d\n", err); + destroy_pq (data); + grub_free (data); + return err; + } + ++ grub_dprintf("tftp", "opening connection\n"); + data->sock = grub_net_udp_open (addr, + TFTP_SERVER_PORT, tftp_receive, + file); + if (!data->sock) + { ++ grub_dprintf("tftp", "connection failed\n"); + destroy_pq (data); + grub_free (data); + return grub_errno; +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 97b9aa7a4..02488ec35 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -572,10 +572,16 @@ typedef void *grub_efi_handle_t; + typedef void *grub_efi_event_t; + typedef grub_efi_uint64_t grub_efi_lba_t; + typedef grub_efi_uintn_t grub_efi_tpl_t; +-typedef grub_uint8_t grub_efi_mac_address_t[32]; +-typedef grub_uint8_t grub_efi_ipv4_address_t[4]; +-typedef grub_uint16_t grub_efi_ipv6_address_t[8]; +-typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4))); ++typedef grub_efi_uint8_t grub_efi_mac_address_t[32]; ++typedef grub_efi_uint8_t grub_efi_ipv4_address_t[4]; ++typedef grub_efi_uint8_t grub_efi_ipv6_address_t[16]; ++typedef union ++{ ++ grub_efi_uint32_t addr[4]; ++ grub_efi_ipv4_address_t v4; ++ grub_efi_ipv6_address_t v6; ++} grub_efi_ip_address_t __attribute__ ((aligned(4))); ++ + typedef grub_efi_uint64_t grub_efi_physical_address_t; + typedef grub_efi_uint64_t grub_efi_virtual_address_t; + +@@ -1454,16 +1460,127 @@ struct grub_efi_simple_text_output_interface + }; + typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t; + +-typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; ++typedef struct grub_efi_pxe_dhcpv4_packet ++{ ++ grub_efi_uint8_t bootp_opcode; ++ grub_efi_uint8_t bootp_hwtype; ++ grub_efi_uint8_t bootp_hwaddr_len; ++ grub_efi_uint8_t bootp_gate_hops; ++ grub_efi_uint32_t bootp_ident; ++ grub_efi_uint16_t bootp_seconds; ++ grub_efi_uint16_t bootp_flags; ++ grub_efi_uint8_t bootp_ci_addr[4]; ++ grub_efi_uint8_t bootp_yi_addr[4]; ++ grub_efi_uint8_t bootp_si_addr[4]; ++ grub_efi_uint8_t bootp_gi_addr[4]; ++ grub_efi_uint8_t bootp_hw_addr[16]; ++ grub_efi_uint8_t bootp_srv_name[64]; ++ grub_efi_uint8_t bootp_boot_file[128]; ++ grub_efi_uint32_t dhcp_magik; ++ grub_efi_uint8_t dhcp_options[56]; ++} grub_efi_pxe_dhcpv4_packet_t; ++ ++struct grub_efi_pxe_dhcpv6_packet ++{ ++ grub_efi_uint32_t message_type:8; ++ grub_efi_uint32_t transaction_id:24; ++ grub_efi_uint8_t dhcp_options[1024]; ++} GRUB_PACKED; ++typedef struct grub_efi_pxe_dhcpv6_packet grub_efi_pxe_dhcpv6_packet_t; ++ ++typedef union ++{ ++ grub_efi_uint8_t raw[1472]; ++ grub_efi_pxe_dhcpv4_packet_t dhcpv4; ++ grub_efi_pxe_dhcpv6_packet_t dhcpv6; ++} grub_efi_pxe_packet_t; ++ ++#define GRUB_EFI_PXE_MAX_IPCNT 8 ++#define GRUB_EFI_PXE_MAX_ARP_ENTRIES 8 ++#define GRUB_EFI_PXE_MAX_ROUTE_ENTRIES 8 ++ ++typedef struct grub_efi_pxe_ip_filter ++{ ++ grub_efi_uint8_t filters; ++ grub_efi_uint8_t ip_count; ++ grub_efi_uint8_t reserved; ++ grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_MAX_IPCNT]; ++} grub_efi_pxe_ip_filter_t; ++ ++typedef struct grub_efi_pxe_arp_entry ++{ ++ grub_efi_ip_address_t ip_addr; ++ grub_efi_mac_address_t mac_addr; ++} grub_efi_pxe_arp_entry_t; ++ ++typedef struct grub_efi_pxe_route_entry ++{ ++ grub_efi_ip_address_t ip_addr; ++ grub_efi_ip_address_t subnet_mask; ++ grub_efi_ip_address_t gateway_addr; ++} grub_efi_pxe_route_entry_t; ++ ++typedef struct grub_efi_pxe_icmp_error ++{ ++ grub_efi_uint8_t type; ++ grub_efi_uint8_t code; ++ grub_efi_uint16_t checksum; ++ union ++ { ++ grub_efi_uint32_t reserved; ++ grub_efi_uint32_t mtu; ++ grub_efi_uint32_t pointer; ++ struct ++ { ++ grub_efi_uint16_t identifier; ++ grub_efi_uint16_t sequence; ++ } echo; ++ } u; ++ grub_efi_uint8_t data[494]; ++} grub_efi_pxe_icmp_error_t; ++ ++typedef struct grub_efi_pxe_tftp_error ++{ ++ grub_efi_uint8_t error_code; ++ grub_efi_char8_t error_string[127]; ++} grub_efi_pxe_tftp_error_t; + + typedef struct grub_efi_pxe_mode + { +- grub_uint8_t unused[52]; ++ grub_efi_boolean_t started; ++ grub_efi_boolean_t ipv6_available; ++ grub_efi_boolean_t ipv6_supported; ++ grub_efi_boolean_t using_ipv6; ++ grub_efi_boolean_t bis_supported; ++ grub_efi_boolean_t bis_detected; ++ grub_efi_boolean_t auto_arp; ++ grub_efi_boolean_t send_guid; ++ grub_efi_boolean_t dhcp_discover_valid; ++ grub_efi_boolean_t dhcp_ack_received; ++ grub_efi_boolean_t proxy_offer_received; ++ grub_efi_boolean_t pxe_discover_valid; ++ grub_efi_boolean_t pxe_reply_received; ++ grub_efi_boolean_t pxe_bis_reply_received; ++ grub_efi_boolean_t icmp_error_received; ++ grub_efi_boolean_t tftp_error_received; ++ grub_efi_boolean_t make_callbacks; ++ grub_efi_uint8_t ttl; ++ grub_efi_uint8_t tos; ++ grub_efi_ip_address_t station_ip; ++ grub_efi_ip_address_t subnet_mask; + grub_efi_pxe_packet_t dhcp_discover; + grub_efi_pxe_packet_t dhcp_ack; + grub_efi_pxe_packet_t proxy_offer; + grub_efi_pxe_packet_t pxe_discover; + grub_efi_pxe_packet_t pxe_reply; ++ grub_efi_pxe_packet_t pxe_bis_reply; ++ grub_efi_pxe_ip_filter_t ip_filter; ++ grub_efi_uint32_t arp_cache_entries; ++ grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_MAX_ARP_ENTRIES]; ++ grub_efi_uint32_t route_table_entries; ++ grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_MAX_ROUTE_ENTRIES]; ++ grub_efi_pxe_icmp_error_t icmp_error; ++ grub_efi_pxe_tftp_error_t tftp_error; + } grub_efi_pxe_mode_t; + + typedef struct grub_efi_pxe +diff --git a/include/grub/net.h b/include/grub/net.h +index 50d62ab0c..f8f3ec13a 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -442,6 +442,51 @@ struct grub_net_bootp_packet + grub_uint8_t vendor[0]; + } GRUB_PACKED; + ++enum ++ { ++ GRUB_NET_DHCP6_IA_NA = 3, ++ GRUB_NET_DHCP6_IA_ADDRESS = 5, ++ GRUB_NET_DHCP6_BOOTFILE_URL = 59, ++ }; ++ ++struct grub_net_dhcpv6_option ++{ ++ grub_uint16_t option_num; ++ grub_uint16_t option_len; ++ grub_uint8_t option_data[]; ++} GRUB_PACKED; ++typedef struct grub_net_dhcpv6_option grub_net_dhcpv6_option_t; ++ ++struct grub_net_dhcpv6_opt_ia_na ++{ ++ grub_uint16_t option_num; ++ grub_uint16_t option_len; ++ grub_uint32_t iaid; ++ grub_uint32_t t1; ++ grub_uint32_t t2; ++ grub_uint8_t options[]; ++} GRUB_PACKED; ++typedef struct grub_net_dhcpv6_opt_ia_na grub_net_dhcpv6_opt_ia_na_t; ++ ++struct grub_net_dhcpv6_opt_ia_address ++{ ++ grub_uint16_t option_num; ++ grub_uint16_t option_len; ++ grub_uint64_t ipv6_address[2]; ++ grub_uint32_t preferred_lifetime; ++ grub_uint32_t valid_lifetime; ++ grub_uint8_t options[]; ++} GRUB_PACKED; ++typedef struct grub_net_dhcpv6_opt_ia_address grub_net_dhcpv6_opt_ia_address_t; ++ ++struct grub_net_dhcpv6_packet ++{ ++ grub_uint32_t message_type:8; ++ grub_uint32_t transaction_id:24; ++ grub_uint8_t dhcp_options[1024]; ++} GRUB_PACKED; ++typedef struct grub_net_dhcpv6_packet grub_net_dhcpv6_packet_t; ++ + #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 + #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 + #define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 +@@ -470,6 +515,21 @@ grub_net_configure_by_dhcp_ack (const char *name, + grub_size_t size, + int is_def, char **device, char **path); + ++struct grub_net_network_level_interface * ++grub_net_configure_by_dhcpv6_ack (const char *name, ++ struct grub_net_card *card, ++ grub_net_interface_flags_t flags, ++ const grub_net_link_level_address_t *hwaddr, ++ const struct grub_net_dhcpv6_packet *packet, ++ int is_def, char **device, char **path); ++ ++int ++grub_ipv6_get_masksize(grub_uint16_t *mask); ++ ++grub_err_t ++grub_net_add_ipv6_local (struct grub_net_network_level_interface *inf, ++ int mask); ++ + grub_err_t + grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf, + int mask); +-- +2.13.0 + diff --git a/0087-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0132-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 93% rename from 0087-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0132-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index 5297ac64..1795632e 100644 --- a/0087-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0132-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -1,7 +1,7 @@ -From d3d42740661dce4df12330e57a1681a3b296622e Mon Sep 17 00:00:00 2001 +From e16fb5db722d3282fdeef18be7d3e507684aa815 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 23 Jun 2016 11:01:39 -0400 -Subject: [PATCH 87/90] Add grub-get-kernel-settings and use it in 10_linux +Subject: [PATCH 132/176] Add grub-get-kernel-settings and use it in 10_linux This patch adds grub-get-kernel-settings, which reads the system kernel installation configuration from /etc/sysconfig/kernel, and outputs @@ -24,7 +24,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/.gitignore b/.gitignore -index 53a391e..f2f1ef5 100644 +index 302be1e8f..fb595db15 100644 --- a/.gitignore +++ b/.gitignore @@ -112,6 +112,7 @@ grub-emu-lite @@ -36,10 +36,10 @@ index 53a391e..f2f1ef5 100644 grub-install grub-kbdcomp diff --git a/Makefile.util.def b/Makefile.util.def -index 8007de9..38cdf4c 100644 +index 226c46b2d..ed27351eb 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -716,6 +716,13 @@ script = { +@@ -714,6 +714,13 @@ script = { }; script = { @@ -54,7 +54,7 @@ index 8007de9..38cdf4c 100644 common = util/grub-set-default.in; mansection = 8; diff --git a/configure.ac b/configure.ac -index 25de2c1..1d8f7e7 100644 +index 3c4b9a19b..40be70019 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install]) @@ -74,7 +74,7 @@ index 25de2c1..1d8f7e7 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in -index 44bf135..5c4acd4 100644 +index 44bf135b9..5c4acd496 100644 --- a/util/bash-completion.d/grub-completion.bash.in +++ b/util/bash-completion.d/grub-completion.bash.in @@ -265,6 +265,28 @@ unset __grub_sparc64_setup_program @@ -108,7 +108,7 @@ index 44bf135..5c4acd4 100644 _grub_install () { diff --git a/util/grub-get-kernel-settings.3 b/util/grub-get-kernel-settings.3 new file mode 100644 -index 0000000..ba33330 +index 000000000..ba33330e2 --- /dev/null +++ b/util/grub-get-kernel-settings.3 @@ -0,0 +1,20 @@ @@ -134,7 +134,7 @@ index 0000000..ba33330 +.BR "info grub" diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in new file mode 100644 -index 0000000..1204621 +index 000000000..120462198 --- /dev/null +++ b/util/grub-get-kernel-settings.in @@ -0,0 +1,78 @@ @@ -217,7 +217,7 @@ index 0000000..1204621 + echo export GRUB_LINUX_DEBUG_TITLE_POSTFIX +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index fb87247..e32de5e 100644 +index fb8724708..e32de5ef3 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -238,10 +238,10 @@ index fb87247..e32de5e 100644 GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED" fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 1215241..0c5b227 100644 +index 584ad1f46..c9bf223f2 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -84,7 +84,8 @@ linux_entry () +@@ -101,7 +101,8 @@ linux_entry () os="$1" version="$2" type="$3" @@ -251,7 +251,7 @@ index 1215241..0c5b227 100644 sixteenbit="" linuxefi="linux" -@@ -116,6 +117,9 @@ linux_entry () +@@ -128,6 +129,9 @@ linux_entry () quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" fi @@ -261,7 +261,7 @@ index 1215241..0c5b227 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -@@ -273,11 +277,15 @@ while [ "x$list" != "x" ] ; do +@@ -285,11 +289,15 @@ while [ "x$list" != "x" ] ; do fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then @@ -279,7 +279,7 @@ index 1215241..0c5b227 100644 if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -286,10 +294,15 @@ while [ "x$list" != "x" ] ; do +@@ -298,10 +306,15 @@ while [ "x$list" != "x" ] ; do is_top_level=false fi @@ -298,5 +298,5 @@ index 1215241..0c5b227 100644 fi -- -2.9.3 +2.13.0 diff --git a/0088-Normalize-slashes-in-tftp-paths.patch b/0133-Normalize-slashes-in-tftp-paths.patch similarity index 90% rename from 0088-Normalize-slashes-in-tftp-paths.patch rename to 0133-Normalize-slashes-in-tftp-paths.patch index ffaaf814..9ba8cd2c 100644 --- a/0088-Normalize-slashes-in-tftp-paths.patch +++ b/0133-Normalize-slashes-in-tftp-paths.patch @@ -1,7 +1,7 @@ -From 22d26153c1d92b8a42d1ec823b7f7c77c1cc0a8c Mon Sep 17 00:00:00 2001 +From 50b36d55b9d86a12021e0548762d2c5a3298f2a7 Mon Sep 17 00:00:00 2001 From: Lenny Szubowicz Date: Mon, 29 Aug 2016 11:04:48 -0400 -Subject: [PATCH 88/90] Normalize slashes in tftp paths. +Subject: [PATCH 133/176] Normalize slashes in tftp paths. Some tftp servers do not handle multiple consecutive slashes correctly; this patch avoids sending tftp requests with non-normalized paths. @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7d90bf6..63bbc28 100644 +index 1157524fc..5ca0a96a6 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data) @@ -54,5 +54,5 @@ index 7d90bf6..63bbc28 100644 rrq += grub_strlen (filename) + 1; -- -2.9.3 +2.13.0 diff --git a/0134-Fix-malformed-tftp-packets.patch b/0134-Fix-malformed-tftp-packets.patch new file mode 100644 index 00000000..d947c4f1 --- /dev/null +++ b/0134-Fix-malformed-tftp-packets.patch @@ -0,0 +1,35 @@ +From 4582fb474ebcb23b23deb078b4276b526f6ac063 Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Tue, 7 Mar 2017 18:26:17 -0500 +Subject: [PATCH 134/176] Fix malformed tftp packets + +0088-Normalize-slashes-in-tftp-paths.patch collapses multiple contiguous +slashes in a filename into one slash in the tftp packet filename field. +However, the packet buffer pointer is advanced using the original name. +This leaves unitialized data between the name field and the type field +leading to tftp errors. Use the length of the normalized name to avoid +this. + +Signed-off-by: Mark Salter +--- + grub-core/net/tftp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 5ca0a96a6..dcd824943 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -360,8 +360,8 @@ tftp_open (struct grub_file *file, const char *filename) + /* Copy and normalize the filename to work-around issues on some tftp + servers when file names are being matched for remapping. */ + grub_normalize_filename (rrq, filename); +- rrqlen += grub_strlen (filename) + 1; +- rrq += grub_strlen (filename) + 1; ++ rrqlen += grub_strlen (rrq) + 1; ++ rrq += grub_strlen (rrq) + 1; + + grub_strcpy (rrq, "octet"); + rrqlen += grub_strlen ("octet") + 1; +-- +2.13.0 + diff --git a/0067-Fix-race-in-EFI-validation.patch b/0135-Fix-race-in-EFI-validation.patch similarity index 94% rename from 0067-Fix-race-in-EFI-validation.patch rename to 0135-Fix-race-in-EFI-validation.patch index 4667b47f..3c92d506 100644 --- a/0067-Fix-race-in-EFI-validation.patch +++ b/0135-Fix-race-in-EFI-validation.patch @@ -1,14 +1,14 @@ -From a605e7af01dc697021b96fe6fbaf92ef3fca017c Mon Sep 17 00:00:00 2001 +From 7d279caab2d0f87177af9b1cd244b83ac7c18eef Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Tue, 14 Jul 2015 16:58:51 -0700 -Subject: [PATCH 67/90] Fix race in EFI validation +Subject: [PATCH 135/176] Fix race in EFI validation --- grub-core/loader/i386/efi/linux.c | 44 ++++++++++----------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index e5b7785..7ccf32d 100644 +index e5b778577..7ccf32d9d 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -154,7 +154,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -93,5 +93,5 @@ index e5b7785..7ccf32d 100644 { grub_dl_unref (my_mod); -- -2.9.3 +2.13.0 diff --git a/0136-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0136-bz1374141-fix-incorrect-mask-for-ppc64.patch new file mode 100644 index 00000000..72ccce90 --- /dev/null +++ b/0136-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -0,0 +1,48 @@ +From f6903f70bd39493a29b79dd0efd3864daa8e88c2 Mon Sep 17 00:00:00 2001 +From: Masahiro Matsuya +Date: Sat, 29 Oct 2016 08:35:26 +0900 +Subject: [PATCH 136/176] bz1374141 fix incorrect mask for ppc64 + +The netmask configured in firmware is not respected on ppc64 (big endian). +When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath(). + + /vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512 + +The netmask in this bootpath is no problem, since it's a value specified in firmware. But, +The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22). +As a result, 16 was used for netmask wrongly. + +1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00) +0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4) +1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4) + +And, the count of zero with __builtin_ctz can be 16. +This patch changes it as below. + +1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00) +0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4) +1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)) +0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)) + +The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit) +--- + grub-core/net/drivers/ieee1275/ofnet.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c +index 002446be1..3df75357a 100644 +--- a/grub-core/net/drivers/ieee1275/ofnet.c ++++ b/grub-core/net/drivers/ieee1275/ofnet.c +@@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, + flags); + inter->vlantag = vlantag; + grub_net_add_ipv4_local (inter, +- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); +- ++ __builtin_clz (~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)))); + } + + if (gateway_addr.ipv4 != 0) +-- +2.13.0 + diff --git a/0069-Use-device-part-of-chainloader-target-if-present.patch b/0137-Use-device-part-of-chainloader-target-if-present.patch similarity index 79% rename from 0069-Use-device-part-of-chainloader-target-if-present.patch rename to 0137-Use-device-part-of-chainloader-target-if-present.patch index 2b3dcf78..721036c5 100644 --- a/0069-Use-device-part-of-chainloader-target-if-present.patch +++ b/0137-Use-device-part-of-chainloader-target-if-present.patch @@ -1,7 +1,7 @@ -From 9d47b2c482b6db238c99fe106f4b2e3c612f3a91 Mon Sep 17 00:00:00 2001 +From 4a0596f200dcec9d534fc79a48b5721bbf1b907f Mon Sep 17 00:00:00 2001 From: Raymund Will Date: Fri, 10 Apr 2015 01:45:02 -0400 -Subject: [PATCH 69/90] Use device part of chainloader target, if present. +Subject: [PATCH 137/176] Use device part of chainloader target, if present. Otherwise chainloading is restricted to '$root', which might not even be readable by EFI! @@ -15,10 +15,10 @@ Signed-off-by: Peter Jones 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 522a716..6b47497 100644 +index adc856366..14ce6ddd7 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -219,8 +219,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -223,8 +223,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (! file) goto fail; @@ -33,5 +33,5 @@ index 522a716..6b47497 100644 goto fail; -- -2.9.3 +2.13.0 diff --git a/0070-Add-secureboot-support-on-efi-chainloader.patch b/0138-Add-secureboot-support-on-efi-chainloader.patch similarity index 96% rename from 0070-Add-secureboot-support-on-efi-chainloader.patch rename to 0138-Add-secureboot-support-on-efi-chainloader.patch index 03fd5ca3..c4e719d2 100644 --- a/0070-Add-secureboot-support-on-efi-chainloader.patch +++ b/0138-Add-secureboot-support-on-efi-chainloader.patch @@ -1,7 +1,7 @@ -From 9cbf35d19f4ffafdf2683acf7b6a320b55bbdfca Mon Sep 17 00:00:00 2001 +From 0be916874913790bf1db111c0479800392859e16 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 6 Oct 2015 13:04:37 -0400 -Subject: [PATCH 70/90] Add secureboot support on efi chainloader +Subject: [PATCH 138/176] Add secureboot support on efi chainloader Expand the chainloader to be able to verify the image by means of shim lock protocol. The PE/COFF image is loaded and relocated by the @@ -22,7 +22,7 @@ Signed-off-by: Peter Jones 2 files changed, 595 insertions(+), 37 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 6b47497..3cbb6c5 100644 +index 14ce6ddd7..87a91e16f 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -57,7 +57,7 @@ index 6b47497..3cbb6c5 100644 grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -187,12 +195,523 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -191,12 +199,523 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) return file_path; } @@ -582,7 +582,7 @@ index 6b47497..3cbb6c5 100644 grub_efi_status_t status; grub_efi_boot_services_t *b; grub_device_t dev = 0; -@@ -200,7 +719,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -204,7 +723,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_efi_loaded_image_t *loaded_image; char *filename; void *boot_image = 0; @@ -590,7 +590,7 @@ index 6b47497..3cbb6c5 100644 if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -212,9 +730,36 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -216,9 +734,36 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), address = 0; image_handle = 0; file_path = 0; @@ -627,7 +627,7 @@ index 6b47497..3cbb6c5 100644 file = grub_file_open (filename); if (! file) goto fail; -@@ -263,14 +808,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -267,14 +812,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_printf ("file path: "); grub_efi_print_device_path (file_path); @@ -645,7 +645,7 @@ index 6b47497..3cbb6c5 100644 status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -284,7 +829,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -288,7 +833,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } boot_image = (void *) ((grub_addr_t) address); @@ -654,7 +654,7 @@ index 6b47497..3cbb6c5 100644 { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -294,7 +839,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -298,7 +843,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #if defined (__i386__) || defined (__x86_64__) @@ -663,7 +663,7 @@ index 6b47497..3cbb6c5 100644 { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -303,6 +848,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -307,6 +852,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t i; struct grub_macho_fat_arch *archs = (struct grub_macho_fat_arch *) (head + 1); @@ -678,7 +678,7 @@ index 6b47497..3cbb6c5 100644 for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++) { if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype)) -@@ -317,21 +870,28 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -321,21 +874,28 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -711,7 +711,7 @@ index 6b47497..3cbb6c5 100644 if (status != GRUB_EFI_SUCCESS) { if (status == GRUB_EFI_OUT_OF_RESOURCES) -@@ -353,33 +913,10 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -357,33 +917,10 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } loaded_image->device_handle = dev_handle; @@ -747,7 +747,7 @@ index 6b47497..3cbb6c5 100644 } grub_file_close (file); -@@ -401,6 +938,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -405,6 +942,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (address) efi_call_2 (b->free_pages, address, pages); @@ -758,7 +758,7 @@ index 6b47497..3cbb6c5 100644 return grub_errno; diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index f79c36c..f79782e 100644 +index f79c36c02..f79782e1b 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -212,7 +212,11 @@ struct grub_pe64_optional_header @@ -796,5 +796,5 @@ index f79c36c..f79782e 100644 { grub_uint32_t page_rva; -- -2.9.3 +2.13.0 diff --git a/0071-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0139-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch similarity index 93% rename from 0071-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch rename to 0139-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 5592b971..8c237818 100644 --- a/0071-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0139-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -1,7 +1,7 @@ -From c1d31b6a26e5542142d569c94a70f1dc8e07afd6 Mon Sep 17 00:00:00 2001 +From b3a4f6bb0b647c92f01b33653368cee8c21f5ab6 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 6 Oct 2015 16:09:25 -0400 -Subject: [PATCH 71/90] Make any of the loaders that link in efi mode honor +Subject: [PATCH 139/176] Make any of the loaders that link in efi mode honor secure boot. And in this case "honor" means "even if somebody does link this in, they @@ -37,7 +37,7 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/sparc64/linux.h diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 04e9395..fd715a8 100644 +index 104513847..f7b4d29b0 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h @@ -49,10 +49,10 @@ index 04e9395..fd715a8 100644 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 7fba196..ac195d1 100644 +index 630db675c..096aee187 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -178,6 +178,7 @@ kernel = { +@@ -196,6 +196,7 @@ kernel = { i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; i386_multiboot = kern/acpi.c; @@ -61,7 +61,7 @@ index 7fba196..ac195d1 100644 x86 = kern/i386/tsc.c; x86 = kern/i386/tsc_pit.c; diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index a0c164e..41a7f3f 100644 +index a0c164e54..41a7f3f04 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c @@ -23,6 +23,7 @@ @@ -93,7 +93,7 @@ index a0c164e..41a7f3f 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c -index 98769ea..088cbe9 100644 +index 98769eadb..088cbe9e2 100644 --- a/grub-core/commands/memrw.c +++ b/grub-core/commands/memrw.c @@ -22,6 +22,7 @@ @@ -125,7 +125,7 @@ index 98769ea..088cbe9 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 0859910..101307f 100644 +index 2588b481e..684ca93f8 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -269,34 +269,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -165,7 +165,7 @@ index 0859910..101307f 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c new file mode 100644 -index 0000000..a41b6c5 +index 000000000..a41b6c5b8 --- /dev/null +++ b/grub-core/kern/efi/sb.c @@ -0,0 +1,58 @@ @@ -228,7 +228,7 @@ index 0000000..a41b6c5 +#endif +} diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c -index 74888c4..69c2a10 100644 +index 74888c463..69c2a10d3 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -24,6 +24,7 @@ @@ -259,7 +259,7 @@ index 74888c4..69c2a10 100644 grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3cbb6c5..c4184fa 100644 +index 87a91e16f..aee8e6bec 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ @@ -271,7 +271,7 @@ index 3cbb6c5..c4184fa 100644 #include #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 7f96515..87709aa 100644 +index 7f96515da..87709aa23 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -38,6 +38,7 @@ @@ -303,7 +303,7 @@ index 7f96515..87709aa 100644 grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index fddcc46..b0afcca 100644 +index 083f9417c..b2438547d 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -35,6 +35,7 @@ @@ -314,7 +314,7 @@ index fddcc46..b0afcca 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1136,6 +1137,9 @@ static grub_command_t cmd_linux, cmd_initrd; +@@ -1139,6 +1140,9 @@ static grub_command_t cmd_linux, cmd_initrd; GRUB_MOD_INIT(linux) { @@ -324,7 +324,7 @@ index fddcc46..b0afcca 100644 cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, -@@ -1145,6 +1149,9 @@ GRUB_MOD_INIT(linux) +@@ -1148,6 +1152,9 @@ GRUB_MOD_INIT(linux) GRUB_MOD_FINI(linux) { @@ -335,7 +335,7 @@ index fddcc46..b0afcca 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index a293b17..9128315 100644 +index a293b17aa..91283157e 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -35,6 +35,7 @@ @@ -367,7 +367,7 @@ index a293b17..9128315 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 73aa0aa..64a6513 100644 +index bd9d5b3e6..fb044a60c 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -42,6 +42,7 @@ @@ -378,7 +378,7 @@ index 73aa0aa..64a6513 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -391,6 +392,9 @@ static grub_command_t cmd_multiboot, cmd_module; +@@ -431,6 +432,9 @@ static grub_command_t cmd_multiboot, cmd_module; GRUB_MOD_INIT(multiboot) { @@ -388,7 +388,7 @@ index 73aa0aa..64a6513 100644 cmd_multiboot = #ifdef GRUB_USE_MULTIBOOT2 grub_register_command ("multiboot2", grub_cmd_multiboot, -@@ -411,6 +415,9 @@ GRUB_MOD_INIT(multiboot) +@@ -451,6 +455,9 @@ GRUB_MOD_INIT(multiboot) GRUB_MOD_FINI(multiboot) { @@ -399,7 +399,7 @@ index 73aa0aa..64a6513 100644 grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index c9885b1..df8dfdb 100644 +index c9885b1bc..df8dfdb4b 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c @@ -33,6 +33,7 @@ @@ -431,7 +431,7 @@ index c9885b1..df8dfdb 100644 grub_unregister_command (cmd_resume); #endif diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2245632..9a2da0e 100644 +index 62a3d9726..764cd11f5 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -76,7 +76,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, @@ -444,7 +444,7 @@ index 2245632..9a2da0e 100644 const grub_efi_device_path_t *dp2); diff --git a/include/grub/efi/sb.h b/include/grub/efi/sb.h new file mode 100644 -index 0000000..9629fbb +index 000000000..9629fbb0f --- /dev/null +++ b/include/grub/efi/sb.h @@ -0,0 +1,29 @@ @@ -479,16 +479,16 @@ index 0000000..9629fbb +#endif /* ! GRUB_EFI_SB_HEADER */ diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h new file mode 100644 -index 0000000..e69de29 +index 000000000..e69de29bb diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h new file mode 100644 -index 0000000..e69de29 +index 000000000..e69de29bb diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h new file mode 100644 -index 0000000..e69de29 +index 000000000..e69de29bb diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 -index 0000000..e69de29 +index 000000000..e69de29bb -- -2.9.3 +2.13.0 diff --git a/0073-Make-grub_fatal-also-backtrace.patch b/0140-Make-grub_fatal-also-backtrace.patch similarity index 91% rename from 0073-Make-grub_fatal-also-backtrace.patch rename to 0140-Make-grub_fatal-also-backtrace.patch index bac1ecb1..6af18af5 100644 --- a/0073-Make-grub_fatal-also-backtrace.patch +++ b/0140-Make-grub_fatal-also-backtrace.patch @@ -1,7 +1,7 @@ -From c37a4f02e5fd0c3aa5f54baaeaf32eed0e3c110b Mon Sep 17 00:00:00 2001 +From f0600b3846ef7c710833bfa248fc6b6ac362df78 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 27 Jan 2016 09:22:42 -0500 -Subject: [PATCH 73/90] Make grub_fatal() also backtrace. +Subject: [PATCH 140/176] Make grub_fatal() also backtrace. --- grub-core/Makefile.core.def | 3 ++ @@ -13,10 +13,10 @@ Subject: [PATCH 73/90] Make grub_fatal() also backtrace. create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ac195d1..990e41b 100644 +index 096aee187..94655d684 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -157,6 +157,9 @@ kernel = { +@@ -175,6 +175,9 @@ kernel = { softdiv = lib/division.c; @@ -27,7 +27,7 @@ index ac195d1..990e41b 100644 i386_xen = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 81be344..d7dcd97 100644 +index f1fab7000..5ce89a40c 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -24,6 +24,7 @@ @@ -38,7 +38,7 @@ index 81be344..d7dcd97 100644 union printf_arg { -@@ -1087,8 +1088,13 @@ grub_xasprintf (const char *fmt, ...) +@@ -1101,8 +1102,13 @@ grub_xasprintf (const char *fmt, ...) static void __attribute__ ((noreturn)) grub_abort (void) { @@ -55,7 +55,7 @@ index 81be344..d7dcd97 100644 #endif diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c new file mode 100644 -index 0000000..1079b53 +index 000000000..1079b5380 --- /dev/null +++ b/grub-core/lib/arm64/backtrace.c @@ -0,0 +1,62 @@ @@ -122,7 +122,7 @@ index 0000000..1079b53 +} + diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c -index 825a880..c0ad6ab 100644 +index 825a8800e..c0ad6ab8b 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/lib/backtrace.c @@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -142,7 +142,7 @@ index 825a880..c0ad6ab 100644 } diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c -index c3e03c7..c67273d 100644 +index c3e03c727..c67273db3 100644 --- a/grub-core/lib/i386/backtrace.c +++ b/grub-core/lib/i386/backtrace.c @@ -15,11 +15,23 @@ @@ -171,5 +171,5 @@ index c3e03c7..c67273d 100644 #include #include -- -2.9.3 +2.13.0 diff --git a/0074-Rework-linux-command.patch b/0141-Rework-linux-command.patch similarity index 92% rename from 0074-Rework-linux-command.patch rename to 0141-Rework-linux-command.patch index 25b3e62d..2e950810 100644 --- a/0074-Rework-linux-command.patch +++ b/0141-Rework-linux-command.patch @@ -1,7 +1,7 @@ -From 33d11870bbc2fa554fa9344c3c180279c258736a Mon Sep 17 00:00:00 2001 +From 9f0d557a54ff3763de10f7f8ac93d99f4493b3a6 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:12:39 -0700 -Subject: [PATCH 74/90] Rework linux command +Subject: [PATCH 141/176] Rework linux command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel into it @@ -11,7 +11,7 @@ before pulling out the individual blocks later on. 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index b0afcca..5eb7d17 100644 +index b2438547d..e4b8342f5 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -681,12 +681,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -82,7 +82,7 @@ index b0afcca..5eb7d17 100644 grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n", (unsigned) real_size, (unsigned) prot_size); -@@ -1017,9 +1025,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1020,9 +1028,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - (sizeof (LINUX_IMAGE) - 1)); len = prot_file_size; @@ -93,7 +93,7 @@ index b0afcca..5eb7d17 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -1030,6 +1036,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1033,6 +1039,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: @@ -103,5 +103,5 @@ index b0afcca..5eb7d17 100644 grub_file_close (file); -- -2.9.3 +2.13.0 diff --git a/0075-Rework-linux16-command.patch b/0142-Rework-linux16-command.patch similarity index 95% rename from 0075-Rework-linux16-command.patch rename to 0142-Rework-linux16-command.patch index a1539320..220ccdfa 100644 --- a/0075-Rework-linux16-command.patch +++ b/0142-Rework-linux16-command.patch @@ -1,7 +1,7 @@ -From 0b86b309de12b4f3ea920124faa60841ffedf472 Mon Sep 17 00:00:00 2001 +From c3fb8b9f0553476cd98c493f15569ebaa069188f Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Sun, 9 Aug 2015 16:20:58 -0700 -Subject: [PATCH 75/90] Rework linux16 command +Subject: [PATCH 142/176] Rework linux16 command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel int it @@ -11,7 +11,7 @@ before pulling out the individual blocks later on. 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 9128315..b864e54 100644 +index 91283157e..b864e5403 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -97,5 +97,5 @@ index 9128315..b864e54 100644 grub_file_close (file); -- -2.9.3 +2.13.0 diff --git a/0076-Make-grub-editenv-build-again.patch b/0143-Make-grub-editenv-build-again.patch similarity index 83% rename from 0076-Make-grub-editenv-build-again.patch rename to 0143-Make-grub-editenv-build-again.patch index ec632e1e..e06f12a7 100644 --- a/0076-Make-grub-editenv-build-again.patch +++ b/0143-Make-grub-editenv-build-again.patch @@ -1,7 +1,7 @@ -From edaa6c877917816d57603e26d660107c82ffbb5d Mon Sep 17 00:00:00 2001 +From 5104251f96e3dc2827934d79f23f2371f12184e1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 4 Mar 2016 16:29:13 -0500 -Subject: [PATCH 76/90] Make grub-editenv build again. +Subject: [PATCH 143/176] Make grub-editenv build again. 36212460d3565b18439a3a8130b28e6c97702c6a split how some of the mkimage utility functions are defined, and they wind up being linked into @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/Makefile.util.def b/Makefile.util.def -index 226c46b..8007de9 100644 +index ed27351eb..38cdf4ccc 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -236,6 +236,8 @@ program = { @@ -26,5 +26,5 @@ index 226c46b..8007de9 100644 common = util/config.c; common = util/resolve.c; -- -2.9.3 +2.13.0 diff --git a/0078-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0144-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 90% rename from 0078-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0144-Fix-up-some-man-pages-rpmdiff-noticed.patch index f0130b3e..771cad78 100644 --- a/0078-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0144-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -1,7 +1,7 @@ -From 216188f920d3ade19626d6e8fe450cea2c427e53 Mon Sep 17 00:00:00 2001 +From 0695a021dc35b22594f7c6383d04c8dab2f1df84 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 23 Sep 2014 09:58:49 -0400 -Subject: [PATCH 78/90] Fix up some man pages rpmdiff noticed. +Subject: [PATCH 144/176] Fix up some man pages rpmdiff noticed. --- configure.ac | 2 ++ @@ -13,10 +13,10 @@ Subject: [PATCH 78/90] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index 67ff20c..25de2c1 100644 +index 40be70019..ae371a97d 100644 --- a/configure.ac +++ b/configure.ac -@@ -78,6 +78,7 @@ grub_TRANSFORM([grub-fstest.3]) +@@ -80,6 +80,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) grub_TRANSFORM([grub-glue-efi.3]) grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) @@ -24,7 +24,7 @@ index 67ff20c..25de2c1 100644 grub_TRANSFORM([grub-menulst2cfg.1]) grub_TRANSFORM([grub-mkconfig.1]) grub_TRANSFORM([grub-mkfont.3]) -@@ -96,6 +97,7 @@ grub_TRANSFORM([grub-render-label.3]) +@@ -98,6 +99,7 @@ grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) grub_TRANSFORM([grub-set-default.1]) grub_TRANSFORM([grub-sparc64-setup.3]) @@ -34,7 +34,7 @@ index 67ff20c..25de2c1 100644 if test "x$TARGET_CFLAGS" = x; then diff --git a/util/grub-macbless.8 b/util/grub-macbless.8 new file mode 100644 -index 0000000..ae842f3 +index 000000000..ae842f3a6 --- /dev/null +++ b/util/grub-macbless.8 @@ -0,0 +1,26 @@ @@ -65,7 +65,7 @@ index 0000000..ae842f3 +.SH SEE ALSO +.BR "info grub" diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1 -index 4dea4f5..0eaaafe 100644 +index 4dea4f545..0eaaafe50 100644 --- a/util/grub-mkimage.1 +++ b/util/grub-mkimage.1 @@ -17,7 +17,7 @@ @@ -79,7 +79,7 @@ index 4dea4f5..0eaaafe 100644 .TP diff --git a/util/grub-syslinux2cfg.1 b/util/grub-syslinux2cfg.1 new file mode 100644 -index 0000000..8530948 +index 000000000..853094827 --- /dev/null +++ b/util/grub-syslinux2cfg.1 @@ -0,0 +1,65 @@ @@ -149,5 +149,5 @@ index 0000000..8530948 +.SH SEE ALSO +.BR "info grub" -- -2.9.3 +2.13.0 diff --git a/0082-Re-work-some-intricacies-of-PE-loading.patch b/0145-Re-work-some-intricacies-of-PE-loading.patch similarity index 93% rename from 0082-Re-work-some-intricacies-of-PE-loading.patch rename to 0145-Re-work-some-intricacies-of-PE-loading.patch index 094b5192..f84e4fec 100644 --- a/0082-Re-work-some-intricacies-of-PE-loading.patch +++ b/0145-Re-work-some-intricacies-of-PE-loading.patch @@ -1,7 +1,7 @@ -From e2b22111a8ec58091603fc785f54b1b998888735 Mon Sep 17 00:00:00 2001 +From 5e60d131579d787af81a6a32278c41abb84c50f5 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 9 Jun 2016 12:22:29 -0400 -Subject: [PATCH 82/90] Re-work some intricacies of PE loading. +Subject: [PATCH 145/176] Re-work some intricacies of PE loading. The PE spec is not a well written document, and awesomely every place where there's an ambiguous way to read something, Windows' bootmgfw.efi @@ -12,10 +12,10 @@ takes a different read than either of them. 2 files changed, 152 insertions(+), 36 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index c4184fa..323f873 100644 +index aee8e6bec..4b77a7d5a 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -297,7 +297,7 @@ image_is_64_bit (grub_pe_header_t *pe_hdr) +@@ -301,7 +301,7 @@ image_is_64_bit (grub_pe_header_t *pe_hdr) return 0; } @@ -24,7 +24,7 @@ index c4184fa..323f873 100644 #if defined(__x86_64__) GRUB_PE32_MACHINE_X86_64; #elif defined(__aarch64__) -@@ -363,10 +363,10 @@ relocate_coff (pe_coff_loader_image_context_t *context, +@@ -367,10 +367,10 @@ relocate_coff (pe_coff_loader_image_context_t *context, reloc_base = image_address (orig, size, section->raw_data_offset); reloc_base_end = image_address (orig, size, section->raw_data_offset @@ -38,7 +38,7 @@ index c4184fa..323f873 100644 if (!reloc_base && !reloc_base_end) return GRUB_EFI_SUCCESS; -@@ -503,12 +503,13 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -507,12 +507,13 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_efi_status_t efi_status; char *buffer = NULL; char *buffer_aligned = NULL; @@ -53,7 +53,7 @@ index c4184fa..323f873 100644 b = grub_efi_system_table->boot_services; -@@ -522,8 +523,28 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -526,8 +527,28 @@ handle_image (void *data, grub_efi_uint32_t datasize) goto error_exit; } @@ -82,7 +82,7 @@ index c4184fa..323f873 100644 efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, buffer_size, &buffer); -@@ -535,7 +556,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -539,7 +560,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) } buffer_aligned = (char *)ALIGN_UP ((grub_addr_t)buffer, section_alignment); @@ -90,7 +90,7 @@ index c4184fa..323f873 100644 if (!buffer_aligned) { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -@@ -544,27 +564,62 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -548,27 +568,62 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_memcpy (buffer_aligned, data, context.size_of_headers); @@ -159,7 +159,7 @@ index c4184fa..323f873 100644 /* We do want to process .reloc, but it's often marked * discardable, so we don't want to memcpy it. */ -@@ -583,21 +638,46 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -587,21 +642,46 @@ handle_image (void *data, grub_efi_uint32_t datasize) if (section->raw_data_size && section->virtual_size && base && end && reloc_base == base && reloc_base_end == end) { @@ -210,7 +210,7 @@ index c4184fa..323f873 100644 { grub_error (GRUB_ERR_BAD_ARGUMENT, "Section %d is inside image headers", i); -@@ -605,13 +685,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -609,13 +689,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) } if (section->raw_data_size > 0) @@ -240,7 +240,7 @@ index c4184fa..323f873 100644 } /* 5 == EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC */ -@@ -634,12 +725,15 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -638,12 +729,15 @@ handle_image (void *data, grub_efi_uint32_t datasize) } } @@ -261,7 +261,7 @@ index c4184fa..323f873 100644 goto error_exit; } -@@ -657,26 +751,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -661,26 +755,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) li->load_options_size = cmdline_len; li->file_path = grub_efi_get_media_file_path (file_path); li->device_handle = dev_handle; @@ -293,7 +293,7 @@ index c4184fa..323f873 100644 efi_call_1 (b->free_pool, buffer); diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index f79782e..8396bde 100644 +index f79782e1b..8396bde49 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -227,12 +227,18 @@ struct grub_pe32_section_table @@ -349,5 +349,5 @@ index f79782e..8396bde 100644 struct grub_pe32_header -- -2.9.3 +2.13.0 diff --git a/0083-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch b/0146-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch similarity index 81% rename from 0083-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch rename to 0146-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch index c0458e99..b315ff95 100644 --- a/0083-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch +++ b/0146-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch @@ -1,8 +1,8 @@ -From 8b4deb97529ba7ff689a11639f2a5bfdb29ad2ea Mon Sep 17 00:00:00 2001 +From 0e71764ff576913a3f210c2a07ea65eebbc4c6bb Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 10 Jun 2016 14:06:15 -0400 -Subject: [PATCH 83/90] Rework even more of efi chainload so non-sb cases work - right. +Subject: [PATCH 146/176] Rework even more of efi chainload so non-sb cases + work right. This ensures that if shim protocol is not loaded, or is loaded but shim is disabled, we will fall back to a correct load method for the efi @@ -44,14 +44,14 @@ Signed-off-by: Peter Jones --- grub-core/kern/efi/sb.c | 14 +++-- grub-core/loader/arm64/linux.c | 4 +- - grub-core/loader/efi/chainloader.c | 115 ++++++++++++++++++++++--------------- - grub-core/loader/efi/linux.c | 13 +++-- - grub-core/loader/i386/efi/linux.c | 10 +++- + grub-core/loader/efi/chainloader.c | 122 ++++++++++++++++++++++--------------- + grub-core/loader/efi/linux.c | 13 ++-- + grub-core/loader/i386/efi/linux.c | 10 ++- include/grub/efi/linux.h | 2 +- - 6 files changed, 99 insertions(+), 59 deletions(-) + 6 files changed, 102 insertions(+), 63 deletions(-) diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c -index a41b6c5..d74778b 100644 +index a41b6c5b8..d74778b0c 100644 --- a/grub-core/kern/efi/sb.c +++ b/grub-core/kern/efi/sb.c @@ -36,14 +36,20 @@ grub_efi_secure_boot (void) @@ -80,7 +80,7 @@ index a41b6c5..d74778b 100644 if (*secure_boot && !*setup_mode) ret = 1; diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 4756ef7..f83820e 100644 +index 4756ef71f..f83820e61 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -251,6 +251,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -102,10 +102,10 @@ index 4756ef7..f83820e 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 323f873..49a7662 100644 +index 4b77a7d5a..b977c7b55 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -178,7 +178,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -182,7 +182,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) /* Fill the file path for the directory. */ d = (grub_efi_device_path_t *) ((char *) file_path + ((char *) d - (char *) dp)); @@ -113,7 +113,7 @@ index 323f873..49a7662 100644 copy_file_path ((grub_efi_file_path_device_path_t *) d, dir_start, dir_end - dir_start); -@@ -248,10 +247,9 @@ read_header (void *data, grub_efi_uint32_t size, +@@ -252,10 +251,9 @@ read_header (void *data, grub_efi_uint32_t size, grub_efi_status_t status; shim_lock = grub_efi_locate_protocol (&guid, NULL); @@ -125,7 +125,7 @@ index 323f873..49a7662 100644 return 0; } -@@ -276,7 +274,7 @@ read_header (void *data, grub_efi_uint32_t size, +@@ -280,7 +278,7 @@ read_header (void *data, grub_efi_uint32_t size, break; } @@ -134,7 +134,16 @@ index 323f873..49a7662 100644 } static void* -@@ -510,17 +508,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -381,7 +379,7 @@ relocate_coff (pe_coff_loader_image_context_t *context, + return GRUB_EFI_UNSUPPORTED; + } + +- adjust = (grub_uint64_t)data - context->image_address; ++ adjust = (grub_uint64_t)(grub_efi_uintn_t)data - context->image_address; + if (adjust == 0) + return GRUB_EFI_SUCCESS; + +@@ -514,17 +512,24 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_uint32_t section_alignment; grub_uint32_t buffer_size; int found_entry_point = 0; @@ -163,7 +172,25 @@ index 323f873..49a7662 100644 } /* -@@ -793,9 +798,55 @@ grub_secureboot_chainloader_unload (void) +@@ -547,7 +552,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) + section_alignment = 4096; + + buffer_size = context.image_size + section_alignment; +- grub_dprintf ("chain", "image size is %08lx, datasize is %08x\n", ++ grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", + context.image_size, datasize); + + efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, +@@ -580,7 +585,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) + + char *reloc_base, *reloc_base_end; + grub_dprintf ("chain", "reloc_dir: %p reloc_size: 0x%08x\n", +- (void *)(unsigned long long)context.reloc_dir->rva, ++ (void *)(unsigned long)context.reloc_dir->rva, + context.reloc_dir->size); + reloc_base = image_address (buffer_aligned, context.image_size, + context.reloc_dir->rva); +@@ -797,9 +802,55 @@ grub_secureboot_chainloader_unload (void) } static grub_err_t @@ -211,16 +238,16 @@ index 323f873..49a7662 100644 { - handle_image ((void *)address, fsize); + int rc; -+ rc = handle_image ((void *)address, fsize); ++ rc = handle_image ((void *)(unsigned long)address, fsize); + if (rc == 0) + { -+ grub_load_and_start_image((void *)address); ++ grub_load_and_start_image((void *)(unsigned long)address); + } + grub_loader_unset (); return grub_errno; } -@@ -809,9 +860,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -813,9 +864,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_efi_boot_services_t *b; grub_device_t dev = 0; grub_efi_device_path_t *dp = 0; @@ -231,7 +258,7 @@ index 323f873..49a7662 100644 if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -898,9 +949,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -902,9 +953,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (! file_path) goto fail; @@ -241,12 +268,12 @@ index 323f873..49a7662 100644 fsize = grub_file_size (file); if (!fsize) { -@@ -975,51 +1023,28 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -979,51 +1027,27 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #endif - if (grub_linuxefi_secure_validate((void *)address, fsize)) -+ rc = grub_linuxefi_secure_validate((void *)address, fsize); ++ rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize); + grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc); + if (rc > 0) { @@ -291,19 +318,19 @@ index 323f873..49a7662 100644 } grub_file_close (file); - grub_device_close (dev); - +- grub_device_close (dev); +- - grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); - return 0; - - fail: -- + +fail: if (dev) grub_device_close (dev); diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index aea378a..8890bdf 100644 +index aea378adf..8890bdf05 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,21 +33,24 @@ struct grub_efi_shim_lock @@ -337,7 +364,7 @@ index aea378a..8890bdf 100644 typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 7ccf32d..82f75b7 100644 +index 7ccf32d9d..82f75b7f3 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -155,6 +155,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -369,7 +396,7 @@ index 7ccf32d..82f75b7 100644 goto fail; } diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index d9ede36..0033d93 100644 +index d9ede3677..0033d9305 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,7 +22,7 @@ @@ -382,5 +409,5 @@ index d9ede36..0033d93 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, -- -2.9.3 +2.13.0 diff --git a/0084-linuxefi-fix-double-free-on-verification-failure.patch b/0147-linuxefi-fix-double-free-on-verification-failure.patch similarity index 77% rename from 0084-linuxefi-fix-double-free-on-verification-failure.patch rename to 0147-linuxefi-fix-double-free-on-verification-failure.patch index e7837333..cdb081f8 100644 --- a/0084-linuxefi-fix-double-free-on-verification-failure.patch +++ b/0147-linuxefi-fix-double-free-on-verification-failure.patch @@ -1,7 +1,7 @@ -From 0a3a4d0b69b5d68f3e4b6b74fe2e6b5d4dcace4f Mon Sep 17 00:00:00 2001 +From c21e7bf4849c24803d84ee1b59c5fba001381ac9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 14 Jun 2016 09:50:25 -0400 -Subject: [PATCH 84/90] linuxefi: fix double free on verification failure. +Subject: [PATCH 147/176] linuxefi: fix double free on verification failure. Signed-off-by: Peter Jones --- @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 82f75b7..010bf98 100644 +index 82f75b7f3..010bf982d 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -191,7 +191,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -21,5 +21,5 @@ index 82f75b7..010bf98 100644 } -- -2.9.3 +2.13.0 diff --git a/0085-fix-machine-type-test-in-30_os-prober.in.patch b/0148-fix-machine-type-test-in-30_os-prober.in.patch similarity index 75% rename from 0085-fix-machine-type-test-in-30_os-prober.in.patch rename to 0148-fix-machine-type-test-in-30_os-prober.in.patch index fa2b4358..a498a847 100644 --- a/0085-fix-machine-type-test-in-30_os-prober.in.patch +++ b/0148-fix-machine-type-test-in-30_os-prober.in.patch @@ -1,7 +1,7 @@ -From be4d338b0c086e9cbbd2d353cd88abad67c000c9 Mon Sep 17 00:00:00 2001 +From c75c918940b77108007e86e47e16b9a0fbcfdf5d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 11 Jul 2016 13:36:45 -0400 -Subject: [PATCH 85/90] fix machine type test in 30_os-prober.in +Subject: [PATCH 148/176] fix machine type test in 30_os-prober.in Signed-off-by: Peter Jones --- @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index dc98eac..e40274f 100644 +index dc98eace9..e40274fc0 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -144,6 +144,7 @@ for OS in ${OSPROBED} ; do @@ -21,5 +21,5 @@ index dc98eac..e40274f 100644 i?86|x86_64) sixteenbit="16" -- -2.9.3 +2.13.0 diff --git a/0089-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch b/0149-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch similarity index 84% rename from 0089-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch rename to 0149-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch index 05d297aa..255bfee2 100644 --- a/0089-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch +++ b/0149-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch @@ -1,7 +1,7 @@ -From 54d9b46779dab340984dde1077c4f2b685caf0b1 Mon Sep 17 00:00:00 2001 +From 79688d11f84464be361d3621de2af0ffd243f155 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 21 Nov 2016 15:34:00 +0100 -Subject: [PATCH 89/90] efi/chainloader: fix wrong sanity check in +Subject: [PATCH 149/176] efi/chainloader: fix wrong sanity check in relocate_coff() In relocate_coff(), the relocation entries are parsed from the original @@ -22,10 +22,10 @@ Tested-by: Juan Orti 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 49a7662..1bd7ffb 100644 +index b977c7b55..d5ab21d09 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -397,7 +397,7 @@ relocate_coff (pe_coff_loader_image_context_t *context, +@@ -401,7 +401,7 @@ relocate_coff (pe_coff_loader_image_context_t *context, reloc_end = (struct grub_pe32_fixup_block *) ((char *)reloc_base + reloc_base->size); @@ -35,5 +35,5 @@ index 49a7662..1bd7ffb 100644 grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc entry %d overflows binary", n); -- -2.9.3 +2.13.0 diff --git a/0090-efi-chainloader-truncate-overlong-relocation-section.patch b/0150-efi-chainloader-truncate-overlong-relocation-section.patch similarity index 93% rename from 0090-efi-chainloader-truncate-overlong-relocation-section.patch rename to 0150-efi-chainloader-truncate-overlong-relocation-section.patch index 372c069f..a5d93bc4 100644 --- a/0090-efi-chainloader-truncate-overlong-relocation-section.patch +++ b/0150-efi-chainloader-truncate-overlong-relocation-section.patch @@ -1,7 +1,7 @@ -From e85054f3b65bdb2afe2a71062f8145d9fef63051 Mon Sep 17 00:00:00 2001 +From d5e6b94ac802afdbccb9736dc9f0797498ed23e0 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 23 Nov 2016 06:27:09 +0100 -Subject: [PATCH 90/90] efi/chainloader: truncate overlong relocation section +Subject: [PATCH 150/176] efi/chainloader: truncate overlong relocation section The UEFI Windows 7 boot loader ("EFI/Microsoft/Boot/bootmgfw.efi", SHA1 31b410e029bba87d2068c65a80b88882f9f8ea25) has inconsistent headers. @@ -63,10 +63,10 @@ Signed-off-by: Laszlo Ersek 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 1bd7ffb..70c95ee 100644 +index d5ab21d09..7826e794a 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -592,7 +592,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -596,7 +596,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "reloc_base: %p reloc_base_end: %p\n", reloc_base, reloc_base_end); @@ -75,7 +75,7 @@ index 1bd7ffb..70c95ee 100644 section = context.first_section; for (i = 0; i < context.number_of_sections; i++, section++) -@@ -641,12 +641,28 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -645,12 +645,28 @@ handle_image (void *data, grub_efi_uint32_t datasize) * made sense, and the VA and size match RelocDir's * versions, then we believe in this section table. */ if (section->raw_data_size && section->virtual_size && @@ -109,5 +109,5 @@ index 1bd7ffb..70c95ee 100644 grub_dprintf ("chain", " section is not reloc section?\n"); grub_dprintf ("chain", " rds: 0x%08x, vs: %08x\n", -- -2.9.3 +2.13.0 diff --git a/0151-linuxefi-minor-cleanups.patch b/0151-linuxefi-minor-cleanups.patch new file mode 100644 index 00000000..7a9e9fcc --- /dev/null +++ b/0151-linuxefi-minor-cleanups.patch @@ -0,0 +1,89 @@ +From dd103ed061623c80e3e096a436ddaa394bad0f7d Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 14 Feb 2017 16:31:52 -0500 +Subject: [PATCH 151/176] linuxefi: minor cleanups + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 010bf982d..8b5a817b9 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -61,13 +61,18 @@ grub_linuxefi_unload (void) + grub_dl_unref (my_mod); + loaded = 0; + if (initrd_mem) +- grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, ++ BYTES_TO_PAGES(params->ramdisk_size)); + if (linux_cmdline) +- grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) ++ linux_cmdline, ++ BYTES_TO_PAGES(params->cmdline_size + 1)); + if (kernel_mem) +- grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, ++ BYTES_TO_PAGES(kernel_size)); + if (params) +- grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, ++ BYTES_TO_PAGES(16384)); + return GRUB_ERR_NONE; + } + +@@ -115,7 +120,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + } + + params->ramdisk_size = size; +- params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem; ++ params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem; + + ptr = initrd_mem; + +@@ -142,7 +147,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + grub_free (files); + + if (initrd_mem && grub_errno) +- grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(size)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, ++ BYTES_TO_PAGES(size)); + + return grub_errno; + } +@@ -244,7 +250,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + linux_cmdline + sizeof (LINUX_IMAGE) - 1, + lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); + +- lh.cmd_line_ptr = (grub_uint32_t)(grub_uint64_t)linux_cmdline; ++ lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + + handover_offset = lh.handover_offset; + +@@ -288,13 +294,17 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + + if (linux_cmdline && !loaded) +- grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) ++ linux_cmdline, ++ BYTES_TO_PAGES(lh.cmdline_size + 1)); + + if (kernel_mem && !loaded) +- grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, ++ BYTES_TO_PAGES(kernel_size)); + + if (params && !loaded) +- grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, ++ BYTES_TO_PAGES(16384)); + + return grub_errno; + } +-- +2.13.0 + diff --git a/0152-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0152-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch new file mode 100644 index 00000000..65a6d955 --- /dev/null +++ b/0152-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -0,0 +1,278 @@ +From ef26601128cbad8ab1be459a1d6c94c87fab6663 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 14 Feb 2017 16:18:54 -0500 +Subject: [PATCH 152/176] Handle multi-arch (64-on-32) boot in linuxefi loader. + +Allow booting 64-bit kernels on 32-bit EFI on x86. + +Signed-off-by: Peter Jones +--- + grub-core/loader/efi/linux.c | 9 ++- + grub-core/loader/i386/efi/linux.c | 114 +++++++++++++++++++++++++++----------- + include/grub/i386/linux.h | 7 ++- + 3 files changed, 95 insertions(+), 35 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 8890bdf05..2a7024134 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -56,12 +56,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) + typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); + + grub_err_t +-grub_efi_linux_boot (void *kernel_addr, grub_off_t offset, ++grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, + void *kernel_params) + { + handover_func hf; ++ int offset = 0; + +- hf = (handover_func)((char *)kernel_addr + offset); ++#ifdef __x86_64__ ++ offset = 512; ++#endif ++ ++ hf = (handover_func)((char *)kernel_addr + handover_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + + return GRUB_ERR_BUG; +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 8b5a817b9..ed8cc40a0 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -44,14 +44,10 @@ static char *linux_cmdline; + static grub_err_t + grub_linuxefi_boot (void) + { +- int offset = 0; +- +-#ifdef __x86_64__ +- offset = 512; +-#endif + asm volatile ("cli"); + +- return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset, ++ return grub_efi_linux_boot ((char *)kernel_mem, ++ handover_offset, + params); + } + +@@ -119,6 +115,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + ++ grub_dprintf ("linuxefi", "initrd_mem = %lx\n", (unsigned long) initrd_mem); ++ + params->ramdisk_size = size; + params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem; + +@@ -153,14 +151,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + } + ++#define MIN(a, b) \ ++ ({ typeof (a) _a = (a); \ ++ typeof (b) _b = (b); \ ++ _a < _b ? _a : _b; }) ++ + static grub_err_t + grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + int argc, char *argv[]) + { + grub_file_t file = 0; +- struct linux_kernel_header lh; ++ struct linux_kernel_header *lh; + grub_ssize_t len, start, filelen; + void *kernel = NULL; ++ int setup_header_end_offset; + int rc; + + grub_dl_ref (my_mod); +@@ -200,69 +204,107 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384)); +- ++ params = grub_efi_allocate_pages_max (0x3fffffff, ++ BYTES_TO_PAGES(sizeof(*params))); + if (! params) + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters"); + goto fail; + } + +- grub_memset (params, 0, 16384); +- +- grub_memcpy (&lh, kernel, sizeof (lh)); +- +- if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)) ++ grub_dprintf ("linuxefi", "params = %p\n", (unsigned long) params); ++ ++ grub_memset (params, 0, sizeof(*params)); ++ ++ setup_header_end_offset = *((grub_uint8_t *)kernel + 0x201); ++ grub_dprintf ("linuxefi", "copying %d bytes from %p to %p\n", ++ MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1, ++ (grub_uint8_t *)kernel + 0x1f1, ++ (grub_uint8_t *)params + 0x1f1); ++ grub_memcpy ((grub_uint8_t *)params + 0x1f1, ++ (grub_uint8_t *)kernel + 0x1f1, ++ MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1); ++ lh = (struct linux_kernel_header *)params; ++ grub_dprintf ("linuxefi", "lh is at %p\n", lh); ++ grub_dprintf ("linuxefi", "checking lh->boot_flag\n"); ++ if (lh->boot_flag != grub_cpu_to_le16 (0xaa55)) + { + grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number")); + goto fail; + } + +- if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS) ++ grub_dprintf ("linuxefi", "checking lh->setup_sects\n"); ++ if (lh->setup_sects > GRUB_LINUX_MAX_SETUP_SECTS) + { + grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors")); + goto fail; + } + +- if (lh.version < grub_cpu_to_le16 (0x020b)) ++ grub_dprintf ("linuxefi", "checking lh->version\n"); ++ if (lh->version < grub_cpu_to_le16 (0x020b)) + { + grub_error (GRUB_ERR_BAD_OS, N_("kernel too old")); + goto fail; + } + +- if (!lh.handover_offset) ++ grub_dprintf ("linuxefi", "checking lh->handover_offset\n"); ++ if (!lh->handover_offset) + { + grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover")); + goto fail; + } + +- linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff, +- BYTES_TO_PAGES(lh.cmdline_size + 1)); ++#if defined(__x86_64__) || defined(__aarch64__) ++ grub_dprintf ("linuxefi", "checking lh->xloadflags\n"); ++ if (!(lh->xloadflags & LINUX_XLF_KERNEL_64)) ++ { ++ grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support 64-bit CPUs")); ++ goto fail; ++ } ++#endif ++ ++#if defined(__i386__) ++ if ((lh->xloadflags & LINUX_XLF_KERNEL_64) && ++ !(lh->xloadflags & LINUX_XLF_EFI_HANDOVER_32)) ++ { ++ grub_error (GRUB_ERR_BAD_OS, ++ N_("kernel doesn't support 32-bit handover")); ++ goto fail; ++ } ++#endif + ++ grub_dprintf ("linuxefi", "setting up cmdline\n"); ++ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff, ++ BYTES_TO_PAGES(lh->cmdline_size + 1)); + if (!linux_cmdline) + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline")); + goto fail; + } + ++ grub_dprintf ("linuxefi", "linux_cmdline = %lx\n", ++ (unsigned long)linux_cmdline); ++ + grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); + grub_create_loader_cmdline (argc, argv, + linux_cmdline + sizeof (LINUX_IMAGE) - 1, +- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); ++ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1)); + +- lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; ++ grub_dprintf ("linuxefi", "setting lh->cmd_line_ptr\n"); ++ lh->cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + +- handover_offset = lh.handover_offset; ++ grub_dprintf ("linuxefi", "computing handover offset\n"); ++ handover_offset = lh->handover_offset; + +- start = (lh.setup_sects + 1) * 512; ++ start = (lh->setup_sects + 1) * 512; + len = grub_file_size(file) - start; + +- kernel_mem = grub_efi_allocate_pages(lh.pref_address, +- BYTES_TO_PAGES(lh.init_size)); ++ kernel_mem = grub_efi_allocate_pages(lh->pref_address, ++ BYTES_TO_PAGES(lh->init_size)); + + if (!kernel_mem) + kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, +- BYTES_TO_PAGES(lh.init_size)); ++ BYTES_TO_PAGES(lh->init_size)); + + if (!kernel_mem) + { +@@ -270,17 +312,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- grub_memcpy (kernel_mem, (char *)kernel + start, len); ++ grub_dprintf ("linuxefi", "kernel_mem = %lx\n", (unsigned long) kernel_mem); ++ + grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0); + loaded=1; ++ grub_dprintf ("linuxefi", "setting lh->code32_start to %p\n", kernel_mem); ++ lh->code32_start = (grub_uint32_t)(grub_addr_t) kernel_mem; + +- lh.code32_start = (grub_uint32_t)(grub_uint64_t) kernel_mem; +- grub_memcpy (params, &lh, 2 * 512); ++ grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); + +- params->type_of_loader = 0x21; ++ grub_dprintf ("linuxefi", "setting lh->type_of_loader\n"); ++ lh->type_of_loader = 0x6; + +- fail: ++ grub_dprintf ("linuxefi", "setting lh->ext_loader_{type,ver}\n"); ++ params->ext_loader_type = 0; ++ params->ext_loader_ver = 2; ++ grub_dprintf("linuxefi", "kernel_mem: %p handover_offset: %08x\n", ++ kernel_mem, handover_offset); + ++ fail: + if (file) + grub_file_close (file); + +@@ -296,7 +346,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + if (linux_cmdline && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) + linux_cmdline, +- BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ BYTES_TO_PAGES(lh->cmdline_size + 1)); + + if (kernel_mem && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, +diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h +index fc36bdaf3..110ecf806 100644 +--- a/include/grub/i386/linux.h ++++ b/include/grub/i386/linux.h +@@ -130,7 +130,12 @@ struct linux_kernel_header + grub_uint32_t kernel_alignment; + grub_uint8_t relocatable; + grub_uint8_t min_alignment; +- grub_uint8_t pad[2]; ++#define LINUX_XLF_KERNEL_64 (1<<0) ++#define LINUX_XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) ++#define LINUX_XLF_EFI_HANDOVER_32 (1<<2) ++#define LINUX_XLF_EFI_HANDOVER_64 (1<<3) ++#define LINUX_XLF_EFI_KEXEC (1<<4) ++ grub_uint16_t xloadflags; + grub_uint32_t cmdline_size; + grub_uint32_t hardware_subarch; + grub_uint64_t hardware_subarch_data; +-- +2.13.0 + diff --git a/0153-Fix-up-linux-params-usage.patch b/0153-Fix-up-linux-params-usage.patch new file mode 100644 index 00000000..913f00ff --- /dev/null +++ b/0153-Fix-up-linux-params-usage.patch @@ -0,0 +1,43 @@ +From 7b93d18488f665386de3c61678664952bd0ca017 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 30 May 2017 14:16:07 -0400 +Subject: [PATCH 153/176] Fix up linux params usage... + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/linux.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index e4b8342f5..c9e89310b 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -680,6 +680,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + { + grub_file_t file = 0; + struct linux_kernel_header lh; ++ grub_uint8_t *linux_params_ptr; + grub_uint8_t setup_sects; + grub_size_t real_size, prot_size, prot_file_size, kernel_offset; + grub_ssize_t len; +@@ -811,6 +812,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + preferred_address)) + goto fail; + ++ + grub_memset (&linux_params, 0, sizeof (linux_params)); + grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1); + +@@ -820,7 +822,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + len = sizeof (linux_params) - sizeof (lh); + +- grub_memcpy (&linux_params + sizeof (lh), kernel + kernel_offset, len); ++ linux_params_ptr = (void *)&linux_params; ++ grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len); + kernel_offset += len; + + linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; +-- +2.13.0 + diff --git a/0154-Make-exit-take-a-return-code.patch b/0154-Make-exit-take-a-return-code.patch new file mode 100644 index 00000000..ade9633f --- /dev/null +++ b/0154-Make-exit-take-a-return-code.patch @@ -0,0 +1,56 @@ +From b20b77a7aa8e538f501ac082eca2ea73c6a5407f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 26 Feb 2014 21:49:12 -0500 +Subject: [PATCH 154/176] Make "exit" take a return code. + +This adds "exit" with a return code. With this patch, any "exit" +command /may/ include a return code, and on platforms that support +returning with an exit status, we will do so. By default we return the +same exit status we did before this patch. + +Signed-off-by: Peter Jones +--- + grub-core/kern/emu/main.c | 6 ++++++ + grub-core/kern/misc.c | 9 +++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c +index 55ea5a11c..7e47ec812 100644 +--- a/grub-core/kern/emu/main.c ++++ b/grub-core/kern/emu/main.c +@@ -73,6 +73,12 @@ grub_exit (int retval __attribute__((unused))) + } + + void ++grub_exit (int retval __attribute__((unused))) ++{ ++ grub_reboot (); ++} ++ ++void + grub_machine_init (void) + { + } +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 5ce89a40c..04371ac49 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -1120,6 +1120,15 @@ grub_abort (void) + grub_exit (1); + } + ++#if defined (__clang__) && !defined (GRUB_UTIL) ++/* clang emits references to abort(). */ ++void __attribute__ ((noreturn)) ++abort (void) ++{ ++ grub_abort (); ++} ++#endif ++ + void + grub_fatal (const char *fmt, ...) + { +-- +2.13.0 + diff --git a/0155-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch b/0155-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch new file mode 100644 index 00000000..badb2367 --- /dev/null +++ b/0155-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch @@ -0,0 +1,45 @@ +From 46835789f3f7458f976d8ee61f49e391a0380c4b Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Mon, 17 Apr 2017 08:44:29 -0400 +Subject: [PATCH 155/176] arm64: make sure fdt has #address-cells and + #size-cells properties + +Recent upstream changes to kexec-tools relies on #address-cells +and #size-cells properties in the FDT. If grub2 needs to create +a chosen node, it is likely because firmware did not provide one. +In that case, set #address-cells and #size-cells properties to +make sure they exist. +--- + grub-core/loader/arm64/linux.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index f83820e61..f32151f3b 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -81,7 +81,21 @@ finalize_params_linux (void) + + node = grub_fdt_find_subnode (fdt, 0, "chosen"); + if (node < 0) +- node = grub_fdt_add_subnode (fdt, 0, "chosen"); ++ { ++ /* ++ * If we have to create a chosen node, Make sure we ++ * have #address-cells and #size-cells properties. ++ */ ++ retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2); ++ if (retval) ++ goto failure; ++ ++ retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2); ++ if (retval) ++ goto failure; ++ ++ node = grub_fdt_add_subnode (fdt, 0, "chosen"); ++ } + + if (node < 1) + goto failure; +-- +2.13.0 + diff --git a/0156-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch b/0156-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch new file mode 100644 index 00000000..ca98e7a8 --- /dev/null +++ b/0156-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch @@ -0,0 +1,44 @@ +From cce1963c761c3b6ca4e40a0001eaf9d596cf8ed2 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 9 May 2016 14:15:17 -0400 +Subject: [PATCH 156/176] Add some grub_dprintf() in the secure boot verify + code. + +Signed-off-by: Peter Jones +--- + grub-core/loader/efi/linux.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 2a7024134..7fe7201a3 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -43,12 +43,22 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) + shim_lock = grub_efi_locate_protocol(&guid, NULL); + grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock); + if (!shim_lock) +- return 0; ++ { ++ grub_dprintf ("secureboot", "shim not available\n"); ++ return 0; ++ } + +- status = shim_lock->verify(data, size); ++ grub_dprintf ("secureboot", "Asking shim to verify kernel signature\n"); ++ status = shim_lock->verify (data, size); + grub_dprintf ("secureboot", "shim_lock->verify(): %ld\n", status); + if (status == GRUB_EFI_SUCCESS) +- return 1; ++ { ++ grub_dprintf ("secureboot", "Kernel signature verification passed\n"); ++ return 1; ++ } ++ ++ grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n", ++ (unsigned long) status); + + return -1; + } +-- +2.13.0 + diff --git a/0157-Make-our-info-pages-say-grub2-where-appropriate.patch b/0157-Make-our-info-pages-say-grub2-where-appropriate.patch new file mode 100644 index 00000000..795015d2 --- /dev/null +++ b/0157-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -0,0 +1,1016 @@ +From 7b3e61770e309e80a84f69db6deba700dcde6c46 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 6 May 2016 18:43:08 -0400 +Subject: [PATCH 157/176] Make our info pages say "grub2" where appropriate. + +This needs to be hooked up to --program-transform=, but I haven't had +time. + +Signed-off-by: Peter Jones +--- + docs/grub-dev.texi | 4 +- + docs/grub.texi | 318 ++++++++++++++++++++++++++--------------------------- + 2 files changed, 161 insertions(+), 161 deletions(-) + +diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi +index a9f4de631..3ce827ab7 100644 +--- a/docs/grub-dev.texi ++++ b/docs/grub-dev.texi +@@ -1,7 +1,7 @@ + \input texinfo + @c -*-texinfo-*- + @c %**start of header +-@setfilename grub-dev.info ++@setfilename grub2-dev.info + @include version-dev.texi + @settitle GNU GRUB Developers Manual @value{VERSION} + @c Unify all our little indices for now. +@@ -32,7 +32,7 @@ Invariant Sections. + + @dircategory Kernel + @direntry +-* grub-dev: (grub-dev). The GRand Unified Bootloader Dev ++* grub2-dev: (grub2-dev). The GRand Unified Bootloader Dev + @end direntry + + @setchapternewpage odd +diff --git a/docs/grub.texi b/docs/grub.texi +index 15a90b26e..f28c4cd52 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -1,7 +1,7 @@ + \input texinfo + @c -*-texinfo-*- + @c %**start of header +-@setfilename grub.info ++@setfilename grub2.info + @include version.texi + @settitle GNU GRUB Manual @value{VERSION} + @c Unify all our little indices for now. +@@ -32,15 +32,15 @@ Invariant Sections. + + @dircategory Kernel + @direntry +-* GRUB: (grub). The GRand Unified Bootloader +-* grub-install: (grub)Invoking grub-install. Install GRUB on your drive +-* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration +-* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2. +-* grub-mkrelpath: (grub)Invoking grub-mkrelpath. +-* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image +-* grub-mount: (grub)Invoking grub-mount. Mount a file system using GRUB +-* grub-probe: (grub)Invoking grub-probe. Probe device information +-* grub-script-check: (grub)Invoking grub-script-check. ++* GRUB2: (grub2). The GRand Unified Bootloader ++* grub2-install: (grub2)Invoking grub2-install. Install GRUB on your drive ++* grub2-mkconfig: (grub2)Invoking grub2-mkconfig. Generate GRUB configuration ++* grub2-mkpasswd-pbkdf2: (grub2)Invoking grub2-mkpasswd-pbkdf2. ++* grub2-mkrelpath: (grub2)Invoking grub2-mkrelpath. ++* grub2-mkrescue: (grub2)Invoking grub2-mkrescue. Make a GRUB rescue image ++* grub2-mount: (grub2)Invoking grub2-mount. Mount a file system using GRUB ++* grub2-probe: (grub2)Invoking grub2-probe. Probe device information ++* grub2-script-check: (grub2)Invoking grub2-script-check. + @end direntry + + @setchapternewpage odd +@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}. + * Platform-specific operations:: Platform-specific operations + * Supported kernels:: The list of supported kernels + * Troubleshooting:: Error messages produced by GRUB +-* Invoking grub-install:: How to use the GRUB installer +-* Invoking grub-mkconfig:: Generate a GRUB configuration file +-* Invoking grub-mkpasswd-pbkdf2:: ++* Invoking grub2-install:: How to use the GRUB installer ++* Invoking grub2-mkconfig:: Generate a GRUB configuration file ++* Invoking grub2-mkpasswd-pbkdf2:: + Generate GRUB password hashes +-* Invoking grub-mkrelpath:: Make system path relative to its root +-* Invoking grub-mkrescue:: Make a GRUB rescue image +-* Invoking grub-mount:: Mount a file system using GRUB +-* Invoking grub-probe:: Probe device information for GRUB +-* Invoking grub-script-check:: Check GRUB script file for syntax errors ++* Invoking grub2-mkrelpath:: Make system path relative to its root ++* Invoking grub2-mkrescue:: Make a GRUB rescue image ++* Invoking grub2-mount:: Mount a file system using GRUB ++* Invoking grub2-probe:: Probe device information for GRUB ++* Invoking grub2-script-check:: Check GRUB script file for syntax errors + * Obtaining and Building GRUB:: How to obtain and build GRUB + * Reporting bugs:: Where you should send a bug report + * Future:: Some future plans on GRUB +@@ -230,7 +230,7 @@ surprising. + + @item + @file{grub.cfg} is typically automatically generated by +-@command{grub-mkconfig} (@pxref{Simple configuration}). This makes it ++@command{grub2-mkconfig} (@pxref{Simple configuration}). This makes it + easier to handle versioned kernel upgrades. + + @item +@@ -244,7 +244,7 @@ scripting language: variables, conditionals, and loops are available. + @item + A small amount of persistent storage is available across reboots, using the + @command{save_env} and @command{load_env} commands in GRUB and the +-@command{grub-editenv} utility. This is not available in all configurations ++@command{grub2-editenv} utility. This is not available in all configurations + (@pxref{Environment block}). + + @item +@@ -548,7 +548,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the + OS name. E.g. for GNU/Linux: + + @example +-# @kbd{grub-install /dev/sda} ++# @kbd{grub2-install /dev/sda} + @end example + + On AROS we use another syntax. For volumes: +@@ -571,7 +571,7 @@ For disks we use syntax: + E.g. + + @example +-# @kbd{grub-install //:ata.device/0/0} ++# @kbd{grub2-install //:ata.device/0/0} + @end example + + On Windows we use UNC path. For volumes it's typically +@@ -598,7 +598,7 @@ For disks it's + E.g. + + @example +-# @kbd{grub-install \\?\PhysicalDrive0} ++# @kbd{grub2-install \\?\PhysicalDrive0} + @end example + + Beware that you may need to further escape the backslashes depending on your +@@ -608,7 +608,7 @@ When compiled with cygwin support then cygwin drive names are automatically + when needed. E.g. + + @example +-# @kbd{grub-install /dev/sda} ++# @kbd{grub2-install /dev/sda} + @end example + + @node Installation +@@ -621,7 +621,7 @@ from the source tarball, or as a package for your OS. + + After you have done that, you need to install the boot loader on a + drive (floppy or hard disk) by using the utility +-@command{grub-install} (@pxref{Invoking grub-install}) on a UNIX-like OS. ++@command{grub2-install} (@pxref{Invoking grub2-install}) on a UNIX-like OS. + + GRUB comes with boot images, which are normally put in the directory + @file{/usr/lib/grub/-} (for BIOS-based machines +@@ -632,22 +632,22 @@ loader needs to find them (usually @file{/boot}) will be called + the @dfn{boot directory}. + + @menu +-* Installing GRUB using grub-install:: ++* Installing GRUB using grub2-install:: + * Making a GRUB bootable CD-ROM:: + * Device map:: + * BIOS installation:: + @end menu + + +-@node Installing GRUB using grub-install +-@section Installing GRUB using grub-install ++@node Installing GRUB using grub2-install ++@section Installing GRUB using grub2-install + + For information on where GRUB should be installed on PC BIOS platforms, + @pxref{BIOS installation}. + + In order to install GRUB under a UNIX-like OS (such +-as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking +-grub-install}) as the superuser (@dfn{root}). ++as @sc{gnu}), invoke the program @command{grub2-install} (@pxref{Invoking ++grub2-install}) as the superuser (@dfn{root}). + + The usage is basically very simple. You only need to specify one + argument to the program, namely, where to install the boot loader. The +@@ -656,13 +656,13 @@ For example, under Linux the following will install GRUB into the MBR + of the first IDE disk: + + @example +-# @kbd{grub-install /dev/sda} ++# @kbd{grub2-install /dev/sda} + @end example + + Likewise, under GNU/Hurd, this has the same effect: + + @example +-# @kbd{grub-install /dev/hd0} ++# @kbd{grub2-install /dev/hd0} + @end example + + But all the above examples assume that GRUB should put images under +@@ -676,7 +676,7 @@ boot floppy with a filesystem. Here is an example: + # @kbd{mke2fs /dev/fd0} + # @kbd{mount -t ext2 /dev/fd0 /mnt} + # @kbd{mkdir /mnt/boot} +-# @kbd{grub-install --boot-directory=/mnt/boot /dev/fd0} ++# @kbd{grub2-install --boot-directory=/mnt/boot /dev/fd0} + # @kbd{umount /mnt} + @end group + @end example +@@ -688,16 +688,16 @@ floppy instead of exposing the USB drive as a hard disk (they call it + @example + # @kbd{losetup /dev/loop0 /dev/sdb1} + # @kbd{mount /dev/loop0 /mnt/usb} +-# @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0} ++# @kbd{grub2-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0} + @end example + + This install doesn't conflict with standard install as long as they are in + separate directories. + +-Note that @command{grub-install} is actually just a shell script and the +-real task is done by other tools such as @command{grub-mkimage}. Therefore, ++Note that @command{grub2-install} is actually just a shell script and the ++real task is done by other tools such as @command{grub2-mkimage}. Therefore, + you may run those commands directly to install GRUB, without using +-@command{grub-install}. Don't do that, however, unless you are very familiar ++@command{grub2-install}. Don't do that, however, unless you are very familiar + with the internals of GRUB. Installing a boot loader on a running OS may be + extremely dangerous. + +@@ -705,20 +705,20 @@ On EFI systems for fixed disk install you have to mount EFI System Partition. + If you mount it at @file{/boot/efi} then you don't need any special arguments: + + @example +-# @kbd{grub-install} ++# @kbd{grub2-install} + @end example + + Otherwise you need to specify where your EFI System partition is mounted: + + @example +-# @kbd{grub-install --efi-directory=/mnt/efi} ++# @kbd{grub2-install --efi-directory=/mnt/efi} + @end example + + For removable installs you have to use @option{--removable} and specify both + @option{--boot-directory} and @option{--efi-directory}: + + @example +-# @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable} ++# @kbd{grub2-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable} + @end example + + @node Making a GRUB bootable CD-ROM +@@ -738,10 +738,10 @@ usually also need to include a configuration file @file{grub.cfg} and some + other GRUB modules. + + To make a simple generic GRUB rescue CD, you can use the +-@command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}): ++@command{grub2-mkrescue} program (@pxref{Invoking grub2-mkrescue}): + + @example +-$ @kbd{grub-mkrescue -o grub.iso} ++$ @kbd{grub2-mkrescue -o grub.iso} + @end example + + You will often need to include other files in your image. To do this, first +@@ -764,7 +764,7 @@ directory @file{iso/}. + Finally, make the image: + + @example +-$ @kbd{grub-mkrescue -o grub.iso iso} ++$ @kbd{grub2-mkrescue -o grub.iso iso} + @end example + + This produces a file named @file{grub.iso}, which then can be burned +@@ -780,7 +780,7 @@ storage devices. + @node Device map + @section The map between BIOS drives and OS devices + +-If the device map file exists, the GRUB utilities (@command{grub-probe}, ++If the device map file exists, the GRUB utilities (@command{grub2-probe}, + etc.) read it to map BIOS drives to OS devices. This file consists of lines + like this: + +@@ -1223,23 +1223,23 @@ need to write the whole thing by hand. + @node Simple configuration + @section Simple configuration handling + +-The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}) ++The program @command{grub2-mkconfig} (@pxref{Invoking grub2-mkconfig}) + generates @file{grub.cfg} files suitable for most cases. It is suitable for + use when upgrading a distribution, and will discover available kernels and + attempt to generate menu entries for them. + +-@command{grub-mkconfig} does have some limitations. While adding extra ++@command{grub2-mkconfig} does have some limitations. While adding extra + custom menu entries to the end of the list can be done by editing +-@file{/etc/grub.d/40_custom} or creating @file{/boot/grub/custom.cfg}, ++@file{/etc/grub.d/40_custom} or creating @file{/boot/grub2/custom.cfg}, + changing the order of menu entries or changing their titles may require + making complex changes to shell scripts stored in @file{/etc/grub.d/}. This + may be improved in the future. In the meantime, those who feel that it + would be easier to write @file{grub.cfg} directly are encouraged to do so + (@pxref{Booting}, and @ref{Shell-like scripting}), and to disable any system +-provided by their distribution to automatically run @command{grub-mkconfig}. ++provided by their distribution to automatically run @command{grub2-mkconfig}. + + The file @file{/etc/default/grub} controls the operation of +-@command{grub-mkconfig}. It is sourced by a shell script, and so must be ++@command{grub2-mkconfig}. It is sourced by a shell script, and so must be + valid POSIX shell input; normally, it will just be a sequence of + @samp{KEY=value} lines, but if the value contains spaces or other special + characters then it must be quoted. For example: +@@ -1277,7 +1277,7 @@ works it's not recommended since titles often contain unstable device names + and may be translated + + If you set this to @samp{saved}, then the default menu entry will be that +-saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}. This relies on ++saved by @samp{GRUB_SAVEDEFAULT} or @command{grub2-set-default}. This relies on + the environment block, which may not be available in all situations + (@pxref{Environment block}). + +@@ -1288,7 +1288,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save + it as a new default entry for use by future runs of GRUB. This is only + useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because + @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with +-@command{grub-set-default}. Unset by default. ++@command{grub2-set-default}. Unset by default. + This option relies on the environment block, which may not be available in + all situations (@pxref{Environment block}). + +@@ -1399,7 +1399,7 @@ The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX} + and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries. + + @item GRUB_DISABLE_LINUX_UUID +-Normally, @command{grub-mkconfig} will generate menu entries that use ++Normally, @command{grub2-mkconfig} will generate menu entries that use + universally-unique identifiers (UUIDs) to identify the root filesystem to + the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is + usually more reliable, but in some cases it may not be appropriate. To +@@ -1410,7 +1410,7 @@ If this option is set to @samp{true}, disable the generation of recovery + mode menu entries. + + @item GRUB_DISABLE_UUID +-Normally, @command{grub-mkconfig} will generate menu entries that use ++Normally, @command{grub2-mkconfig} will generate menu entries that use + universally-unique identifiers (UUIDs) to identify various filesystems to + search for files. This is usually more reliable, but in some cases it may + not be appropriate. To disable this use of UUIDs, set this option to +@@ -1419,12 +1419,12 @@ not be appropriate. To disable this use of UUIDs, set this option to + @item GRUB_VIDEO_BACKEND + If graphical video support is required, either because the @samp{gfxterm} + graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, +-then @command{grub-mkconfig} will normally load all available GRUB video ++then @command{grub2-mkconfig} will normally load all available GRUB video + drivers and use the one most appropriate for your hardware. If you need to + override this for some reason, then you can set this option. + +-After @command{grub-install} has been run, the available video drivers are +-listed in @file{/boot/grub/video.lst}. ++After @command{grub2-install} has been run, the available video drivers are ++listed in @file{/boot/grub2/video.lst}. + + @item GRUB_GFXMODE + Set the resolution used on the @samp{gfxterm} graphical terminal. Note that +@@ -1456,7 +1456,7 @@ boot sequence. If you have problems, set this option to @samp{text} and + GRUB will tell Linux to boot in normal text mode. + + @item GRUB_DISABLE_OS_PROBER +-Normally, @command{grub-mkconfig} will try to use the external ++Normally, @command{grub2-mkconfig} will try to use the external + @command{os-prober} program, if installed, to discover other operating + systems installed on the same system and generate appropriate menu entries + for them. Set this option to @samp{true} to disable this. +@@ -1466,7 +1466,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober + output. For efi chainloaders it's @@ + + @item GRUB_DISABLE_SUBMENU +-Normally, @command{grub-mkconfig} will generate top level menu entry for ++Normally, @command{grub2-mkconfig} will generate top level menu entry for + the kernel with highest version number and put all other found kernels + or alternative menu entries for recovery mode in submenu. For entries returned + by @command{os-prober} first entry will be put on top level and all others +@@ -1474,11 +1474,11 @@ in submenu. If this option is set to @samp{y}, flat menu with all entries + on top level will be generated instead. Changing this option will require + changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback}) + and @samp{default} (@pxref{default}) environment variables as well as saved +-default entry using @command{grub-set-default} and value used with +-@command{grub-reboot}. ++default entry using @command{grub2-set-default} and value used with ++@command{grub2-reboot}. + + @item GRUB_ENABLE_CRYPTODISK +-If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will ++If set to @samp{y}, @command{grub2-mkconfig} and @command{grub2-install} will + check for encrypted disks and generate additional commands needed to access + them during boot. Note that in this case unattended boot is not possible + because GRUB will wait for passphrase to unlock encrypted container. +@@ -1537,7 +1537,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or + + @end table + +-For more detailed customisation of @command{grub-mkconfig}'s output, you may ++For more detailed customisation of @command{grub2-mkconfig}'s output, you may + edit the scripts in @file{/etc/grub.d} directly. + @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom + menu entries; simply type the menu entries you want to add at the end of +@@ -1752,7 +1752,7 @@ images as well. + Mount this partition on/mnt/boot and disable GRUB in all OSes and manually + install self-compiled latest GRUB with: + +-@code{grub-install --boot-directory=/mnt/boot /dev/sda} ++@code{grub2-install --boot-directory=/mnt/boot /dev/sda} + + In all the OSes install GRUB tools but disable installing GRUB in bootsector, + so you'll have menu.lst and grub.cfg available for use. Also disable os-prober +@@ -1762,20 +1762,20 @@ use by setting: + + in /etc/default/grub + +-Then write a grub.cfg (/mnt/boot/grub/grub.cfg): ++Then write a grub.cfg (/mnt/boot/grub2/grub.cfg): + + @example + + menuentry "OS using grub2" @{ + insmod xfs + search --set=root --label OS1 --hint hd0,msdos8 +- configfile /boot/grub/grub.cfg ++ configfile /boot/grub2/grub.cfg + @} + + menuentry "OS using grub2-legacy" @{ + insmod ext2 + search --set=root --label OS2 --hint hd0,msdos6 +- legacy_configfile /boot/grub/menu.lst ++ legacy_configfile /boot/grub2/menu.lst + @} + + menuentry "Windows XP" @{ +@@ -1838,15 +1838,15 @@ GRUB supports embedding a configuration file directly into the core image, + so that it is loaded before entering normal mode. This is useful, for + example, when it is not straightforward to find the real configuration file, + or when you need to debug problems with loading that file. +-@command{grub-install} uses this feature when it is not using BIOS disk ++@command{grub2-install} uses this feature when it is not using BIOS disk + functions or when installing to a different disk from the one containing + @file{/boot/grub}, in which case it needs to use the @command{search} + command (@pxref{search}) to find @file{/boot/grub}. + + To embed a configuration file, use the @option{-c} option to +-@command{grub-mkimage}. The file is copied into the core image, so it may ++@command{grub2-mkimage}. The file is copied into the core image, so it may + reside anywhere on the file system, and may be removed after running +-@command{grub-mkimage}. ++@command{grub2-mkimage}. + + After the embedded configuration file (if any) is executed, GRUB will load + the @samp{normal} module (@pxref{normal}), which will then read the real +@@ -1881,13 +1881,13 @@ included in the core image: + @example + @group + search.fs_label grub root +-if [ -e /boot/grub/example/test1.cfg ]; then ++if [ -e /boot/grub2/example/test1.cfg ]; then + set prefix=($root)/boot/grub +- configfile /boot/grub/example/test1.cfg ++ configfile /boot/grub2/example/test1.cfg + else +- if [ -e /boot/grub/example/test2.cfg ]; then ++ if [ -e /boot/grub2/example/test2.cfg ]; then + set prefix=($root)/boot/grub +- configfile /boot/grub/example/test2.cfg ++ configfile /boot/grub2/example/test2.cfg + else + echo "Could not find an example configuration file!" + fi +@@ -2411,7 +2411,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 + @end group + @end example + +-Then follow instructions printed out by grub-mknetdir on configuring your DHCP ++Then follow instructions printed out by grub2-mknetdir on configuring your DHCP + server. + + The grub.cfg file is placed in the same directory as the path output by +@@ -2596,7 +2596,7 @@ team are: + @end table + + To take full advantage of this function, install GRUB into the MBR +-(@pxref{Installing GRUB using grub-install}). ++(@pxref{Installing GRUB using grub2-install}). + + If you have a laptop which has a similar feature and not in the above list + could you figure your address and contribute? +@@ -2657,7 +2657,7 @@ bytes. + The sole function of @file{boot.img} is to read the first sector of the core + image from a local disk and jump to it. Because of the size restriction, + @file{boot.img} cannot understand any file system structure, so +-@command{grub-install} hardcodes the location of the first sector of the ++@command{grub2-install} hardcodes the location of the first sector of the + core image into @file{boot.img} when installing GRUB. + + @item diskboot.img +@@ -2687,7 +2687,7 @@ images. + + @item core.img + This is the core image of GRUB. It is built dynamically from the kernel +-image and an arbitrary list of modules by the @command{grub-mkimage} ++image and an arbitrary list of modules by the @command{grub2-mkimage} + program. Usually, it contains enough modules to access @file{/boot/grub}, + and loads everything else (including menu handling, the ability to load + target operating systems, and so on) from the file system at run-time. The +@@ -2739,7 +2739,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from + In GRUB 2, images for booting from CD-ROM drives are now constructed using + @file{cdboot.img} and @file{core.img}, making sure that the core image + contains the @samp{iso9660} module. It is usually best to use the +-@command{grub-mkrescue} program for this. ++@command{grub2-mkrescue} program for this. + + @item nbgrub + There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by +@@ -2895,8 +2895,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by + + An absolute file name resembles a Unix absolute file name, using + @samp{/} for the directory separator (not @samp{\} as in DOS). One +-example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file +-@file{/boot/grub/grub.cfg} in the first partition of the first hard ++example is @samp{(hd0,1)/boot/grub2/grub.cfg}. This means the file ++@file{/boot/grub2/grub.cfg} in the first partition of the first hard + disk. If you omit the device name in an absolute file name, GRUB uses + GRUB's @dfn{root device} implicitly. So if you set the root device to, + say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}), +@@ -2904,8 +2904,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. + + On ZFS filesystem the first path component must be + @var{volume}@samp{@@}[@var{snapshot}]. +-So @samp{/rootvol@@snap-129/boot/grub/grub.cfg} refers to file +-@samp{/boot/grub/grub.cfg} in snapshot of volume @samp{rootvol} with name ++So @samp{/rootvol@@snap-129/boot/grub2/grub.cfg} refers to file ++@samp{/boot/grub2/grub.cfg} in snapshot of volume @samp{rootvol} with name + @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if + snapshot name is omitted. + +@@ -3308,7 +3308,7 @@ The more recent release of Minix would then be identified as + @samp{other>minix>minix-3.4.0}. + + This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple +-configuration}), @command{grub-set-default}, or @command{grub-reboot}. ++configuration}), @command{grub2-set-default}, or @command{grub2-reboot}. + + + @node fallback +@@ -3398,7 +3398,7 @@ If this variable is set, it names the language code that the + example, French would be named as @samp{fr}, and Simplified Chinese as + @samp{zh_CN}. + +-@command{grub-mkconfig} (@pxref{Simple configuration}) will try to set a ++@command{grub2-mkconfig} (@pxref{Simple configuration}) will try to set a + reasonable default for this variable based on the system locale. + + +@@ -3406,10 +3406,10 @@ reasonable default for this variable based on the system locale. + @subsection locale_dir + + If this variable is set, it names the directory where translation files may +-be found (@pxref{gettext}), usually @file{/boot/grub/locale}. Otherwise, ++be found (@pxref{gettext}), usually @file{/boot/grub2/locale}. Otherwise, + internationalization is disabled. + +-@command{grub-mkconfig} (@pxref{Simple configuration}) will set a reasonable ++@command{grub2-mkconfig} (@pxref{Simple configuration}) will set a reasonable + default for this variable if internationalization is needed and any + translation files are available. + +@@ -3527,7 +3527,7 @@ input. The default is not to pause output. + + The location of the @samp{/boot/grub} directory as an absolute file name + (@pxref{File name syntax}). This is normally set by GRUB at startup based +-on information provided by @command{grub-install}. GRUB modules are ++on information provided by @command{grub2-install}. GRUB modules are + dynamically loaded from this directory, so it must be set correctly in order + for many parts of GRUB to work. + +@@ -3618,17 +3618,17 @@ GRUB provides an ``environment block'' which can be used to save a small + amount of state. + + The environment block is a preallocated 1024-byte file, which normally lives +-in @file{/boot/grub/grubenv} (although you should not assume this). At boot ++in @file{/boot/grub2/grubenv} (although you should not assume this). At boot + time, the @command{load_env} command (@pxref{load_env}) loads environment + variables from it, and the @command{save_env} (@pxref{save_env}) command + saves environment variables to it. From a running system, the +-@command{grub-editenv} utility can be used to edit the environment block. ++@command{grub2-editenv} utility can be used to edit the environment block. + + For safety reasons, this storage is only available when installed on a plain + disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and + using BIOS or EFI functions (no ATA, USB or IEEE1275). + +-@command{grub-mkconfig} uses this facility to implement ++@command{grub2-mkconfig} uses this facility to implement + @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). + + +@@ -4317,7 +4317,7 @@ Translate @var{string} into the current language. + + The current language code is stored in the @samp{lang} variable in GRUB's + environment (@pxref{lang}). Translation files in MO format are read from +-@samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub/locale}. ++@samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub2/locale}. + @end deffn + + +@@ -4712,7 +4712,7 @@ Define a user named @var{user} with password @var{clear-password}. + + @deffn Command password_pbkdf2 user hashed-password + Define a user named @var{user} with password hash @var{hashed-password}. +-Use @command{grub-mkpasswd-pbkdf2} (@pxref{Invoking grub-mkpasswd-pbkdf2}) ++Use @command{grub2-mkpasswd-pbkdf2} (@pxref{Invoking grub2-mkpasswd-pbkdf2}) + to generate password hashes. @xref{Security}. + @end deffn + +@@ -5535,8 +5535,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} + which has an associated password. @samp{password} sets the password in + plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} + sets the password hashed using the Password-Based Key Derivation Function +-(RFC 2898), requiring the use of @command{grub-mkpasswd-pbkdf2} +-(@pxref{Invoking grub-mkpasswd-pbkdf2}) to generate password hashes. ++(RFC 2898), requiring the use of @command{grub2-mkpasswd-pbkdf2} ++(@pxref{Invoking grub2-mkpasswd-pbkdf2}) to generate password hashes. + + In order to enable authentication support, the @samp{superusers} environment + variable must be set to a list of usernames, separated by any of spaces, +@@ -5580,7 +5580,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ + @end group + @end example + +-The @command{grub-mkconfig} program does not yet have built-in support for ++The @command{grub2-mkconfig} program does not yet have built-in support for + generating configuration files with authentication. You can use + @file{/etc/grub.d/40_custom} to add simple superuser authentication, by + adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} +@@ -5605,15 +5605,15 @@ verified with a public key currently trusted by GRUB + validation fails, then file @file{foo} cannot be opened. This failure + may halt or otherwise impact the boot process. + +-@comment Unfortunately --pubkey is not yet supported by grub-install, +-@comment but we should not bring up internal detail grub-mkimage here ++@comment Unfortunately --pubkey is not yet supported by grub2-install, ++@comment but we should not bring up internal detail grub2-mkimage here + @comment in the user guide (as opposed to developer's manual). + + @comment An initial trusted public key can be embedded within the GRUB + @comment @file{core.img} using the @code{--pubkey} option to +-@comment @command{grub-mkimage} (@pxref{Invoking grub-install}). Presently it +-@comment is necessary to write a custom wrapper around @command{grub-mkimage} +-@comment using the @code{--grub-mkimage} flag to @command{grub-install}. ++@comment @command{grub2-mkimage} (@pxref{Invoking grub2-install}). Presently it ++@comment is necessary to write a custom wrapper around @command{grub2-mkimage} ++@comment using the @code{--grub-mkimage} flag to @command{grub2-install}. + + GRUB uses GPG-style detached signatures (meaning that a file + @file{foo.sig} will be produced when file @file{foo} is signed), and +@@ -5633,8 +5633,8 @@ gpg --detach-sign /path/to/file + For successful validation of all of GRUB's subcomponents and the + loaded OS kernel, they must all be signed. One way to accomplish this + is the following (after having already produced the desired +-@file{grub.cfg} file, e.g., by running @command{grub-mkconfig} +-(@pxref{Invoking grub-mkconfig}): ++@file{grub.cfg} file, e.g., by running @command{grub2-mkconfig} ++(@pxref{Invoking grub2-mkconfig}): + + @example + @group +@@ -5656,7 +5656,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, + Note that internally signature enforcement is controlled by setting + the environment variable @code{check_signatures} equal to + @code{enforce}. Passing one or more @code{--pubkey} options to +-@command{grub-mkimage} implicitly defines @code{check_signatures} ++@command{grub2-mkimage} implicitly defines @code{check_signatures} + equal to @code{enforce} in @file{core.img} prior to processing any + configuration files. + +@@ -6013,10 +6013,10 @@ Required files are: + + GRUB's normal start-up procedure involves setting the @samp{prefix} + environment variable to a value set in the core image by +-@command{grub-install}, setting the @samp{root} variable to match, loading ++@command{grub2-install}, setting the @samp{root} variable to match, loading + the @samp{normal} module from the prefix, and running the @samp{normal} + command (@pxref{normal}). This command is responsible for reading +-@file{/boot/grub/grub.cfg}, running the menu, and doing all the useful ++@file{/boot/grub2/grub.cfg}, running the menu, and doing all the useful + things GRUB is supposed to do. + + If, instead, you only get a rescue shell, this usually means that GRUB +@@ -6042,8 +6042,8 @@ normal + + However, any problem that leaves you in the rescue shell probably means that + GRUB was not correctly installed. It may be more useful to try to reinstall +-it properly using @kbd{grub-install @var{device}} (@pxref{Invoking +-grub-install}). When doing this, there are a few things to remember: ++it properly using @kbd{grub2-install @var{device}} (@pxref{Invoking ++grub2-install}). When doing this, there are a few things to remember: + + @itemize @bullet{} + @item +@@ -6055,7 +6055,7 @@ is usually better to use UUIDs or file system labels and avoid depending on + drive ordering entirely. + + @item +-At least on BIOS systems, if you tell @command{grub-install} to install GRUB ++At least on BIOS systems, if you tell @command{grub2-install} to install GRUB + to a partition but GRUB has already been installed in the master boot + record, then the GRUB installation in the partition will be ignored. + +@@ -6075,21 +6075,21 @@ support has not yet been added to GRUB. + @end itemize + + +-@node Invoking grub-install +-@chapter Invoking grub-install ++@node Invoking grub2-install ++@chapter Invoking grub2-install + +-The program @command{grub-install} generates a GRUB core image using +-@command{grub-mkimage} and installs it on your system. You must specify the ++The program @command{grub2-install} generates a GRUB core image using ++@command{grub2-mkimage} and installs it on your system. You must specify the + device name on which you want to install GRUB, like this: + + @example +-grub-install @var{install_device} ++grub2-install @var{install_device} + @end example + + The device name @var{install_device} is an OS device name or a GRUB + device name. + +-@command{grub-install} accepts the following options: ++@command{grub2-install} accepts the following options: + + @table @option + @item --help +@@ -6105,13 +6105,13 @@ separate partition or a removable disk. + If this option is not specified then it defaults to @file{/boot}, so + + @example +-@kbd{grub-install /dev/sda} ++@kbd{grub2-install /dev/sda} + @end example + + is equivalent to + + @example +-@kbd{grub-install --boot-directory=/boot/ /dev/sda} ++@kbd{grub2-install --boot-directory=/boot/ /dev/sda} + @end example + + Here is an example in which you have a separate @dfn{boot} partition which is +@@ -6119,16 +6119,16 @@ mounted on + @file{/mnt/boot}: + + @example +-@kbd{grub-install --boot-directory=/mnt/boot /dev/sdb} ++@kbd{grub2-install --boot-directory=/mnt/boot /dev/sdb} + @end example + + @item --recheck +-Recheck the device map, even if @file{/boot/grub/device.map} already ++Recheck the device map, even if @file{/boot/grub2/device.map} already + exists. You should use this option whenever you add/remove a disk + into/from your computer. + + @item --no-rs-codes +-By default on x86 BIOS systems, @command{grub-install} will use some ++By default on x86 BIOS systems, @command{grub2-install} will use some + extra space in the bootloader embedding area for Reed-Solomon + error-correcting codes. This enables GRUB to still boot successfully + if some blocks are corrupted. The exact amount of protection offered +@@ -6141,17 +6141,17 @@ installation}) where GRUB does not reside in any unpartitioned space + outside of the MBR. Disable the Reed-Solomon codes with this option. + @end table + +-@node Invoking grub-mkconfig +-@chapter Invoking grub-mkconfig ++@node Invoking grub2-mkconfig ++@chapter Invoking grub2-mkconfig + +-The program @command{grub-mkconfig} generates a configuration file for GRUB ++The program @command{grub2-mkconfig} generates a configuration file for GRUB + (@pxref{Simple configuration}). + + @example +-grub-mkconfig -o /boot/grub/grub.cfg ++grub-mkconfig -o /boot/grub2/grub.cfg + @end example + +-@command{grub-mkconfig} accepts the following options: ++@command{grub2-mkconfig} accepts the following options: + + @table @option + @item --help +@@ -6167,17 +6167,17 @@ it to standard output. + @end table + + +-@node Invoking grub-mkpasswd-pbkdf2 +-@chapter Invoking grub-mkpasswd-pbkdf2 ++@node Invoking grub2-mkpasswd-pbkdf2 ++@chapter Invoking grub2-mkpasswd-pbkdf2 + +-The program @command{grub-mkpasswd-pbkdf2} generates password hashes for ++The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for + GRUB (@pxref{Security}). + + @example + grub-mkpasswd-pbkdf2 + @end example + +-@command{grub-mkpasswd-pbkdf2} accepts the following options: ++@command{grub2-mkpasswd-pbkdf2} accepts the following options: + + @table @option + @item -c @var{number} +@@ -6195,23 +6195,23 @@ Length of the salt. Defaults to 64. + @end table + + +-@node Invoking grub-mkrelpath +-@chapter Invoking grub-mkrelpath ++@node Invoking grub2-mkrelpath ++@chapter Invoking grub2-mkrelpath + +-The program @command{grub-mkrelpath} makes a file system path relative to ++The program @command{grub2-mkrelpath} makes a file system path relative to + the root of its containing file system. For instance, if @file{/usr} is a + mount point, then: + + @example +-$ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2} ++$ @kbd{grub2-mkrelpath /usr/share/grub/unicode.pf2} + @samp{/share/grub/unicode.pf2} + @end example + + This is mainly used internally by other GRUB utilities such as +-@command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may ++@command{grub2-mkconfig} (@pxref{Invoking grub2-mkconfig}), but may + occasionally also be useful for debugging. + +-@command{grub-mkrelpath} accepts the following options: ++@command{grub2-mkrelpath} accepts the following options: + + @table @option + @item --help +@@ -6222,17 +6222,17 @@ Print the version number of GRUB and exit. + @end table + + +-@node Invoking grub-mkrescue +-@chapter Invoking grub-mkrescue ++@node Invoking grub2-mkrescue ++@chapter Invoking grub2-mkrescue + +-The program @command{grub-mkrescue} generates a bootable GRUB rescue image ++The program @command{grub2-mkrescue} generates a bootable GRUB rescue image + (@pxref{Making a GRUB bootable CD-ROM}). + + @example + grub-mkrescue -o grub.iso + @end example + +-All arguments not explicitly listed as @command{grub-mkrescue} options are ++All arguments not explicitly listed as @command{grub2-mkrescue} options are + passed on directly to @command{xorriso} in @command{mkisofs} emulation mode. + Options passed to @command{xorriso} will normally be interpreted as + @command{mkisofs} options; if the option @samp{--} is used, then anything +@@ -6247,7 +6247,7 @@ mkdir -p disk/boot/grub + grub-mkrescue -o grub.iso disk + @end example + +-@command{grub-mkrescue} accepts the following options: ++@command{grub2-mkrescue} accepts the following options: + + @table @option + @item --help +@@ -6275,15 +6275,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in + default. + + @item --grub-mkimage=@var{file} +-Use @var{file} as the @command{grub-mkimage} program, rather than the ++Use @var{file} as the @command{grub2-mkimage} program, rather than the + built-in default. + @end table + + +-@node Invoking grub-mount +-@chapter Invoking grub-mount ++@node Invoking grub2-mount ++@chapter Invoking grub2-mount + +-The program @command{grub-mount} performs a read-only mount of any file ++The program @command{grub2-mount} performs a read-only mount of any file + system or file system image that GRUB understands, using GRUB's file system + drivers via FUSE. (It is only available if FUSE development files were + present when GRUB was built.) This has a number of uses: +@@ -6315,13 +6315,13 @@ even if nobody has yet written a FUSE module specifically for that file + system type. + @end itemize + +-Using @command{grub-mount} is normally as simple as: ++Using @command{grub2-mount} is normally as simple as: + + @example + grub-mount /dev/sda1 /mnt + @end example + +-@command{grub-mount} must be given one or more images and a mount point as ++@command{grub2-mount} must be given one or more images and a mount point as + non-option arguments (if it is given more than one image, it will treat them + as a RAID set), and also accepts the following options: + +@@ -6343,13 +6343,13 @@ Show debugging output for conditions matching @var{string}. + @item -K prompt|@var{file} + @itemx --zfs-key=prompt|@var{file} + Load a ZFS encryption key. If you use @samp{prompt} as the argument, +-@command{grub-mount} will read a passphrase from the terminal; otherwise, it ++@command{grub2-mount} will read a passphrase from the terminal; otherwise, it + will read key material from the specified file. + + @item -r @var{device} + @itemx --root=@var{device} + Set the GRUB root device to @var{device}. You do not normally need to set +-this; @command{grub-mount} will automatically set the root device to the ++this; @command{grub2-mount} will automatically set the root device to the + root of the supplied file system. + + If @var{device} is just a number, then it will be treated as a partition +@@ -6367,10 +6367,10 @@ Print verbose messages. + @end table + + +-@node Invoking grub-probe +-@chapter Invoking grub-probe ++@node Invoking grub2-probe ++@chapter Invoking grub2-probe + +-The program @command{grub-probe} probes device information for a given path ++The program @command{grub2-probe} probes device information for a given path + or device. + + @example +@@ -6378,7 +6378,7 @@ grub-probe --target=fs /boot/grub + grub-probe --target=drive --device /dev/sda1 + @end example + +-@command{grub-probe} must be given a path or device as a non-option ++@command{grub2-probe} must be given a path or device as a non-option + argument, and also accepts the following options: + + @table @option +@@ -6391,16 +6391,16 @@ Print the version number of GRUB and exit. + @item -d + @itemx --device + If this option is given, then the non-option argument is a system device +-name (such as @samp{/dev/sda1}), and @command{grub-probe} will print ++name (such as @samp{/dev/sda1}), and @command{grub2-probe} will print + information about that device. If it is not given, then the non-option + argument is a filesystem path (such as @samp{/boot/grub}), and +-@command{grub-probe} will print information about the device containing that ++@command{grub2-probe} will print information about the device containing that + part of the filesystem. + + @item -m @var{file} + @itemx --device-map=@var{file} + Use @var{file} as the device map (@pxref{Device map}) rather than the +-default, usually @samp{/boot/grub/device.map}. ++default, usually @samp{/boot/grub2/device.map}. + + @item -t @var{target} + @itemx --target=@var{target} +@@ -6453,19 +6453,19 @@ Print verbose messages. + @end table + + +-@node Invoking grub-script-check +-@chapter Invoking grub-script-check ++@node Invoking grub2-script-check ++@chapter Invoking grub2-script-check + +-The program @command{grub-script-check} takes a GRUB script file ++The program @command{grub2-script-check} takes a GRUB script file + (@pxref{Shell-like scripting}) and checks it for syntax errors, similar to + commands such as @command{sh -n}. It may take a @var{path} as a non-option + argument; if none is supplied, it will read from standard input. + + @example +-grub-script-check /boot/grub/grub.cfg ++grub-script-check /boot/grub2/grub.cfg + @end example + +-@command{grub-script-check} accepts the following options: ++@command{grub2-script-check} accepts the following options: + + @table @option + @item --help +-- +2.13.0 + diff --git a/0158-print-more-debug-info-in-our-module-loader.patch b/0158-print-more-debug-info-in-our-module-loader.patch new file mode 100644 index 00000000..f64d3155 --- /dev/null +++ b/0158-print-more-debug-info-in-our-module-loader.patch @@ -0,0 +1,44 @@ +From 76cdf466430b1ee462f72f7e6e9cb8d717d11b7b Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 1 May 2017 11:19:40 -0400 +Subject: [PATCH 158/176] print more debug info in our module loader. + +Signed-off-by: Peter Jones +--- + grub-core/kern/efi/efi.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 684ca93f8..1f3ac5e1d 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -304,13 +304,23 @@ grub_efi_modules_addr (void) + } + + if (i == coff_header->num_sections) +- return 0; ++ { ++ grub_dprintf("sections", "section %d is last section; invalid.\n", i); ++ return 0; ++ } + + info = (struct grub_module_info *) ((char *) image->image_base + + section->virtual_address); +- if (info->magic != GRUB_MODULE_MAGIC) +- return 0; ++ if (section->name[0] != '.' && info->magic != GRUB_MODULE_MAGIC) ++ { ++ grub_dprintf("sections", ++ "section %d has bad magic %08lx, should be %08lx\n", ++ i, info->magic, GRUB_MODULE_MAGIC); ++ return 0; ++ } + ++ grub_dprintf("sections", "returning section info for section %d: \"%s\"\n", ++ i, section->name); + return (grub_addr_t) info; + } + +-- +2.13.0 + diff --git a/0159-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0159-macos-just-build-chainloader-entries-don-t-try-any-x.patch new file mode 100644 index 00000000..7e7383d5 --- /dev/null +++ b/0159-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -0,0 +1,128 @@ +From d4b4a2dfd552c7018699752fcb9a0d07008b73df Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 24 May 2017 12:42:32 -0400 +Subject: [PATCH 159/176] macos: just build chainloader entries, don't try any + xnu xnu. + +Since our bugs tell us that the xnu boot entries really just don't work +most of the time, and they create piles of extra boot entries, because +they can't quite figure out 32-vs-64 and other stuff like that. + +It's rediculous, and we should just boot their bootloader through the +chainloader instead. + +So this patch does that. + +Resolves: rhbz#893179 + +Signed-off-by: Peter Jones +--- + util/grub.d/30_os-prober.in | 78 +++++++++++---------------------------------- + 1 file changed, 18 insertions(+), 60 deletions(-) + +diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index e40274fc0..d979de198 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then + fi + + osx_entry() { +- if [ x$2 = x32 ]; then +- # TRANSLATORS: it refers to kernel architecture (32-bit) +- bitstr="$(gettext "(32-bit)")" +- else +- # TRANSLATORS: it refers to kernel architecture (64-bit) +- bitstr="$(gettext "(64-bit)")" +- fi + # TRANSLATORS: it refers on the OS residing on device %s + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" +- cat << EOF +-menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' { ++ hints="" ++ for hint in `"${grub_probe}" --device ${device} --target=efi_hints 2> /dev/null` ; do ++ hints="${hints} --hint=${hint}" ++ done ++ cat << EOF ++menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' { + EOF + save_default_entry | grub_add_tab + prepare_grub_to_access_device ${DEVICE} | grub_add_tab + cat << EOF ++ set gfxpayload=keep + load_video +- set do_resume=0 +- if [ /var/vm/sleepimage -nt10 / ]; then +- if xnu_resume /var/vm/sleepimage; then +- set do_resume=1 +- fi +- fi +- if [ \$do_resume = 0 ]; then +- xnu_uuid ${OSXUUID} uuid +- if [ -f /Extra/DSDT.aml ]; then +- acpi -e /Extra/DSDT.aml +- fi +- if [ /kernelcache -nt /System/Library/Extensions ]; then +- $1 /kernelcache boot-uuid=\${uuid} rd=*uuid +- elif [ -f /System/Library/Kernels/kernel ]; then +- $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid +- xnu_kextdir /System/Library/Extensions +- else +- $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid +- if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then +- xnu_mkext /System/Library/Extensions.mkext +- else +- xnu_kextdir /System/Library/Extensions +- fi +- fi +- if [ -f /Extra/Extensions.mkext ]; then +- xnu_mkext /Extra/Extensions.mkext +- fi +- if [ -d /Extra/Extensions ]; then +- xnu_kextdir /Extra/Extensions +- fi +- if [ -f /Extra/devprop.bin ]; then +- xnu_devprop_load /Extra/devprop.bin +- fi +- if [ -f /Extra/splash.jpg ]; then +- insmod jpeg +- xnu_splash /Extra/splash.jpg +- fi +- if [ -f /Extra/splash.png ]; then +- insmod png +- xnu_splash /Extra/splash.png +- fi +- if [ -f /Extra/splash.tga ]; then +- insmod tga +- xnu_splash /Extra/splash.tga +- fi +- fi ++ insmod part_gpt ++ insmod hfsplus ++ search --no-floppy --fs-uuid --set=root ${hints} $(grub_get_device_id "${DEVICE}") ++ chainloader (\$root)/System/Library/CoreServices/boot.efi ++ boot + } + EOF + } +@@ -307,11 +264,12 @@ EOF + echo "$title_correction_code" + ;; + macosx) +- if [ "${UUID}" ]; then +- OSXUUID="${UUID}" +- osx_entry xnu_kernel 32 +- osx_entry xnu_kernel64 64 +- fi ++ for subdevice in ${DEVICE%[[:digit:]]*}* ; do ++ parttype="`"${grub_probe}" --device ${device} --target=gpt_parttype "${subdevice}" 2> /dev/null`" ++ if [[ "$parttype" = "426f6f74-0000-11aa-aa11-00306543ecac" ]]; then ++ DEVICE="${subdevice}" osx_entry ++ fi ++ done + ;; + hurd) + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" +-- +2.13.0 + diff --git a/0160-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0160-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch new file mode 100644 index 00000000..c973bf6a --- /dev/null +++ b/0160-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -0,0 +1,701 @@ +From 99ec1217cff2d73237eb36512e36a37dfee1175b Mon Sep 17 00:00:00 2001 +From: Jeff Mahoney +Date: Wed, 18 Dec 2013 09:57:04 +0000 +Subject: [PATCH 160/176] grub2/btrfs: Add ability to boot from subvolumes + +This patch adds the ability to specify a different root on a btrfs +filesystem too boot from other than the default one. + +btrfs-list-snapshots will list the subvolumes available on the +filesystem. + +set btrfs_subvol= and set btrfs_subvolid= will specify +which subvolume to use and any pathnames provided with either of those +variables set will start using that root. If the subvolume or subvolume id +doesn't exist, then an error case will result. + +It is possible to boot into a separate GRUB instance by exporting the +variable and loading the config file from the subvolume. + +Signed-off-by: Jeff Mahoney +--- + grub-core/fs/btrfs.c | 548 +++++++++++++++++++++++++++++++++++++++++++++++++-- + include/grub/btrfs.h | 1 + + 2 files changed, 531 insertions(+), 18 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 4849c1ceb..38facf3cb 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -29,6 +29,9 @@ + #include + #include + #include ++#include ++#include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -64,9 +67,11 @@ struct grub_btrfs_superblock + grub_uint64_t generation; + grub_uint64_t root_tree; + grub_uint64_t chunk_tree; +- grub_uint8_t dummy2[0x20]; ++ grub_uint8_t dummy2[0x18]; ++ grub_uint64_t bytes_used; + grub_uint64_t root_dir_objectid; +- grub_uint8_t dummy3[0x41]; ++ grub_uint64_t num_devices; ++ grub_uint8_t dummy3[0x39]; + struct grub_btrfs_device this_device; + char label[0x100]; + grub_uint8_t dummy4[0x100]; +@@ -105,6 +110,7 @@ struct grub_btrfs_data + grub_uint64_t exttree; + grub_size_t extsize; + struct grub_btrfs_extent_data *extent; ++ grub_uint64_t fs_tree; + }; + + struct grub_btrfs_chunk_item +@@ -171,6 +177,14 @@ struct grub_btrfs_leaf_descriptor + } *data; + }; + ++struct grub_btrfs_root_ref ++{ ++ grub_uint64_t dirid; ++ grub_uint64_t sequence; ++ grub_uint16_t name_len; ++ const char name[0]; ++} __attribute__ ((packed)); ++ + struct grub_btrfs_time + { + grub_int64_t sec; +@@ -215,6 +229,14 @@ struct grub_btrfs_extent_data + + #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 + ++#define GRUB_BTRFS_ROOT_TREE_OBJECTID 1ULL ++#define GRUB_BTRFS_FS_TREE_OBJECTID 5ULL ++#define GRUB_BTRFS_ROOT_REF_KEY 156 ++#define GRUB_BTRFS_ROOT_ITEM_KEY 132 ++ ++static grub_uint64_t btrfs_default_subvolid = 0; ++static char *btrfs_default_subvol = NULL; ++ + static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, + 256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2 + }; +@@ -837,6 +859,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + return GRUB_ERR_NONE; + } + ++static grub_err_t ++get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, ++ grub_uint64_t objectid, grub_uint64_t offset, ++ grub_uint64_t *fs_root); ++ ++static grub_err_t ++lookup_root_by_id(struct grub_btrfs_data *data, grub_uint64_t id) ++{ ++ grub_err_t err; ++ grub_uint64_t tree; ++ ++ err = get_fs_root(data, data->sblock.root_tree, id, -1, &tree); ++ if (!err) ++ data->fs_tree = tree; ++ return err; ++} ++ ++static grub_err_t ++find_path (struct grub_btrfs_data *data, ++ const char *path, struct grub_btrfs_key *key, ++ grub_uint64_t *tree, grub_uint8_t *type); ++ ++static grub_err_t ++lookup_root_by_name(struct grub_btrfs_data *data, const char *path) ++{ ++ grub_err_t err; ++ grub_uint64_t tree = 0; ++ grub_uint8_t type; ++ struct grub_btrfs_key key; ++ ++ err = find_path (data, path, &key, &tree, &type); ++ if (err) ++ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); ++ ++ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) ++ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path); ++ ++ data->fs_tree = tree; ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused))) ++{ ++ if (btrfs_default_subvol) ++ return lookup_root_by_name(data, btrfs_default_subvol); ++ ++ if (btrfs_default_subvolid) ++ return lookup_root_by_id(data, btrfs_default_subvolid); ++ ++ data->fs_tree = 0; ++ ++ return GRUB_ERR_NONE; ++} ++ ++ + static struct grub_btrfs_data * + grub_btrfs_mount (grub_device_t dev) + { +@@ -872,6 +950,13 @@ grub_btrfs_mount (grub_device_t dev) + data->devices_attached[0].dev = dev; + data->devices_attached[0].id = data->sblock.this_device.device_id; + ++ err = btrfs_handle_subvol (data); ++ if (err) ++ { ++ grub_free (data); ++ return NULL; ++ } ++ + return data; + } + +@@ -1233,6 +1318,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, + } + + static grub_err_t ++find_pathname(struct grub_btrfs_data *data, grub_uint64_t objectid, ++ grub_uint64_t fs_root, const char *name, char **pathname) ++{ ++ grub_err_t err; ++ struct grub_btrfs_key key = { ++ .object_id = objectid, ++ .type = GRUB_BTRFS_ITEM_TYPE_INODE_REF, ++ .offset = 0, ++ }; ++ struct grub_btrfs_key key_out; ++ struct grub_btrfs_leaf_descriptor desc; ++ char *p = grub_strdup (name); ++ grub_disk_addr_t elemaddr; ++ grub_size_t elemsize; ++ grub_size_t alloc = grub_strlen(name) + 1; ++ ++ err = lower_bound(data, &key, &key_out, fs_root, ++ &elemaddr, &elemsize, &desc, 0); ++ if (err) ++ return grub_error(err, "lower_bound caught %d\n", err); ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) ++ next(data, &desc, &elemaddr, &elemsize, &key_out); ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) ++ { ++ return grub_error(GRUB_ERR_FILE_NOT_FOUND, ++ "Can't find inode ref for {%"PRIuGRUB_UINT64_T ++ ", %u, %"PRIuGRUB_UINT64_T"} %"PRIuGRUB_UINT64_T ++ "/%"PRIuGRUB_SIZE"\n", ++ key_out.object_id, key_out.type, ++ key_out.offset, elemaddr, elemsize); ++ } ++ ++ ++ while (key_out.type == GRUB_BTRFS_ITEM_TYPE_INODE_REF && ++ key_out.object_id != key_out.offset) { ++ struct grub_btrfs_inode_ref *inode_ref; ++ char *new; ++ ++ inode_ref = grub_malloc(elemsize + 1); ++ if (!inode_ref) ++ return grub_error(GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't allocate memory for inode_ref (%"PRIuGRUB_SIZE")\n", elemsize); ++ ++ err = grub_btrfs_read_logical(data, elemaddr, inode_ref, elemsize, 0); ++ if (err) ++ return grub_error(err, "read_logical caught %d\n", err); ++ ++ alloc += grub_le_to_cpu16 (inode_ref->n) + 2; ++ new = grub_malloc(alloc); ++ if (!new) ++ return grub_error(GRUB_ERR_OUT_OF_MEMORY, ++ "couldn't allocate memory for name (%"PRIuGRUB_SIZE")\n", alloc); ++ ++ grub_memcpy(new, inode_ref->name, grub_le_to_cpu16 (inode_ref->n)); ++ if (p) ++ { ++ new[grub_le_to_cpu16 (inode_ref->n)] = '/'; ++ grub_strcpy (new + grub_le_to_cpu16 (inode_ref->n) + 1, p); ++ grub_free(p); ++ } ++ else ++ new[grub_le_to_cpu16 (inode_ref->n)] = 0; ++ grub_free(inode_ref); ++ ++ p = new; ++ ++ key.object_id = key_out.offset; ++ ++ err = lower_bound(data, &key, &key_out, fs_root, &elemaddr, ++ &elemsize, &desc, 0); ++ if (err) ++ return grub_error(err, "lower_bound caught %d\n", err); ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) ++ next(data, &desc, &elemaddr, &elemsize, &key_out); ++ ++ } ++ ++ *pathname = p; ++ return 0; ++} ++ ++static grub_err_t + find_path (struct grub_btrfs_data *data, + const char *path, struct grub_btrfs_key *key, + grub_uint64_t *tree, grub_uint8_t *type) +@@ -1250,14 +1420,26 @@ find_path (struct grub_btrfs_data *data, + char *origpath = NULL; + unsigned symlinks_max = 32; + +- err = get_root (data, key, tree, type); +- if (err) +- return err; +- + origpath = grub_strdup (path); + if (!origpath) + return grub_errno; + ++ if (data->fs_tree) ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->fs_tree; ++ /* This is a tree root, so everything starts at objectid 256 */ ++ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ } ++ else ++ { ++ err = get_root (data, key, tree, type); ++ if (err) ++ return err; ++ } ++ + while (1) + { + while (path[0] == '/') +@@ -1430,9 +1612,21 @@ find_path (struct grub_btrfs_data *data, + path = path_alloc = tmp; + if (path[0] == '/') + { +- err = get_root (data, key, tree, type); +- if (err) +- return err; ++ if (data->fs_tree) ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->fs_tree; ++ /* This is a tree root, so everything starts at objectid 256 */ ++ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ } ++ else ++ { ++ err = get_root (data, key, tree, type); ++ if (err) ++ return err; ++ } + } + continue; + } +@@ -1673,6 +1867,20 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) + data->tree, file->offset, buf, len); + } + ++static char * ++btrfs_unparse_uuid(struct grub_btrfs_data *data) ++{ ++ return grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", ++ grub_be_to_cpu16 (data->sblock.uuid[0]), ++ grub_be_to_cpu16 (data->sblock.uuid[1]), ++ grub_be_to_cpu16 (data->sblock.uuid[2]), ++ grub_be_to_cpu16 (data->sblock.uuid[3]), ++ grub_be_to_cpu16 (data->sblock.uuid[4]), ++ grub_be_to_cpu16 (data->sblock.uuid[5]), ++ grub_be_to_cpu16 (data->sblock.uuid[6]), ++ grub_be_to_cpu16 (data->sblock.uuid[7])); ++} ++ + static grub_err_t + grub_btrfs_uuid (grub_device_t device, char **uuid) + { +@@ -1684,15 +1892,7 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) + if (!data) + return grub_errno; + +- *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", +- grub_be_to_cpu16 (data->sblock.uuid[0]), +- grub_be_to_cpu16 (data->sblock.uuid[1]), +- grub_be_to_cpu16 (data->sblock.uuid[2]), +- grub_be_to_cpu16 (data->sblock.uuid[3]), +- grub_be_to_cpu16 (data->sblock.uuid[4]), +- grub_be_to_cpu16 (data->sblock.uuid[5]), +- grub_be_to_cpu16 (data->sblock.uuid[6]), +- grub_be_to_cpu16 (data->sblock.uuid[7])); ++ *uuid = btrfs_unparse_uuid(data); + + grub_btrfs_unmount (data); + +@@ -1749,6 +1949,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), + } + #endif + ++static grub_err_t ++grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, ++ char **argv) ++{ ++ grub_device_t dev; ++ char *devname; ++ struct grub_btrfs_data *data; ++ char *uuid; ++ ++ if (argc < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); ++ ++ devname = grub_file_get_device_name(argv[0]); ++ ++ if (!devname) ++ return grub_errno; ++ ++ dev = grub_device_open (devname); ++ grub_free (devname); ++ if (!dev) ++ return grub_errno; ++ ++ data = grub_btrfs_mount (dev); ++ if (!data) ++ { ++ grub_device_close(dev); ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs"); ++ } ++ ++ if (data->sblock.label) ++ grub_printf("Label: '%s' ", data->sblock.label); ++ else ++ grub_printf("Label: none "); ++ ++ uuid = btrfs_unparse_uuid(data); ++ ++ grub_printf(" uuid: %s\n\tTotal devices %" PRIuGRUB_UINT64_T ++ " FS bytes used %" PRIuGRUB_UINT64_T "\n", ++ uuid, grub_cpu_to_le64(data->sblock.num_devices), ++ grub_cpu_to_le64(data->sblock.bytes_used)); ++ ++ grub_btrfs_unmount (data); ++ ++ return 0; ++} ++ ++static grub_err_t ++get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, ++ grub_uint64_t objectid, grub_uint64_t offset, ++ grub_uint64_t *fs_root) ++{ ++ grub_err_t err; ++ struct grub_btrfs_key key_in = { ++ .object_id = objectid, ++ .type = GRUB_BTRFS_ROOT_ITEM_KEY, ++ .offset = offset, ++ }, key_out; ++ struct grub_btrfs_leaf_descriptor desc; ++ grub_disk_addr_t elemaddr; ++ grub_size_t elemsize; ++ struct grub_btrfs_root_item ri; ++ ++ err = lower_bound(data, &key_in, &key_out, tree, ++ &elemaddr, &elemsize, &desc, 0); ++ ++ if (err) ++ return err; ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM || elemaddr == 0) ++ return grub_error(GRUB_ERR_FILE_NOT_FOUND, ++ N_("can't find fs root for subvol %"PRIuGRUB_UINT64_T"\n"), ++ key_in.object_id); ++ ++ err = grub_btrfs_read_logical (data, elemaddr, &ri, sizeof (ri), 0); ++ if (err) ++ return err; ++ ++ *fs_root = ri.tree; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static const struct grub_arg_option options[] = { ++ {"output", 'o', 0, N_("Output to a variable instead of the console."), ++ N_("VARNAME"), ARG_TYPE_STRING}, ++ {"path-only", 'p', 0, N_("Show only the path of the subvolume."), 0, 0}, ++ {"id-only", 'i', 0, N_("Show only the id of the subvolume."), 0, 0}, ++ {0, 0, 0, 0, 0, 0} ++}; ++ ++static grub_err_t ++grub_cmd_btrfs_list_subvols (struct grub_extcmd_context *ctxt, ++ int argc, char **argv) ++{ ++ struct grub_btrfs_data *data; ++ grub_device_t dev; ++ char *devname; ++ grub_uint64_t tree; ++ struct grub_btrfs_key key_in = { ++ .object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID), ++ .type = GRUB_BTRFS_ROOT_REF_KEY, ++ .offset = 0, ++ }, key_out; ++ struct grub_btrfs_leaf_descriptor desc; ++ grub_disk_addr_t elemaddr; ++ grub_uint64_t fs_root = 0; ++ grub_size_t elemsize; ++ grub_size_t allocated = 0; ++ int r = 0; ++ grub_err_t err; ++ char *buf = NULL; ++ int print = 1; ++ int path_only = ctxt->state[1].set; ++ int num_only = ctxt->state[2].set; ++ char *varname = NULL; ++ char *output = NULL; ++ ++ if (ctxt->state[0].set) { ++ varname = ctxt->state[0].arg; ++ print = 0; ++ } ++ ++ if (argc < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); ++ ++ devname = grub_file_get_device_name(argv[0]); ++ if (!devname) ++ return grub_errno; ++ ++ dev = grub_device_open (devname); ++ grub_free (devname); ++ if (!dev) ++ return grub_errno; ++ ++ data = grub_btrfs_mount(dev); ++ if (!data) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "could not open device"); ++ ++ tree = data->sblock.root_tree; ++ err = get_fs_root(data, tree, grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID), ++ 0, &fs_root); ++ if (err) ++ goto out; ++ ++ err = lower_bound(data, &key_in, &key_out, tree, ++ &elemaddr, &elemsize, &desc, 0); ++ ++ if (err) ++ { ++ grub_btrfs_unmount(data); ++ return err; ++ } ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF || elemaddr == 0) ++ { ++ r = next(data, &desc, &elemaddr, &elemsize, &key_out); ++ } ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF) { ++ err = GRUB_ERR_FILE_NOT_FOUND; ++ grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("can't find root refs")); ++ goto out; ++ } ++ ++ do ++ { ++ struct grub_btrfs_root_ref *ref; ++ char *p = NULL; ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF) ++ { ++ r = 0; ++ break; ++ } ++ ++ if (elemsize > allocated) ++ { ++ grub_free(buf); ++ allocated = 2 * elemsize; ++ buf = grub_malloc(allocated + 1); ++ if (!buf) ++ { ++ r = -grub_errno; ++ break; ++ } ++ } ++ ref = (struct grub_btrfs_root_ref *)buf; ++ ++ err = grub_btrfs_read_logical(data, elemaddr, buf, elemsize, 0); ++ if (err) ++ { ++ r = -err; ++ break; ++ } ++ buf[elemsize] = 0; ++ ++ find_pathname(data, ref->dirid, fs_root, ref->name, &p); ++ ++ if (print) ++ { ++ if (num_only) ++ grub_printf("ID %"PRIuGRUB_UINT64_T"\n", key_out.offset); ++ else if (path_only) ++ grub_printf("%s\n", p); ++ else ++ grub_printf("ID %"PRIuGRUB_UINT64_T" path %s\n", key_out.offset, p); ++ } else { ++ char *old = output; ++ if (num_only) ++ output = grub_xasprintf("%s%"PRIuGRUB_UINT64_T"\n", ++ old ?: "", key_out.offset); ++ else if (path_only) ++ output = grub_xasprintf("%s%s\n", old ?: "", p); ++ else ++ output = grub_xasprintf("%sID %"PRIuGRUB_UINT64_T" path %s\n", ++ old ?: "", key_out.offset, p); ++ ++ if (old) ++ grub_free(old); ++ } ++ ++ r = next(data, &desc, &elemaddr, &elemsize, &key_out); ++ } while(r > 0); ++ ++ if (output) ++ grub_env_set(varname, output); ++ ++out: ++ free_iterator(&desc); ++ grub_btrfs_unmount(data); ++ ++ grub_device_close (dev); ++ ++ return 0; ++} ++ + static struct grub_fs grub_btrfs_fs = { + .name = "btrfs", + .dir = grub_btrfs_dir, +@@ -1764,12 +2200,88 @@ static struct grub_fs grub_btrfs_fs = { + #endif + }; + ++static grub_command_t cmd_info; ++static grub_extcmd_t cmd_list_subvols; ++ ++static char * ++subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val) ++{ ++ unsigned long long result = 0; ++ ++ grub_errno = GRUB_ERR_NONE; ++ if (*val) ++ { ++ result = grub_strtoull(val, NULL, 10); ++ if (grub_errno) ++ return NULL; ++ } ++ ++ grub_free (btrfs_default_subvol); ++ btrfs_default_subvol = NULL; ++ btrfs_default_subvolid = result; ++ return grub_strdup(val); ++} ++ ++static const char * ++subvolid_get_env (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ if (btrfs_default_subvol) ++ return grub_xasprintf("subvol:%s", btrfs_default_subvol); ++ else if (btrfs_default_subvolid) ++ return grub_xasprintf("%"PRIuGRUB_UINT64_T, btrfs_default_subvolid); ++ else ++ return ""; ++} ++ ++static char * ++subvol_set_env (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val) ++{ ++ grub_free (btrfs_default_subvol); ++ btrfs_default_subvol = grub_strdup (val); ++ btrfs_default_subvolid = 0; ++ return grub_strdup(val); ++} ++ ++static const char * ++subvol_get_env (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ if (btrfs_default_subvol) ++ return btrfs_default_subvol; ++ else if (btrfs_default_subvolid) ++ return grub_xasprintf("subvolid:%" PRIuGRUB_UINT64_T, ++ btrfs_default_subvolid); ++ else ++ return ""; ++} ++ + GRUB_MOD_INIT (btrfs) + { + grub_fs_register (&grub_btrfs_fs); ++ cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, ++ "DEVICE", ++ "Print BtrFS info about DEVICE."); ++ cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", ++ grub_cmd_btrfs_list_subvols, 0, ++ "[-p|-n] [-o var] DEVICE", ++ "Print list of BtrFS subvolumes on " ++ "DEVICE.", options); ++ grub_register_variable_hook ("btrfs_subvol", subvol_get_env, ++ subvol_set_env); ++ grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, ++ subvolid_set_env); + } + + GRUB_MOD_FINI (btrfs) + { ++ grub_register_variable_hook ("btrfs_subvol", NULL, NULL); ++ grub_register_variable_hook ("btrfs_subvolid", NULL, NULL); ++ grub_unregister_command (cmd_info); ++ grub_unregister_extcmd (cmd_list_subvols); + grub_fs_unregister (&grub_btrfs_fs); + } ++ ++// vim: si et sw=2: +diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h +index 9d93fb6c1..234ad9767 100644 +--- a/include/grub/btrfs.h ++++ b/include/grub/btrfs.h +@@ -29,6 +29,7 @@ enum + GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84, + GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90, + GRUB_BTRFS_ITEM_TYPE_DEVICE = 0xd8, ++ GRUB_BTRFS_ITEM_TYPE_ROOT_REF = 0x9c, + GRUB_BTRFS_ITEM_TYPE_CHUNK = 0xe4 + }; + +-- +2.13.0 + diff --git a/0161-export-btrfs_subvol-and-btrfs_subvolid.patch b/0161-export-btrfs_subvol-and-btrfs_subvolid.patch new file mode 100644 index 00000000..a6f29415 --- /dev/null +++ b/0161-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -0,0 +1,29 @@ +From 18aa92cc523624676f9dd1bb39e03a3ee22d3346 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Wed, 18 Dec 2013 09:57:04 +0000 +Subject: [PATCH 161/176] export btrfs_subvol and btrfs_subvolid + +We should export btrfs_subvol and btrfs_subvolid to have both visible +to subsidiary configuration files loaded using configfile. + +Signed-off-by: Michael Chang +--- + grub-core/fs/btrfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 38facf3cb..396296166 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2273,6 +2273,8 @@ GRUB_MOD_INIT (btrfs) + subvol_set_env); + grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, + subvolid_set_env); ++ grub_env_export ("btrfs_subvol"); ++ grub_env_export ("btrfs_subvolid"); + } + + GRUB_MOD_FINI (btrfs) +-- +2.13.0 + diff --git a/0162-grub2-btrfs-03-follow_default.patch b/0162-grub2-btrfs-03-follow_default.patch new file mode 100644 index 00000000..13ae9799 --- /dev/null +++ b/0162-grub2-btrfs-03-follow_default.patch @@ -0,0 +1,199 @@ +From a36f0f02df3d30d544e4d28df0891f03bc00539c Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 21 Aug 2014 03:39:11 +0000 +Subject: [PATCH 162/176] grub2-btrfs-03-follow_default + +--- + grub-core/fs/btrfs.c | 107 ++++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 76 insertions(+), 31 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 396296166..2c462584e 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -920,6 +920,7 @@ grub_btrfs_mount (grub_device_t dev) + { + struct grub_btrfs_data *data; + grub_err_t err; ++ const char *relpath = grub_env_get ("btrfs_relative_path"); + + if (!dev->disk) + { +@@ -950,11 +951,14 @@ grub_btrfs_mount (grub_device_t dev) + data->devices_attached[0].dev = dev; + data->devices_attached[0].id = data->sblock.this_device.device_id; + +- err = btrfs_handle_subvol (data); +- if (err) ++ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) + { +- grub_free (data); +- return NULL; ++ err = btrfs_handle_subvol (data); ++ if (err) ++ { ++ grub_free (data); ++ return NULL; ++ } + } + + return data; +@@ -1414,24 +1418,39 @@ find_path (struct grub_btrfs_data *data, + grub_size_t allocated = 0; + struct grub_btrfs_dir_item *direl = NULL; + struct grub_btrfs_key key_out; ++ int follow_default; + const char *ctoken; + grub_size_t ctokenlen; + char *path_alloc = NULL; + char *origpath = NULL; + unsigned symlinks_max = 32; ++ const char *relpath = grub_env_get ("btrfs_relative_path"); + ++ follow_default = 0; + origpath = grub_strdup (path); + if (!origpath) + return grub_errno; + +- if (data->fs_tree) ++ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) + { +- *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; +- *tree = data->fs_tree; +- /* This is a tree root, so everything starts at objectid 256 */ +- key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); +- key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; +- key->offset = 0; ++ if (data->fs_tree) ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->fs_tree; ++ /* This is a tree root, so everything starts at objectid 256 */ ++ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ } ++ else ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->sblock.root_tree; ++ key->object_id = data->sblock.root_dir_objectid; ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ follow_default = 1; ++ } + } + else + { +@@ -1442,15 +1461,23 @@ find_path (struct grub_btrfs_data *data, + + while (1) + { +- while (path[0] == '/') +- path++; +- if (!path[0]) +- break; +- slash = grub_strchr (path, '/'); +- if (!slash) +- slash = path + grub_strlen (path); +- ctoken = path; +- ctokenlen = slash - path; ++ if (!follow_default) ++ { ++ while (path[0] == '/') ++ path++; ++ if (!path[0]) ++ break; ++ slash = grub_strchr (path, '/'); ++ if (!slash) ++ slash = path + grub_strlen (path); ++ ctoken = path; ++ ctokenlen = slash - path; ++ } ++ else ++ { ++ ctoken = "default"; ++ ctokenlen = sizeof ("default") - 1; ++ } + + if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) + { +@@ -1461,7 +1488,9 @@ find_path (struct grub_btrfs_data *data, + + if (ctokenlen == 1 && ctoken[0] == '.') + { +- path = slash; ++ if (!follow_default) ++ path = slash; ++ follow_default = 0; + continue; + } + if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') +@@ -1492,8 +1521,9 @@ find_path (struct grub_btrfs_data *data, + *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; + key->object_id = key_out.offset; + +- path = slash; +- ++ if (!follow_default) ++ path = slash; ++ follow_default = 0; + continue; + } + +@@ -1562,7 +1592,9 @@ find_path (struct grub_btrfs_data *data, + return err; + } + +- path = slash; ++ if (!follow_default) ++ path = slash; ++ follow_default = 0; + if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) + { + struct grub_btrfs_inode inode; +@@ -1612,14 +1644,26 @@ find_path (struct grub_btrfs_data *data, + path = path_alloc = tmp; + if (path[0] == '/') + { +- if (data->fs_tree) ++ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) + { +- *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; +- *tree = data->fs_tree; +- /* This is a tree root, so everything starts at objectid 256 */ +- key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); +- key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; +- key->offset = 0; ++ if (data->fs_tree) ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->fs_tree; ++ /* This is a tree root, so everything starts at objectid 256 */ ++ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ } ++ else ++ { ++ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; ++ *tree = data->sblock.root_tree; ++ key->object_id = data->sblock.root_dir_objectid; ++ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key->offset = 0; ++ follow_default = 1; ++ } + } + else + { +@@ -2275,6 +2319,7 @@ GRUB_MOD_INIT (btrfs) + subvolid_set_env); + grub_env_export ("btrfs_subvol"); + grub_env_export ("btrfs_subvolid"); ++ grub_env_export ("btrfs_relative_path"); + } + + GRUB_MOD_FINI (btrfs) +-- +2.13.0 + diff --git a/0163-grub2-btrfs-04-grub2-install.patch b/0163-grub2-btrfs-04-grub2-install.patch new file mode 100644 index 00000000..db7f096f --- /dev/null +++ b/0163-grub2-btrfs-04-grub2-install.patch @@ -0,0 +1,177 @@ +From 0011479f3d6187b0fa658e9f992292fe4970422b Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 21 Aug 2014 03:39:11 +0000 +Subject: [PATCH 163/176] grub2-btrfs-04-grub2-install + +--- + grub-core/osdep/linux/getroot.c | 7 +++++++ + grub-core/osdep/unix/config.c | 17 +++++++++++++++-- + include/grub/emu/config.h | 1 + + util/config.c | 10 ++++++++++ + util/grub-install.c | 15 +++++++++++++++ + util/grub-mkrelpath.c | 6 ++++++ + 6 files changed, 54 insertions(+), 2 deletions(-) + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 6d9f4e5fa..5d50dd6f8 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path) + return NULL; + } + ++int use_relative_path_on_btrfs = 0; + + char ** + grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) +@@ -519,6 +520,12 @@ again: + { + ret = grub_find_root_devices_from_btrfs (dir); + fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); ++ if (use_relative_path_on_btrfs) ++ { ++ if (fs_prefix) ++ free (fs_prefix); ++ fs_prefix = xstrdup ("/"); ++ } + } + else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) + { +diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c +index 65effa9f3..b637c58ef 100644 +--- a/grub-core/osdep/unix/config.c ++++ b/grub-core/osdep/unix/config.c +@@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg) + if (v) + cfg->grub_distributor = xstrdup (v); + ++ v = getenv ("SUSE_BTRFS_SNAPSHOT_BOOTING"); ++ if (v) ++ { ++ if (grub_strncmp(v, "true", sizeof ("true") - 1) == 0) ++ { ++ cfg->is_suse_btrfs_snapshot_enabled = 1; ++ } ++ else ++ { ++ cfg->is_suse_btrfs_snapshot_enabled = 0; ++ } ++ } ++ + cfgfile = grub_util_get_config_filename (); + if (!grub_util_is_regular (cfgfile)) + return; +@@ -105,8 +118,8 @@ grub_util_load_config (struct grub_util_config *cfg) + *ptr++ = *iptr; + } + +- strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" " +- "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\""); ++ strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\nSUSE_BTRFS_SNAPSHOT_BOOTING=%s\\n\" " ++ "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\" \"$SUSE_BTRFS_SNAPSHOT_BOOTING\""); + + argv[2] = script; + argv[3] = '\0'; +diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h +index 875d5896c..c9a7e5f4a 100644 +--- a/include/grub/emu/config.h ++++ b/include/grub/emu/config.h +@@ -37,6 +37,7 @@ struct grub_util_config + { + int is_cryptodisk_enabled; + char *grub_distributor; ++ int is_suse_btrfs_snapshot_enabled; + }; + + void +diff --git a/util/config.c b/util/config.c +index ebcdd8f5e..f044a880a 100644 +--- a/util/config.c ++++ b/util/config.c +@@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple) + cfg->is_cryptodisk_enabled = 1; + continue; + } ++ if (grub_strncmp (ptr, "SUSE_BTRFS_SNAPSHOT_BOOTING=", ++ sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1) == 0) ++ { ++ ptr += sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1; ++ if (*ptr == '"' || *ptr == '\'') ++ ptr++; ++ if (grub_strncmp(ptr, "true", sizeof ("true") - 1) == 0) ++ cfg->is_suse_btrfs_snapshot_enabled = 1; ++ continue; ++ } + if (grub_strncmp (ptr, "GRUB_DISTRIBUTOR=", + sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) + { +diff --git a/util/grub-install.c b/util/grub-install.c +index 75e3e5ba6..036fe1822 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -816,6 +816,8 @@ fill_core_services (const char *core_services) + free (sysv_plist); + } + ++extern int use_relative_path_on_btrfs; ++ + int + main (int argc, char *argv[]) + { +@@ -849,6 +851,9 @@ main (int argc, char *argv[]) + + grub_util_load_config (&config); + ++ if (config.is_suse_btrfs_snapshot_enabled) ++ use_relative_path_on_btrfs = 1; ++ + if (!bootloader_id && config.grub_distributor) + { + char *ptr; +@@ -1321,6 +1326,16 @@ main (int argc, char *argv[]) + fprintf (load_cfg_f, "set debug='%s'\n", + debug_image); + } ++ ++ if (config.is_suse_btrfs_snapshot_enabled ++ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) ++ { ++ if (!load_cfg_f) ++ load_cfg_f = grub_util_fopen (load_cfg, "wb"); ++ have_load_cfg = 1; ++ fprintf (load_cfg_f, "set btrfs_relative_path='y'\n"); ++ } ++ + char *prefix_drive = NULL; + char *install_drive = NULL; + +diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c +index 47a241a39..5db7a9a7d 100644 +--- a/util/grub-mkrelpath.c ++++ b/util/grub-mkrelpath.c +@@ -40,9 +40,12 @@ struct arguments + }; + + static struct argp_option options[] = { ++ {"relative", 'r', 0, 0, "use relative path on btrfs", 0}, + { 0, 0, 0, 0, 0, 0 } + }; + ++extern int use_relative_path_on_btrfs; ++ + static error_t + argp_parser (int key, char *arg, struct argp_state *state) + { +@@ -52,6 +55,9 @@ argp_parser (int key, char *arg, struct argp_state *state) + + switch (key) + { ++ case 'r': ++ use_relative_path_on_btrfs = 1; ++ break; + case ARGP_KEY_ARG: + if (state->arg_num == 0) + arguments->pathname = xstrdup (arg); +-- +2.13.0 + diff --git a/0164-grub2-btrfs-05-grub2-mkconfig.patch b/0164-grub2-btrfs-05-grub2-mkconfig.patch new file mode 100644 index 00000000..93ed3b5b --- /dev/null +++ b/0164-grub2-btrfs-05-grub2-mkconfig.patch @@ -0,0 +1,130 @@ +From 84f394eb9a21b71bb86f0eeaad28b449e3462af0 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 21 Aug 2014 03:39:11 +0000 +Subject: [PATCH 164/176] grub2-btrfs-05-grub2-mkconfig + +--- + util/grub-mkconfig.in | 3 ++- + util/grub-mkconfig_lib.in | 4 ++++ + util/grub.d/00_header.in | 24 +++++++++++++++++++++++- + util/grub.d/10_linux.in | 4 ++++ + util/grub.d/20_linux_xen.in | 4 ++++ + 5 files changed, 37 insertions(+), 2 deletions(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index e32de5ef3..3b0bfe403 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -239,7 +239,8 @@ export GRUB_DEFAULT \ + GRUB_BADRAM \ + GRUB_OS_PROBER_SKIP_LIST \ + GRUB_DISABLE_SUBMENU \ +- GRUB_DEFAULT_DTB ++ GRUB_DEFAULT_DTB \ ++ SUSE_BTRFS_SNAPSHOT_BOOTING + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 9c410eae4..2fb4f4f81 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -52,7 +52,11 @@ grub_warn () + + make_system_path_relative_to_its_root () + { ++ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] ; then ++ "${grub_mkrelpath}" -r "$1" ++ else + "${grub_mkrelpath}" "$1" ++ fi + } + + is_path_readable_by_grub () +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 858b526c9..e2a533001 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" + + . "$pkgdatadir/grub-mkconfig_lib" + ++if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && ++ [ "x${GRUB_FS}" = "xbtrfs" ] ; then ++ cat </dev/null || true` +diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in +index 54f1ec8a2..462f8e1f8 100644 +--- a/util/grub.d/20_linux_xen.in ++++ b/util/grub.d/20_linux_xen.in +@@ -63,10 +63,14 @@ fi + + case x"$GRUB_FS" in + xbtrfs) ++ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then ++ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}" ++ else + rootsubvol="`make_system_path_relative_to_its_root /`" + rootsubvol="${rootsubvol#/}" + if [ "x${rootsubvol}" != x ]; then + GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" ++ fi + fi;; + xzfs) + rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` +-- +2.13.0 + diff --git a/0165-grub2-btrfs-06-subvol-mount.patch b/0165-grub2-btrfs-06-subvol-mount.patch new file mode 100644 index 00000000..ab00baa9 --- /dev/null +++ b/0165-grub2-btrfs-06-subvol-mount.patch @@ -0,0 +1,540 @@ +From 007556ce6695dfd416f20c31aa1d93d46086e2ce Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 22 May 2015 11:45:25 +0000 +Subject: [PATCH 165/176] grub2-btrfs-06-subvol-mount + +--- + grub-core/fs/btrfs.c | 195 +++++++++++++++++++++++++++++++++++++++- + grub-core/osdep/linux/getroot.c | 148 +++++++++++++++++++++++++++++- + include/grub/emu/getroot.h | 5 ++ + util/grub-install.c | 49 ++++++++++ + 4 files changed, 392 insertions(+), 5 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 2c462584e..d111147e8 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -245,6 +246,12 @@ static grub_err_t + grub_btrfs_read_logical (struct grub_btrfs_data *data, + grub_disk_addr_t addr, void *buf, grub_size_t size, + int recursion_depth); ++static grub_err_t ++get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, ++ grub_uint64_t *tree, grub_uint8_t *type); ++ ++grub_uint64_t ++find_mtab_subvol_tree (const char *path, char **path_in_subvol); + + static grub_err_t + read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) +@@ -887,9 +894,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) + grub_err_t err; + grub_uint64_t tree = 0; + grub_uint8_t type; ++ grub_uint64_t saved_tree; + struct grub_btrfs_key key; + ++ if (path[0] == '\0') ++ { ++ data->fs_tree = 0; ++ return GRUB_ERR_NONE; ++ } ++ ++ err = get_root (data, &key, &tree, &type); ++ if (err) ++ return err; ++ ++ saved_tree = data->fs_tree; ++ data->fs_tree = tree; ++ + err = find_path (data, path, &key, &tree, &type); ++ ++ data->fs_tree = saved_tree; ++ + if (err) + return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); + +@@ -1758,11 +1782,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, + int r = 0; + grub_uint64_t tree; + grub_uint8_t type; ++ char *new_path = NULL; + + if (!data) + return grub_errno; + +- err = find_path (data, path, &key_in, &tree, &type); ++ tree = find_mtab_subvol_tree (path, &new_path); ++ ++ if (tree) ++ data->fs_tree = tree; ++ ++ err = find_path (data, new_path ? new_path : path, &key_in, &tree, &type); ++ if (new_path) ++ grub_free (new_path); ++ + if (err) + { + grub_btrfs_unmount (data); +@@ -1864,11 +1897,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) + struct grub_btrfs_inode inode; + grub_uint8_t type; + struct grub_btrfs_key key_in; ++ grub_uint64_t tree; ++ char *new_path = NULL; + + if (!data) + return grub_errno; + +- err = find_path (data, name, &key_in, &data->tree, &type); ++ tree = find_mtab_subvol_tree (name, &new_path); ++ ++ if (tree) ++ data->fs_tree = tree; ++ ++ err = find_path (data, new_path ? new_path : name, &key_in, &data->tree, &type); ++ if (new_path) ++ grub_free (new_path); ++ + if (err) + { + grub_btrfs_unmount (data); +@@ -2039,6 +2082,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, + return 0; + } + ++struct grub_btrfs_mtab ++{ ++ struct grub_btrfs_mtab *next; ++ struct grub_btrfs_mtab **prev; ++ char *path; ++ char *subvol; ++ grub_uint64_t tree; ++}; ++ ++typedef struct grub_btrfs_mtab* grub_btrfs_mtab_t; ++ ++static struct grub_btrfs_mtab *btrfs_mtab; ++ ++#define FOR_GRUB_MTAB(var) FOR_LIST_ELEMENTS (var, btrfs_mtab) ++#define FOR_GRUB_MTAB_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), btrfs_mtab) ++ ++static void ++add_mountpoint (const char *path, const char *subvol, grub_uint64_t tree) ++{ ++ grub_btrfs_mtab_t m = grub_malloc (sizeof (*m)); ++ ++ m->path = grub_strdup (path); ++ m->subvol = grub_strdup (subvol); ++ m->tree = tree; ++ grub_list_push (GRUB_AS_LIST_P (&btrfs_mtab), GRUB_AS_LIST (m)); ++} ++ ++static grub_err_t ++grub_cmd_btrfs_mount_subvol (grub_command_t cmd __attribute__ ((unused)), int argc, ++ char **argv) ++{ ++ char *devname, *dirname, *subvol; ++ struct grub_btrfs_key key_in; ++ grub_uint8_t type; ++ grub_uint64_t tree; ++ grub_uint64_t saved_tree; ++ grub_err_t err; ++ struct grub_btrfs_data *data = NULL; ++ grub_device_t dev = NULL; ++ ++ if (argc < 3) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "required and "); ++ ++ devname = grub_file_get_device_name(argv[0]); ++ dev = grub_device_open (devname); ++ grub_free (devname); ++ ++ if (!dev) ++ { ++ err = grub_errno; ++ goto err_out; ++ } ++ ++ dirname = argv[1]; ++ subvol = argv[2]; ++ ++ data = grub_btrfs_mount (dev); ++ if (!data) ++ { ++ err = grub_errno; ++ goto err_out; ++ } ++ ++ err = find_path (data, dirname, &key_in, &tree, &type); ++ if (err) ++ goto err_out; ++ ++ if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); ++ goto err_out; ++ } ++ ++ err = get_root (data, &key_in, &tree, &type); ++ ++ if (err) ++ goto err_out; ++ ++ saved_tree = data->fs_tree; ++ data->fs_tree = tree; ++ err = find_path (data, subvol, &key_in, &tree, &type); ++ data->fs_tree = saved_tree; ++ ++ if (err) ++ goto err_out; ++ ++ if (key_in.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol); ++ goto err_out; ++ } ++ ++ grub_btrfs_unmount (data); ++ grub_device_close (dev); ++ add_mountpoint (dirname, subvol, tree); ++ ++ return GRUB_ERR_NONE; ++ ++err_out: ++ ++ if (data) ++ grub_btrfs_unmount (data); ++ ++ if (dev) ++ grub_device_close (dev); ++ ++ return err; ++} ++ ++grub_uint64_t ++find_mtab_subvol_tree (const char *path, char **path_in_subvol) ++{ ++ grub_btrfs_mtab_t m, cm; ++ grub_uint64_t tree; ++ ++ if (!path || !path_in_subvol) ++ return 0; ++ ++ *path_in_subvol = NULL; ++ tree = 0; ++ cm = NULL; ++ ++ FOR_GRUB_MTAB (m) ++ { ++ if (grub_strncmp (path, m->path, grub_strlen (m->path)) == 0) ++ { ++ if (!cm) ++ cm = m; ++ else ++ if (grub_strcmp (m->path, cm->path) > 0) ++ cm = m; ++ } ++ } ++ ++ if (cm) ++ { ++ const char *s = path + grub_strlen (cm->path); ++ *path_in_subvol = (s[0] == '\0') ? grub_strdup ("/") : grub_strdup (s); ++ tree = cm->tree; ++ } ++ ++ return tree; ++} ++ + static grub_err_t + get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, + grub_uint64_t objectid, grub_uint64_t offset, +@@ -2245,6 +2432,7 @@ static struct grub_fs grub_btrfs_fs = { + }; + + static grub_command_t cmd_info; ++static grub_command_t cmd_mount_subvol; + static grub_extcmd_t cmd_list_subvols; + + static char * +@@ -2308,6 +2496,9 @@ GRUB_MOD_INIT (btrfs) + cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, + "DEVICE", + "Print BtrFS info about DEVICE."); ++ cmd_mount_subvol = grub_register_command("btrfs-mount-subvol", grub_cmd_btrfs_mount_subvol, ++ "DEVICE DIRECTORY SUBVOL", ++ "Set btrfs DEVICE the DIRECTORY a mountpoint of SUBVOL."); + cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", + grub_cmd_btrfs_list_subvols, 0, + "[-p|-n] [-o var] DEVICE", +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 5d50dd6f8..4c5a13022 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key + grub_uint32_t unused[9]; + }; + ++struct btrfs_ioctl_search_header { ++ grub_uint64_t transid; ++ grub_uint64_t objectid; ++ grub_uint64_t offset; ++ grub_uint32_t type; ++ grub_uint32_t len; ++}; ++ + struct btrfs_ioctl_search_args { + struct btrfs_ioctl_search_key key; + grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key)) +@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_path) + + int use_relative_path_on_btrfs = 0; + ++static char * ++get_btrfs_subvol (const char *path) ++{ ++ struct btrfs_ioctl_ino_lookup_args args; ++ grub_uint64_t tree_id; ++ int fd = -1; ++ char *ret = NULL; ++ ++ fd = open (path, O_RDONLY); ++ ++ if (fd < 0) ++ return NULL; ++ ++ memset (&args, 0, sizeof(args)); ++ args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; ++ ++ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) ++ goto error; ++ ++ tree_id = args.treeid; ++ ++ while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID) ++ { ++ struct btrfs_ioctl_search_args sargs; ++ struct grub_btrfs_root_backref *br; ++ struct btrfs_ioctl_search_header *search_header; ++ char *old; ++ grub_uint16_t len; ++ grub_uint64_t inode_id; ++ ++ memset (&sargs, 0, sizeof(sargs)); ++ ++ sargs.key.tree_id = 1; ++ sargs.key.min_objectid = tree_id; ++ sargs.key.max_objectid = tree_id; ++ ++ sargs.key.min_offset = 0; ++ sargs.key.max_offset = ~0ULL; ++ sargs.key.min_transid = 0; ++ sargs.key.max_transid = ~0ULL; ++ sargs.key.min_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; ++ sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; ++ ++ sargs.key.nr_items = 1; ++ ++ if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) ++ goto error; ++ ++ if (sargs.key.nr_items == 0) ++ goto error; ++ ++ search_header = (struct btrfs_ioctl_search_header *)sargs.buf; ++ br = (struct grub_btrfs_root_backref *) (search_header + 1); ++ ++ len = grub_le_to_cpu16 (br->n); ++ inode_id = grub_le_to_cpu64 (br->inode_id); ++ tree_id = search_header->offset; ++ ++ old = ret; ++ ret = malloc (len + 1); ++ memcpy (ret, br->name, len); ++ ret[len] = '\0'; ++ ++ if (inode_id != GRUB_BTRFS_TREE_ROOT_OBJECTID) ++ { ++ char *s; ++ ++ memset(&args, 0, sizeof(args)); ++ args.treeid = search_header->offset; ++ args.objectid = inode_id; ++ ++ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) ++ goto error; ++ ++ s = xasprintf ("%s%s", args.name, ret); ++ free (ret); ++ ret = s; ++ } ++ ++ if (old) ++ { ++ char *s = xasprintf ("%s/%s", ret, old); ++ free (ret); ++ free (old); ++ ret = s; ++ } ++ } ++ ++ close (fd); ++ return ret; ++ ++error: ++ ++ if (fd >= 0) ++ close (fd); ++ if (ret) ++ free (ret); ++ ++ return NULL; ++} ++ ++void (*grub_find_root_btrfs_mount_path_hook)(const char *mount_path); ++ + char ** + grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) + { +@@ -519,12 +630,15 @@ again: + else if (grub_strcmp (entries[i].fstype, "btrfs") == 0) + { + ret = grub_find_root_devices_from_btrfs (dir); +- fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); + if (use_relative_path_on_btrfs) + { +- if (fs_prefix) +- free (fs_prefix); + fs_prefix = xstrdup ("/"); ++ if (grub_find_root_btrfs_mount_path_hook) ++ grub_find_root_btrfs_mount_path_hook (entries[i].enc_path); ++ } ++ else ++ { ++ fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); + } + } + else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) +@@ -1150,6 +1264,34 @@ grub_util_get_grub_dev_os (const char *os_dev) + return grub_dev; + } + ++ ++char * ++grub_util_get_btrfs_subvol (const char *path, char **mount_path) ++{ ++ char *mp = NULL; ++ ++ if (mount_path) ++ *mount_path = NULL; ++ ++ auto void ++ mount_path_hook (const char *m) ++ { ++ mp = strdup (m); ++ } ++ ++ grub_find_root_btrfs_mount_path_hook = mount_path_hook; ++ grub_free (grub_find_root_devices_from_mountinfo (path, NULL)); ++ grub_find_root_btrfs_mount_path_hook = NULL; ++ ++ if (!mp) ++ return NULL; ++ ++ if (mount_path) ++ *mount_path = mp; ++ ++ return get_btrfs_subvol (mp); ++} ++ + char * + grub_make_system_path_relative_to_its_root_os (const char *path) + { +diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h +index 73fa2d34a..9c642ae3f 100644 +--- a/include/grub/emu/getroot.h ++++ b/include/grub/emu/getroot.h +@@ -53,6 +53,11 @@ char ** + grub_find_root_devices_from_mountinfo (const char *dir, char **relroot); + #endif + ++#ifdef __linux__ ++char * ++grub_util_get_btrfs_subvol (const char *path, char **mount_path); ++#endif ++ + /* Devmapper functions provided by getroot_devmapper.c. */ + void + grub_util_pull_devmapper (const char *os_dev); +diff --git a/util/grub-install.c b/util/grub-install.c +index 036fe1822..cd84a72b9 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -1534,6 +1534,55 @@ main (int argc, char *argv[]) + prefix_drive = xasprintf ("(%s)", grub_drives[0]); + } + ++#ifdef __linux__ ++ ++ if (config.is_suse_btrfs_snapshot_enabled ++ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) ++ { ++ char *subvol = NULL; ++ char *mount_path = NULL; ++ char **rootdir_devices = NULL; ++ char *rootdir_path = grub_util_path_concat (2, "/", rootdir); ++ ++ if (grub_util_is_directory (rootdir_path)) ++ rootdir_devices = grub_guess_root_devices (rootdir_path); ++ ++ free (rootdir_path); ++ ++ if (rootdir_devices && rootdir_devices[0]) ++ if (grub_strcmp (rootdir_devices[0], grub_devices[0]) == 0) ++ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path); ++ ++ if (subvol && mount_path) ++ { ++ char *def_subvol; ++ ++ def_subvol = grub_util_get_btrfs_subvol ("/", NULL); ++ ++ if (def_subvol) ++ { ++ if (!load_cfg_f) ++ load_cfg_f = grub_util_fopen (load_cfg, "wb"); ++ have_load_cfg = 1; ++ ++ if (grub_strcmp (subvol, def_subvol) != 0) ++ fprintf (load_cfg_f, "btrfs-mount-subvol ($root) %s %s\n", mount_path, subvol); ++ free (def_subvol); ++ } ++ } ++ ++ for (curdev = rootdir_devices; *curdev; curdev++) ++ free (*curdev); ++ if (rootdir_devices) ++ free (rootdir_devices); ++ if (subvol) ++ free (subvol); ++ if (mount_path) ++ free (mount_path); ++ } ++ ++#endif ++ + char mkimage_target[200]; + const char *core_name = NULL; + +-- +2.13.0 + diff --git a/0166-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch b/0166-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch new file mode 100644 index 00000000..05af50d1 --- /dev/null +++ b/0166-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch @@ -0,0 +1,34 @@ +From 8be1cec541699a554a7048f879fbe2b9bf67bac4 Mon Sep 17 00:00:00 2001 +From: Dusty Mabe +Date: Sat, 18 Jul 2015 15:38:08 +0000 +Subject: [PATCH 166/176] No more "Bootable Snapshot" submenu in grub.cfg. + +This breaks grubby (run on kernel upgrades) because grubby just +does a search for "menuentry". +--- + util/grub.d/00_header.in | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index e2a533001..8a16fea34 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -366,15 +366,3 @@ fi + if [ "x${GRUB_BADRAM}" != "x" ] ; then + echo "badram ${GRUB_BADRAM}" + fi +- +-if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && +- [ "x${GRUB_FS}" = "xbtrfs" ] ; then +- # Note: No $snapshot_num on *read-only* rollback! (bsc#901487) +- cat < +Date: Tue, 21 Jun 2016 16:44:17 +0000 +Subject: [PATCH 167/176] Fallback to old subvol name scheme to support old + snapshot config + +Ref: bsc#953538 +--- + grub-core/fs/btrfs.c | 32 +++++++++++++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index d111147e8..a5c000805 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -925,10 +925,40 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) + } + + static grub_err_t ++lookup_root_by_name_fallback(struct grub_btrfs_data *data, const char *path) ++{ ++ grub_err_t err; ++ grub_uint64_t tree = 0; ++ grub_uint8_t type; ++ struct grub_btrfs_key key; ++ ++ err = find_path (data, path, &key, &tree, &type); ++ if (err) ++ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); ++ ++ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) ++ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path); ++ ++ data->fs_tree = tree; ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t + btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused))) + { + if (btrfs_default_subvol) +- return lookup_root_by_name(data, btrfs_default_subvol); ++ { ++ grub_err_t err; ++ err = lookup_root_by_name(data, btrfs_default_subvol); ++ ++ /* Fallback to old schemes */ ++ if (err == GRUB_ERR_FILE_NOT_FOUND) ++ { ++ err = GRUB_ERR_NONE; ++ return lookup_root_by_name_fallback(data, btrfs_default_subvol); ++ } ++ return err; ++ } + + if (btrfs_default_subvolid) + return lookup_root_by_id(data, btrfs_default_subvolid); +-- +2.13.0 + diff --git a/0168-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0168-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch new file mode 100644 index 00000000..f8c85ad7 --- /dev/null +++ b/0168-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -0,0 +1,276 @@ +From d34f81cb2da610d22b1c794864b39e24f70ba291 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 11 May 2017 08:56:57 +0000 +Subject: [PATCH 168/176] Grub not working correctly with btrfs snapshots + (bsc#1026511) + +--- + grub-core/fs/btrfs.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 238 insertions(+) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index a5c000805..3cd947219 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2446,6 +2446,238 @@ out: + return 0; + } + ++static grub_err_t ++grub_btrfs_get_parent_subvol_path (struct grub_btrfs_data *data, ++ grub_uint64_t child_id, ++ const char *child_path, ++ grub_uint64_t *parent_id, ++ char **path_out) ++{ ++ grub_uint64_t fs_root = 0; ++ struct grub_btrfs_key key_in = { ++ .object_id = child_id, ++ .type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF, ++ .offset = 0, ++ }, key_out; ++ struct grub_btrfs_root_ref *ref; ++ char *buf; ++ struct grub_btrfs_leaf_descriptor desc; ++ grub_size_t elemsize; ++ grub_disk_addr_t elemaddr; ++ grub_err_t err; ++ char *parent_path; ++ ++ *parent_id = 0; ++ *path_out = 0; ++ ++ err = lower_bound(data, &key_in, &key_out, data->sblock.root_tree, ++ &elemaddr, &elemsize, &desc, 0); ++ if (err) ++ return err; ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF || elemaddr == 0) ++ next(data, &desc, &elemaddr, &elemsize, &key_out); ++ ++ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF) ++ { ++ free_iterator(&desc); ++ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("can't find root backrefs")); ++ } ++ ++ buf = grub_malloc(elemsize + 1); ++ if (!buf) ++ { ++ free_iterator(&desc); ++ return grub_errno; ++ } ++ ++ err = grub_btrfs_read_logical(data, elemaddr, buf, elemsize, 0); ++ if (err) ++ { ++ grub_free(buf); ++ free_iterator(&desc); ++ return err; ++ } ++ ++ buf[elemsize] = 0; ++ ref = (struct grub_btrfs_root_ref *)buf; ++ ++ err = get_fs_root(data, data->sblock.root_tree, grub_le_to_cpu64 (key_out.offset), ++ 0, &fs_root); ++ if (err) ++ { ++ grub_free(buf); ++ free_iterator(&desc); ++ return err; ++ } ++ ++ find_pathname(data, grub_le_to_cpu64 (ref->dirid), fs_root, ref->name, &parent_path); ++ ++ if (child_path) ++ { ++ *path_out = grub_xasprintf ("%s/%s", parent_path, child_path); ++ grub_free (parent_path); ++ } ++ else ++ *path_out = parent_path; ++ ++ *parent_id = grub_le_to_cpu64 (key_out.offset); ++ ++ grub_free(buf); ++ free_iterator(&desc); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_btrfs_get_default_subvolume_id (struct grub_btrfs_data *data, grub_uint64_t *id) ++{ ++ grub_err_t err; ++ grub_disk_addr_t elemaddr; ++ grub_size_t elemsize; ++ struct grub_btrfs_key key, key_out; ++ struct grub_btrfs_dir_item *direl = NULL; ++ const char *ctoken = "default"; ++ grub_size_t ctokenlen = sizeof ("default") - 1; ++ ++ *id = 0; ++ key.object_id = data->sblock.root_dir_objectid; ++ key.type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; ++ key.offset = grub_cpu_to_le64 (~grub_getcrc32c (1, ctoken, ctokenlen)); ++ err = lower_bound (data, &key, &key_out, data->sblock.root_tree, &elemaddr, &elemsize, ++ NULL, 0); ++ if (err) ++ return err; ++ ++ if (key_cmp (&key, &key_out) != 0) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file not found")); ++ ++ struct grub_btrfs_dir_item *cdirel; ++ direl = grub_malloc (elemsize + 1); ++ err = grub_btrfs_read_logical (data, elemaddr, direl, elemsize, 0); ++ if (err) ++ { ++ grub_free (direl); ++ return err; ++ } ++ for (cdirel = direl; ++ (grub_uint8_t *) cdirel - (grub_uint8_t *) direl ++ < (grub_ssize_t) elemsize; ++ cdirel = (void *) ((grub_uint8_t *) (direl + 1) ++ + grub_le_to_cpu16 (cdirel->n) ++ + grub_le_to_cpu16 (cdirel->m))) ++ { ++ if (ctokenlen == grub_le_to_cpu16 (cdirel->n) ++ && grub_memcmp (cdirel->name, ctoken, ctokenlen) == 0) ++ break; ++ } ++ if ((grub_uint8_t *) cdirel - (grub_uint8_t *) direl ++ >= (grub_ssize_t) elemsize) ++ { ++ grub_free (direl); ++ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file not found")); ++ return err; ++ } ++ ++ if (cdirel->key.type != GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM) ++ { ++ grub_free (direl); ++ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file not found")); ++ return err; ++ } ++ ++ *id = grub_le_to_cpu64 (cdirel->key.object_id); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_btrfs_get_default_subvol (struct grub_extcmd_context *ctxt, ++ int argc, char **argv) ++{ ++ char *devname; ++ grub_device_t dev; ++ struct grub_btrfs_data *data; ++ grub_err_t err; ++ grub_uint64_t id; ++ char *subvol = NULL; ++ grub_uint64_t subvolid = 0; ++ char *varname = NULL; ++ char *output = NULL; ++ int path_only = ctxt->state[1].set; ++ int num_only = ctxt->state[2].set; ++ ++ if (ctxt->state[0].set) ++ varname = ctxt->state[0].arg; ++ ++ if (argc < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); ++ ++ devname = grub_file_get_device_name(argv[0]); ++ if (!devname) ++ return grub_errno; ++ ++ dev = grub_device_open (devname); ++ grub_free (devname); ++ if (!dev) ++ return grub_errno; ++ ++ data = grub_btrfs_mount(dev); ++ if (!data) ++ { ++ grub_device_close (dev); ++ grub_dprintf ("btrfs", "failed to open fs\n"); ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ ++ err = grub_btrfs_get_default_subvolume_id (data, &subvolid); ++ if (err) ++ { ++ grub_btrfs_unmount (data); ++ grub_device_close (dev); ++ return err; ++ } ++ ++ id = subvolid; ++ while (id != GRUB_BTRFS_ROOT_VOL_OBJECTID) ++ { ++ grub_uint64_t parent_id; ++ char *path_out; ++ ++ err = grub_btrfs_get_parent_subvol_path (data, grub_cpu_to_le64 (id), subvol, &parent_id, &path_out); ++ if (err) ++ { ++ grub_btrfs_unmount (data); ++ grub_device_close (dev); ++ return err; ++ } ++ ++ if (subvol) ++ grub_free (subvol); ++ subvol = path_out; ++ id = parent_id; ++ } ++ ++ if (num_only && path_only) ++ output = grub_xasprintf ("%"PRIuGRUB_UINT64_T" /%s", subvolid, subvol); ++ else if (num_only) ++ output = grub_xasprintf ("%"PRIuGRUB_UINT64_T, subvolid); ++ else ++ output = grub_xasprintf ("/%s", subvol); ++ ++ if (varname) ++ grub_env_set(varname, output); ++ else ++ grub_printf ("%s\n", output); ++ ++ grub_free (output); ++ grub_free (subvol); ++ ++ grub_btrfs_unmount (data); ++ grub_device_close (dev); ++ ++ return GRUB_ERR_NONE; ++} ++ + static struct grub_fs grub_btrfs_fs = { + .name = "btrfs", + .dir = grub_btrfs_dir, +@@ -2464,6 +2696,7 @@ static struct grub_fs grub_btrfs_fs = { + static grub_command_t cmd_info; + static grub_command_t cmd_mount_subvol; + static grub_extcmd_t cmd_list_subvols; ++static grub_extcmd_t cmd_get_default_subvol; + + static char * + subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), +@@ -2534,6 +2767,11 @@ GRUB_MOD_INIT (btrfs) + "[-p|-n] [-o var] DEVICE", + "Print list of BtrFS subvolumes on " + "DEVICE.", options); ++ cmd_get_default_subvol = grub_register_extcmd("btrfs-get-default-subvol", ++ grub_cmd_btrfs_get_default_subvol, 0, ++ "[-p|-n] [-o var] DEVICE", ++ "Print default BtrFS subvolume on " ++ "DEVICE.", options); + grub_register_variable_hook ("btrfs_subvol", subvol_get_env, + subvol_set_env); + grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, +-- +2.13.0 + diff --git a/0169-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0169-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch new file mode 100644 index 00000000..d5f106ef --- /dev/null +++ b/0169-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -0,0 +1,75 @@ +From bc2e5ed91a4aff3612378675e67c8cde0e2ef2e7 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 1 Jun 2017 09:59:56 -0400 +Subject: [PATCH 169/176] Add grub_efi_allocate_pool() and grub_efi_free_pool() + wrappers. + +Signed-off-by: Peter Jones +--- + include/grub/efi/efi.h | 36 ++++++++++++++++++++++++++++++++---- + 1 file changed, 32 insertions(+), 4 deletions(-) + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 764cd11f5..89938bcaa 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -24,6 +24,10 @@ + #include + #include + ++/* Variables. */ ++extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); ++extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); ++ + /* Functions. */ + void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol, + void *registration); +@@ -51,6 +55,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, + grub_efi_uintn_t *map_key, + grub_efi_uintn_t *descriptor_size, + grub_efi_uint32_t *descriptor_version); ++ ++static inline grub_efi_status_t ++__attribute__((__unused__)) ++grub_efi_allocate_pool (grub_efi_memory_type_t pool_type, ++ grub_efi_uintn_t buffer_size, ++ void **buffer) ++{ ++ grub_efi_boot_services_t *b; ++ grub_efi_status_t status; ++ ++ b = grub_efi_system_table->boot_services; ++ status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer); ++ return status; ++} ++ ++static inline grub_efi_status_t ++__attribute__((__unused__)) ++grub_efi_free_pool (void *buffer) ++{ ++ grub_efi_boot_services_t *b; ++ grub_efi_status_t status; ++ ++ b = grub_efi_system_table->boot_services; ++ status = efi_call_1 (b->free_pool, buffer); ++ return status; ++} ++ + grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); + void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); + char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); +@@ -96,10 +127,7 @@ void grub_efi_init (void); + void grub_efi_fini (void); + void grub_efi_set_prefix (void); + +-/* Variables. */ +-extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); +-extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); +- ++/* More variables. */ + extern int EXPORT_VAR(grub_efi_is_finished); + + struct grub_net_card; +-- +2.13.0 + diff --git a/0170-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0170-Use-grub_efi_.-memory-helpers-where-reasonable.patch new file mode 100644 index 00000000..f9120f80 --- /dev/null +++ b/0170-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -0,0 +1,109 @@ +From 07f843af1c6880c8cbf39dc17de16616ce2e3ba4 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 1 Jun 2017 10:06:38 -0400 +Subject: [PATCH 170/176] Use grub_efi_...() memory helpers where reasonable. + +This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and +grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we +get more reasonable type checking. + +Signed-off-by: Peter Jones +--- + grub-core/loader/efi/chainloader.c | 24 +++++++++--------------- + 1 file changed, 9 insertions(+), 15 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 7826e794a..d2557b38d 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -65,7 +65,7 @@ grub_chainloader_unload (void) + + b = grub_efi_system_table->boot_services; + efi_call_1 (b->unload_image, image_handle); +- efi_call_2 (b->free_pages, address, pages); ++ grub_efi_free_pages (address, pages); + + grub_free (file_path); + grub_free (cmdline); +@@ -108,7 +108,7 @@ grub_chainloader_boot (void) + } + + if (exit_data) +- efi_call_1 (b->free_pool, exit_data); ++ grub_efi_free_pool (exit_data); + + grub_loader_unset (); + +@@ -500,10 +500,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) + static grub_efi_boolean_t + handle_image (void *data, grub_efi_uint32_t datasize) + { +- grub_efi_boot_services_t *b; + grub_efi_loaded_image_t *li, li_bak; + grub_efi_status_t efi_status; +- char *buffer = NULL; ++ void *buffer = NULL; + char *buffer_aligned = NULL; + grub_efi_uint32_t i; + struct grub_pe32_section_table *section; +@@ -514,8 +513,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) + int found_entry_point = 0; + int rc; + +- b = grub_efi_system_table->boot_services; +- + rc = read_header (data, datasize, &context); + if (rc < 0) + { +@@ -555,8 +552,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) + grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", + context.image_size, datasize); + +- efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, +- buffer_size, &buffer); ++ efi_status = grub_efi_allocate_pool (GRUB_EFI_LOADER_DATA, buffer_size, ++ &buffer); + + if (efi_status != GRUB_EFI_SUCCESS) + { +@@ -788,14 +785,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) + + grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); + grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); +- efi_status = efi_call_1 (b->free_pool, buffer); ++ efi_status = grub_efi_free_pool (buffer); + + return 1; + + error_exit: + grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno); + if (buffer) +- efi_call_1 (b->free_pool, buffer); ++ grub_efi_free_pool (buffer); + + return 0; + } +@@ -803,10 +800,7 @@ error_exit: + static grub_err_t + grub_secureboot_chainloader_unload (void) + { +- grub_efi_boot_services_t *b; +- +- b = grub_efi_system_table->boot_services; +- efi_call_2 (b->free_pages, address, pages); ++ grub_efi_free_pages (address, pages); + grub_free (file_path); + grub_free (cmdline); + cmdline = 0; +@@ -1073,7 +1067,7 @@ fail: + grub_free (file_path); + + if (address) +- efi_call_2 (b->free_pages, address, pages); ++ grub_efi_free_pages (address, pages); + + if (cmdline) + grub_free (cmdline); +-- +2.13.0 + diff --git a/0171-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0171-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch new file mode 100644 index 00000000..f4524566 --- /dev/null +++ b/0171-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -0,0 +1,49 @@ +From 4751dd389b5de3f7431742d87e233e9a3af23357 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 1 Jun 2017 10:07:50 -0400 +Subject: [PATCH 171/176] Add PRIxGRUB_EFI_STATUS and use it. + +This avoids syntax checkers getting confused about if it's llx or lx. + +Signed-off-by: Peter Jones +--- + grub-core/loader/efi/chainloader.c | 3 ++- + include/grub/efi/api.h | 8 ++++++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index d2557b38d..2c62faa29 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -783,7 +783,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) + efi_status = efi_call_2 (entry_point, grub_efi_image_handle, + grub_efi_system_table); + +- grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); ++ grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n", ++ efi_status); + grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); + efi_status = grub_efi_free_pool (buffer); + +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 02488ec35..ddc5ecfb0 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -527,6 +527,14 @@ typedef grub_uint8_t grub_efi_char8_t; + typedef grub_uint16_t grub_efi_char16_t; + + typedef grub_efi_intn_t grub_efi_status_t; ++/* Make grub_efi_status_t reasonably printable. */ ++#if GRUB_CPU_SIZEOF_VOID_P == 8 ++#define PRIxGRUB_EFI_STATUS "lx" ++#define PRIdGRUB_EFI_STATUS "ld" ++#else ++#define PRIxGRUB_EFI_STATUS "llx" ++#define PRIdGRUB_EFI_STATUS "lld" ++#endif + + #define GRUB_EFI_ERROR_CODE(value) \ + ((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) +-- +2.13.0 + diff --git a/0172-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch b/0172-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch new file mode 100644 index 00000000..b03c4284 --- /dev/null +++ b/0172-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch @@ -0,0 +1,46 @@ +From 1f89a67ef084f8248c3b0727b09c247f8ccbdaa0 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 26 Jun 2017 12:42:57 -0400 +Subject: [PATCH 172/176] Don't use dynamic sized arrays since we don't build + with -std=c99 + +--- + grub-core/net/net.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 4be228d95..fa3e29126 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1853,14 +1853,25 @@ grub_net_search_configfile (char *config) + { + /* By the Client UUID. */ + +- char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) + +- sizeof ("_clientuuid") + 1]; +- grub_snprintf (client_uuid_var, sizeof (client_uuid_var), ++ char *client_uuid_var; ++ grub_size_t client_uuid_var_size; ++ ++ client_uuid_var_size = grub_snprintf (NULL, 0, ++ "net_%s_clientuuid", inf->name); ++ if (client_uuid_var_size <= 0) ++ continue; ++ client_uuid_var_size += 1; ++ client_uuid_var = grub_malloc(client_uuid_var_size); ++ if (!client_uuid_var) ++ continue; ++ grub_snprintf (client_uuid_var, client_uuid_var_size, + "net_%s_clientuuid", inf->name); + + const char *client_uuid; + client_uuid = grub_env_get (client_uuid_var); + ++ grub_free(client_uuid_var); ++ + if (client_uuid) + { + grub_strcpy (suffix, client_uuid); +-- +2.13.0 + diff --git a/0173-don-t-ignore-const.patch b/0173-don-t-ignore-const.patch new file mode 100644 index 00000000..ae792bd6 --- /dev/null +++ b/0173-don-t-ignore-const.patch @@ -0,0 +1,25 @@ +From 371541bc350dd5ec10146b33daa001dfa095da21 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 26 Jun 2017 12:43:22 -0400 +Subject: [PATCH 173/176] don't ignore const + +--- + grub-core/net/tftp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index dcd824943..f90071353 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -307,7 +307,7 @@ static void + grub_normalize_filename (char *normalized, const char *filename) + { + char *dest = normalized; +- char *src = filename; ++ const char *src = filename; + + while (*src != '\0') + { +-- +2.13.0 + diff --git a/0174-don-t-use-int-for-efi-status.patch b/0174-don-t-use-int-for-efi-status.patch new file mode 100644 index 00000000..aadb7e98 --- /dev/null +++ b/0174-don-t-use-int-for-efi-status.patch @@ -0,0 +1,25 @@ +From 172306859da85eff8f30703ccdc37682b42b0651 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 26 Jun 2017 12:44:59 -0400 +Subject: [PATCH 174/176] don't use int for efi status + +--- + grub-core/kern/efi/efi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 1f3ac5e1d..2b60a6e27 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -157,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) + void + grub_exit (int retval) + { +- int rc = GRUB_EFI_LOAD_ERROR; ++ grub_efi_status_t rc = GRUB_EFI_LOAD_ERROR; + + if (retval == 0) + rc = GRUB_EFI_SUCCESS; +-- +2.13.0 + diff --git a/0175-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0175-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch new file mode 100644 index 00000000..68582f9c --- /dev/null +++ b/0175-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -0,0 +1,32 @@ +From 52df08715426a2c59829e6248fec2d729b869417 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 26 Jun 2017 12:46:23 -0400 +Subject: [PATCH 175/176] make GRUB_MOD_INIT() declare its function prototypes. + +--- + include/grub/dl.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 2bca56ce0..b1ed3c333 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -54,6 +54,7 @@ grub_mod_fini (void) + + #define GRUB_MOD_INIT(name) \ + static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ ++extern void grub_##name##_init (void); \ + void \ + grub_##name##_init (void) { grub_mod_init (0); } \ + static void \ +@@ -61,6 +62,7 @@ grub_mod_init (grub_dl_t mod __attribute__ ((unused))) + + #define GRUB_MOD_FINI(name) \ + static void grub_mod_fini (void) __attribute__ ((used)); \ ++extern void grub_##name##_fini (void); \ + void \ + grub_##name##_fini (void) { grub_mod_fini (); } \ + static void \ +-- +2.13.0 + diff --git a/0176-Clean-up-some-errors-in-the-linuxefi-loader.patch b/0176-Clean-up-some-errors-in-the-linuxefi-loader.patch new file mode 100644 index 00000000..fa3fe26e --- /dev/null +++ b/0176-Clean-up-some-errors-in-the-linuxefi-loader.patch @@ -0,0 +1,69 @@ +From 1c44d6203c0e783b3b50c33e24b78445ff8dabb3 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 24 May 2017 15:58:18 -0400 +Subject: [PATCH 176/176] Clean up some errors in the linuxefi loader + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index ed8cc40a0..19950d2f2 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -161,8 +161,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + int argc, char *argv[]) + { + grub_file_t file = 0; +- struct linux_kernel_header *lh; +- grub_ssize_t len, start, filelen; ++ struct linux_kernel_header *lh = NULL; ++ grub_ssize_t start, filelen; + void *kernel = NULL; + int setup_header_end_offset; + int rc; +@@ -212,18 +212,19 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- grub_dprintf ("linuxefi", "params = %p\n", (unsigned long) params); ++ grub_dprintf ("linuxefi", "params = %p\n", params); + + grub_memset (params, 0, sizeof(*params)); + + setup_header_end_offset = *((grub_uint8_t *)kernel + 0x201); +- grub_dprintf ("linuxefi", "copying %d bytes from %p to %p\n", +- MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1, ++ grub_dprintf ("linuxefi", "copying %zu bytes from %p to %p\n", ++ MIN((grub_size_t)0x202+setup_header_end_offset, ++ sizeof (*params)) - 0x1f1, + (grub_uint8_t *)kernel + 0x1f1, + (grub_uint8_t *)params + 0x1f1); + grub_memcpy ((grub_uint8_t *)params + 0x1f1, + (grub_uint8_t *)kernel + 0x1f1, +- MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1); ++ MIN((grub_size_t)0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1); + lh = (struct linux_kernel_header *)params; + grub_dprintf ("linuxefi", "lh is at %p\n", lh); + grub_dprintf ("linuxefi", "checking lh->boot_flag\n"); +@@ -297,7 +298,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + handover_offset = lh->handover_offset; + + start = (lh->setup_sects + 1) * 512; +- len = grub_file_size(file) - start; + + kernel_mem = grub_efi_allocate_pages(lh->pref_address, + BYTES_TO_PAGES(lh->init_size)); +@@ -343,7 +343,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + loaded = 0; + } + +- if (linux_cmdline && !loaded) ++ if (linux_cmdline && lh && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) + linux_cmdline, + BYTES_TO_PAGES(lh->cmdline_size + 1)); +-- +2.13.0 + diff --git a/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index 598f254a..c3785c9f 100644 --- a/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -1,8 +1,7 @@ -From 5dbc4254266d8d8d64d5d2fe2ad02ff200f4a7a6 Mon Sep 17 00:00:00 2001 +From f936ec025e26ed98ae25786a2d931035cf482949 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 25 Jun 2015 15:11:36 -0400 -Subject: [PATCH 10005/10006] Make a "gdb" dprintf that tells us load - addresses. +Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses. This makes a grub_dprintf() call during platform init and during module loading that tells us the virtual addresses of the .text and .data @@ -14,20 +13,20 @@ to any such binaries. Signed-off-by: Peter Jones --- - grub-core/kern/dl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ - grub-core/kern/efi/efi.c | 5 +++-- + grub-core/kern/dl.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ + grub-core/kern/efi/efi.c | 4 ++-- grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++- include/grub/efi/efi.h | 2 +- - 4 files changed, 81 insertions(+), 4 deletions(-) + 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 247cd0a..f29691c 100644 +index 6210709..a314ac7 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -457,6 +457,24 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) +@@ -456,6 +456,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) + return s; return NULL; } - +static long +grub_dl_find_section_index (Elf_Ehdr *e, const char *name) +{ @@ -45,14 +44,13 @@ index 247cd0a..f29691c 100644 + return (long)i; + return -1; +} -+ + /* Me, Vladimir Serbinenko, hereby I add this module check as per new GNU module policy. Note that this license check is informative only. - Modules have to be licensed under GPLv3 or GPLv3+ (optionally -@@ -600,6 +618,38 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +@@ -599,6 +616,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + return GRUB_ERR_NONE; } - +static void +grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) +{ @@ -84,11 +82,10 @@ index 247cd0a..f29691c 100644 + GRUB_TARGET_CPU, GRUB_PLATFORM, + mod->name, text); +} -+ + /* Load a module from core memory. */ grub_dl_t - grub_dl_load_core_noinit (void *addr, grub_size_t size) -@@ -658,6 +708,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) +@@ -658,6 +706,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) grub_dprintf ("modules", "module name: %s\n", mod->name); grub_dprintf ("modules", "init function: %p\n", mod->init); @@ -98,7 +95,7 @@ index 247cd0a..f29691c 100644 { grub_dl_unload (mod); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 101307f..7492f9d 100644 +index 1f3ac5e..d70d091 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -274,7 +274,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -110,15 +107,7 @@ index 101307f..7492f9d 100644 { grub_efi_loaded_image_t *image; struct grub_pe32_header *header; -@@ -288,6 +288,7 @@ grub_efi_modules_addr (void) - if (! image) - return 0; - -+ - header = image->image_base; - coff_header = &(header->coff_header); - sections -@@ -299,7 +300,7 @@ grub_efi_modules_addr (void) +@@ -299,7 +299,7 @@ grub_efi_modules_addr (void) i < coff_header->num_sections; i++, section++) { @@ -128,7 +117,7 @@ index 101307f..7492f9d 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index a5b6c1d..9939fde 100644 +index f7782b6..79243b3 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -59,10 +59,33 @@ grub_efi_env_init (void) @@ -175,12 +164,12 @@ index a5b6c1d..9939fde 100644 } diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 9a2da0e..37d57d8 100644 +index 4f3c1a4..77ef79b 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -84,7 +84,7 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, - char **device, - char **path); +@@ -115,7 +115,7 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); + #endif -grub_addr_t grub_efi_modules_addr (void); +grub_addr_t grub_efi_section_addr (const char *section); @@ -188,5 +177,5 @@ index 9a2da0e..37d57d8 100644 void grub_efi_mm_init (void); void grub_efi_mm_fini (void); -- -2.5.0 +2.13.0 diff --git a/gitignore b/gitignore index 18ab8e81..eca17bec 100644 --- a/gitignore +++ b/gitignore @@ -246,3 +246,4 @@ build-aux/test-driver /garbage-gen /garbage-gen.exe /grub-fs-tester +grub-core/build-grub-module-verifier diff --git a/grub-2.02-beta3-to-origin-master.patch b/grub-2.02-beta3-to-origin-master.patch deleted file mode 100644 index f4454f83..00000000 --- a/grub-2.02-beta3-to-origin-master.patch +++ /dev/null @@ -1,359 +0,0 @@ -From: Peter Jones -Date: Wed Jul 22 10:18:00 2015 -0400 -Subject: Stop trying to "git format-patch" across a merge that confuses it - -diff --git a/Makefile.util.def b/Makefile.util.def -index ed9b4c697dae038655ca7740f59285bd9044709b..f9caccb9780ffe8d4b31c8a19399ba7bbd308e56 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -416,7 +416,7 @@ program = { - ldadd = libgrubgcry.a; - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; -- ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; -+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - }; - - data = { -diff --git a/NEWS b/NEWS -index c9a975219fcc24162858e461f439886c4cb3841e..572eadb3ef27138481e91643b8bb60d27ce867c8 100644 ---- a/NEWS -+++ b/NEWS -@@ -18,6 +18,7 @@ New in 2.02: - * ZFS features support. - * ZFS LZ4 support. - * XFS V5 format support. -+ * LVM RAID1 support. - - * New/improved terminal and video support: - * Monochrome text (matching `hercules' in GRUB Legacy). -@@ -49,6 +50,7 @@ New in 2.02: - * Improve TFTP robustness. - * Parse `nd' disk names in GRUB Legacy configuration files. - * Issue separate DNS queries for IPv4 and IPv6. -+ * Support IPv6 Router Advertisement to configure default router. - - * Coreboot improvements: - * CBFS support both in on-disk images (loopback) and flash. -@@ -96,6 +98,8 @@ New in 2.02: - EFI Stall. If everything fails, use hardcoded frequency 800MHz. - * Support Hyper-V Gen2 platforms which lack PIT for TSC calibration. - * Map UEFI Persistent Memory to E820 persistent memory. -+ * New Xen loader on ARM64. -+ * Respect alignment requirement for block device IO buffers on EFI. - - * Security: - * Add optional facility to enforce that all files read by the core image -@@ -134,6 +138,11 @@ New in 2.02: - menu entry immediately. - * New `file' command and grub-file utility to check file types. - * New syslinux configuration file parser. -+ * Set menu entry class to primary OS name returned by os-prober to display -+ OS specific icon. -+ * On Linux x86 detect EFI word size in grub-install and automatically select -+ correct platform (x86_64-efi or i386-efi) to install. Requires Linux kernel -+ 4.0 or higher. - - * Build system: - * Remove all uses of nested functions; GRUB no longer requires an -@@ -160,6 +169,8 @@ New in 2.02: - * emu libusb support removed (was broken and unmaintained). - * powerpc64le compile support. - * Use fixed timestamp when generating GRUB image for reproducible builds. -+ * Verify at build time that modules contain only supported relocations and their -+ structure matches what boot-time module loader expects. - - * Revision control moved to git. - -diff --git a/configure.ac b/configure.ac -index a85b134ec58296e4f128b116918cb1c64ee17ecc..9ddfc53235396f7542a1c3f3b8076e0bddefe0a5 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -388,7 +388,8 @@ fi - - # Check for functions and headers. - AC_CHECK_FUNCS(posix_memalign memalign getextmntent) --AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h) -+AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h) -+AC_HEADER_MAJOR - - AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default - #include -@@ -1185,9 +1186,9 @@ CFLAGS="$TARGET_CFLAGS" - # Position independent executable. - grub_CHECK_PIE - [# Need that, because some distributions ship compilers that include --# `-fPIE' in the default specs. -+# `-fPIE' or '-fpie' in the default specs. - if [ x"$pie_possible" = xyes ]; then -- TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" -+ TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie" - fi] - - CFLAGS="$TARGET_CFLAGS" -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 67a67cf40dae4c00355bc4e93d32d449c45ff4c2..c9c8374bf614b4e39b5e57fd813e4e587e256679 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -750,19 +750,15 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir, - - if (dir->data->joliet && !ctx.filename) - { -- char *oldname, *semicolon; -+ char *semicolon; - -- oldname = name; - ctx.filename = grub_iso9660_convert_string -- ((grub_uint8_t *) oldname, dirent.namelen >> 1); -+ ((grub_uint8_t *) name, dirent.namelen >> 1); - - semicolon = grub_strrchr (ctx.filename, ';'); - if (semicolon) - *semicolon = '\0'; - -- if (ctx.filename_alloc) -- grub_free (oldname); -- - ctx.filename_alloc = 1; - } - -diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c -index 5836218909876dc3c1bfd5e8ad0239d4b8edb7c8..37f9ad8ac008cdff4f36a2dc6b2083bd55fdf90f 100644 ---- a/grub-core/loader/i386/xen_file.c -+++ b/grub-core/loader/i386/xen_file.c -@@ -55,11 +55,11 @@ grub_xen_file (grub_file_t file) - grub_dprintf ("xen", "found bzimage payload 0x%llx-0x%llx\n", - (unsigned long long) (lh.setup_sects + 1) * 512 - + lh.payload_offset, -- (unsigned long long) lh.payload_length - 4); -+ (unsigned long long) lh.payload_length); - - off_file = grub_file_offset_open (file, (lh.setup_sects + 1) * 512 - + lh.payload_offset, -- lh.payload_length - 4); -+ lh.payload_length); - if (!off_file) - goto fail; - -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index a088244b4cb1ce9f21d02c1f3024a99e681ccb1a..189551a483ab9413cdca27650b20267268fa724a 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -157,6 +157,9 @@ grub_net_configure_by_dhcp_ack (const char *name, - hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - - inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags); -+ if (!inter) -+ return 0; -+ - #if 0 - /* This is likely based on misunderstanding. gateway_ip refers to - address of BOOTP relay and should not be used after BOOTP transaction -@@ -368,6 +371,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), - - if (grub_strcmp (args[3], "string") == 0) - { -+ grub_err_t err = GRUB_ERR_NONE; - char *val = grub_malloc (taglength + 1); - if (!val) - return grub_errno; -@@ -376,8 +380,9 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), - if (args[0][0] == '-' && args[0][1] == 0) - grub_printf ("%s\n", val); - else -- return grub_env_set (args[0], val); -- return GRUB_ERR_NONE; -+ err = grub_env_set (args[0], val); -+ grub_free (val); -+ return err; - } - - if (grub_strcmp (args[3], "number") == 0) -@@ -399,6 +404,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), - - if (grub_strcmp (args[3], "hex") == 0) - { -+ grub_err_t err = GRUB_ERR_NONE; - char *val = grub_malloc (2 * taglength + 1); - int i; - if (!val) -@@ -412,8 +418,9 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), - if (args[0][0] == '-' && args[0][1] == 0) - grub_printf ("%s\n", val); - else -- return grub_env_set (args[0], val); -- return GRUB_ERR_NONE; -+ err = grub_env_set (args[0], val); -+ grub_free (val); -+ return err; - } - - return grub_error (GRUB_ERR_BAD_ARGUMENT, -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 4684f8b333c2a7bca2e1b398f2a9891380fa6696..5aa4ad3befc15ba427797c7f1454d8a322d51b2f 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -381,9 +381,8 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - ptr = nb->tail; - grub_snprintf ((char *) ptr, - sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX-" -- "\r\n" - "\r\n"), -- "Range: bytes=%" PRIuGRUB_UINT64_T "-\r\n\r\n", -+ "Range: bytes=%" PRIuGRUB_UINT64_T "-\r\n", - offset); - grub_netbuff_put (nb, grub_strlen ((char *) ptr)); - } -@@ -450,6 +449,7 @@ http_seek (struct grub_file *file, grub_off_t off) - } - - file->device->net->stall = 0; -+ file->device->net->eof = 0; - file->device->net->offset = off; - - data = grub_zalloc (sizeof (*data)); -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 9424595278c1a09174a32ad0f467d7790a5225e8..10773fc3435fc7a1baf19e9b7cffe3cdcbf7998c 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1346,6 +1346,15 @@ grub_net_open_real (const char *name) - continue; - } - -+ if (grub_strncmp (prefdev, "pxe", sizeof ("pxe") - 1) == 0 && -+ (!prefdev[sizeof ("pxe") - 1] || (prefdev[sizeof("pxe") - 1] == ':'))) -+ { -+ grub_free (prefdev); -+ prefdev = grub_strdup ("tftp"); -+ if (!prefdev) -+ continue; -+ } -+ - comma = grub_strchr (prefdev, ','); - if (comma) - *comma = '\0'; -@@ -1672,6 +1681,7 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset) - file->device->net->packs.last = NULL; - file->device->net->offset = 0; - file->device->net->eof = 0; -+ file->device->net->stall = 0; - err = file->device->net->protocol->open (file, file->device->net->name); - if (err) - return err; -diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c -index 05eda500a4060ac76aef94c6a16d9a1116f6aa39..72e5582752a9cd64d305d847c771b49677e0a0e9 100644 ---- a/grub-core/osdep/devmapper/getroot.c -+++ b/grub-core/osdep/devmapper/getroot.c -@@ -40,6 +40,12 @@ - #include - #endif - -+#if defined(MAJOR_IN_MKDEV) -+#include -+#elif defined(MAJOR_IN_SYSMACROS) -+#include -+#endif -+ - #include - - #include -diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c -index 19c1101fdaca7f5abdef7d22b28a13e180a7e467..a697bcb4d8d91cd97343179fe7977d6806d4191e 100644 ---- a/grub-core/osdep/devmapper/hostdisk.c -+++ b/grub-core/osdep/devmapper/hostdisk.c -@@ -24,6 +24,11 @@ - #include - #include - -+#if defined(MAJOR_IN_MKDEV) -+#include -+#elif defined(MAJOR_IN_SYSMACROS) -+#include -+#endif - - #ifdef HAVE_DEVICE_MAPPER - # include -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 10480b646241d6ca8ede25427e433178c00cea57..09e7e6e6d6644a5bad6607bea6aaaa40ce45a873 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -35,6 +35,12 @@ - #include - #endif - -+#if defined(MAJOR_IN_MKDEV) -+#include -+#elif defined(MAJOR_IN_SYSMACROS) -+#include -+#endif -+ - #include - #include /* ioctl */ - #include -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 1079a919d112f24a2856f0735a1fdcd097d45c3a..4bf37b027be660a14994fb316f08dd478490c4e2 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -51,8 +51,10 @@ - #endif - - #include --#if defined(HAVE_SYS_MKDEV_H) -+#if defined(MAJOR_IN_MKDEV) - #include -+#elif defined(MAJOR_IN_SYSMACROS) -+#include - #endif - - #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) -diff --git a/include/multiboot2.h b/include/multiboot2.h -index 9d4862759af38eb5a9d0fecb1807ef50ba791dee..8b8c1568ae32239d73ad80a3ca64010556d57099 100644 ---- a/include/multiboot2.h -+++ b/include/multiboot2.h -@@ -176,7 +176,7 @@ struct multiboot_mmap_entry - #define MULTIBOOT_MEMORY_BADRAM 5 - multiboot_uint32_t type; - multiboot_uint32_t zero; --} GRUB_PACKED; -+}; - typedef struct multiboot_mmap_entry multiboot_memory_map_t; - - struct multiboot_tag -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 203b076966c0f5ef80eb93e7aebd01848a7c73b9..f8496d28bdf7f4bcbc2413888330834c1e252a64 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -273,6 +273,7 @@ Ensure that there are no errors in /etc/default/grub - and /etc/grub.d/* files or please file a bug report with - %s file attached." "${grub_cfg}.new" >&2 - echo >&2 -+ exit 1 - else - # none of the children aborted with error, install the new grub.cfg - mv -f ${grub_cfg}.new ${grub_cfg} -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5a78513aeae0f6ad866c057564862bda7198a00c..de9044c7f28611d56358f581ac52ca2d2b7fc982 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -47,7 +47,7 @@ esac - # and mounting btrfs requires user space scanning, so force UUID in this case. - if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -- || test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm; then -+ || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} - else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 46045db1aab7b3a7cea758c120cc731eabe93eb9..c48af948d6ecdf672aa341f713912ba15de8f27d 100644 ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in -@@ -47,7 +47,7 @@ esac - # and mounting btrfs requires user space scanning, so force UUID in this case. - if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -- || test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm; then -+ || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} - else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} diff --git a/grub.patches b/grub.patches index 17f67d69..8e4eb2a5 100644 --- a/grub.patches +++ b/grub.patches @@ -1,91 +1,176 @@ -Patch0000: grub-2.02-beta3-to-origin-master.patch -Patch0001: 0001-IBM-client-architecture-CAS-reboot-support.patch -Patch0002: 0002-for-ppc-reset-console-display-attr-when-clear-screen.patch -Patch0003: 0003-Disable-GRUB-video-support-for-IBM-power-machines.patch -Patch0004: 0004-Fix-bzr-s-ignore-artificats-in-.gitignore.patch -Patch0005: 0005-Honor-a-symlink-when-generating-configuration-by-gru.patch -Patch0006: 0006-Move-bash-completion-script-922997.patch -Patch0007: 0007-Update-to-minilzo-2.08.patch -Patch0008: 0008-Add-vlan-tag-support-on-IBM-PPC-machines.patch -Patch0009: 0009-Allow-fallback-to-include-entries-by-title-not-just-.patch -Patch0010: 0010-Add-GRUB_DISABLE_UUID.patch -Patch0011: 0011-Make-exit-take-a-return-code.patch -Patch0012: 0012-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch -Patch0013: 0013-Make-efi-machines-load-an-env-block-from-a-variable.patch -Patch0014: 0014-DHCP-client-ID-and-UUID-options-added.patch -Patch0015: 0015-trim-arp-packets-with-abnormal-size.patch -Patch0016: 0016-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch -Patch0017: 0017-Add-support-for-UEFI-operating-systems-returned-by-o.patch -Patch0018: 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch -Patch0019: 0019-Add-fw_path-variable-revised.patch -Patch0020: 0020-Add-support-for-linuxefi.patch -Patch0021: 0021-Use-linuxefi-and-initrdefi-where-appropriate.patch -Patch0022: 0022-Don-t-allow-insmod-when-secure-boot-is-enabled.patch -Patch0023: 0023-Pass-x-hex-hex-straight-through-unmolested.patch -Patch0024: 0024-Add-X-option-to-printf-functions.patch -Patch0025: 0025-Search-for-specific-config-file-for-netboot.patch -Patch0026: 0026-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch -Patch0027: 0027-Don-t-write-messages-to-the-screen.patch -Patch0028: 0028-Don-t-print-GNU-GRUB-header.patch -Patch0029: 0029-Don-t-add-to-highlighted-row.patch -Patch0030: 0030-Message-string-cleanups.patch -Patch0031: 0031-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch -Patch0032: 0032-Use-the-correct-indentation-for-the-term-help-text.patch -Patch0033: 0033-Indent-menu-entries.patch -Patch0034: 0034-Fix-margins.patch -Patch0035: 0035-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch -Patch0036: 0036-Use-linux16-when-appropriate-880840.patch -Patch0037: 0037-Enable-pager-by-default.-985860.patch -Patch0038: 0038-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch -Patch0039: 0039-Don-t-say-GNU-Linux-in-generated-menus.patch -Patch0040: 0040-Don-t-draw-a-border-around-the-menu.patch -Patch0041: 0041-Use-the-standard-margin-for-the-timeout-string.patch -Patch0042: 0042-Add-.eh_frame-to-list-of-relocations-stripped.patch -Patch0043: 0043-Make-10_linux-work-with-our-changes-for-linux16-and-.patch -Patch0044: 0044-Don-t-print-during-fdt-loading-method.patch -Patch0045: 0045-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch -Patch0046: 0046-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0047: 0047-Don-t-emit-Booting-.-message.patch -Patch0048: 0048-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch -Patch0049: 0049-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0050: 0050-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0051: 0051-Fix-convert-function-to-support-NVMe-devices.patch -Patch0052: 0052-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch -Patch0053: 0053-Use-the-default-device-tree-from-the-grub-default-fi.patch -Patch0054: 0054-reopen-SNP-protocol-for-exclusive-use-by-grub.patch -Patch0055: 0055-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch -Patch0056: 0056-Add-grub_util_readlink.patch -Patch0057: 0057-Make-editenv-chase-symlinks-including-those-across-d.patch -Patch0058: 0058-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0059: 0059-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0060: 0060-Load-arm-with-SB-enabled.patch -Patch0061: 0061-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0062: 0062-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch -Patch0063: 0063-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0064: 0064-Update-info-with-grub.cfg-netboot-selection-order-11.patch -Patch0065: 0065-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch -Patch0066: 0066-Add-friendly-grub2-password-config-tool-985962.patch -Patch0067: 0067-Fix-race-in-EFI-validation.patch -Patch0068: 0068-ppc64le-sync-mkconfig-to-disk-1212114.patch -Patch0069: 0069-Use-device-part-of-chainloader-target-if-present.patch -Patch0070: 0070-Add-secureboot-support-on-efi-chainloader.patch -Patch0071: 0071-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch -Patch0072: 0072-Fix-security-issue-when-reading-username-and-passwor.patch -Patch0073: 0073-Make-grub_fatal-also-backtrace.patch -Patch0074: 0074-Rework-linux-command.patch -Patch0075: 0075-Rework-linux16-command.patch -Patch0076: 0076-Make-grub-editenv-build-again.patch -Patch0077: 0077-Fix-locale-issue-in-grub-setpassword-1294243.patch -Patch0078: 0078-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0079: 0079-Handle-rssd-storage-devices.patch -Patch0080: 0080-Warn-if-grub-password-will-not-be-read-1290803.patch -Patch0081: 0081-Clean-up-grub-setpassword-documentation-1290799.patch -Patch0082: 0082-Re-work-some-intricacies-of-PE-loading.patch -Patch0083: 0083-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch -Patch0084: 0084-linuxefi-fix-double-free-on-verification-failure.patch -Patch0085: 0085-fix-machine-type-test-in-30_os-prober.in.patch -Patch0086: 0086-ppc64le-has-no-separate-boot-mount-1261926.patch -Patch0087: 0087-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0088: 0088-Normalize-slashes-in-tftp-paths.patch -Patch0089: 0089-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch -Patch0090: 0090-efi-chainloader-truncate-overlong-relocation-section.patch +Patch0001: 0001-Bump-version-to-2.03.patch +Patch0002: 0002-Remove-bashisms-from-tests.patch +Patch0003: 0003-fs-tester-make-sh-compatible.patch +Patch0004: 0004-support-busybox-date.patch +Patch0005: 0005-Don-t-retrieve-fstime-when-it-s-not-useful.patch +Patch0006: 0006-Support-lseek64.patch +Patch0007: 0007-Use-SHELL-rather-than-bin-sh.patch +Patch0008: 0008-po-Use-SHELL-rather-than-bin-sh.patch +Patch0009: 0009-Add-termux-path-to-dict.patch +Patch0010: 0010-Fix-shebang-for-termux.patch +Patch0011: 0011-Add-strtoull-test.patch +Patch0012: 0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch +Patch0013: 0013-Add-Virtual-LAN-support.patch +Patch0014: 0014-mkimage-Pass-layout-to-mkimage_generate_elfXX-rather.patch +Patch0015: 0015-Refactor-arm-uboot-code-to-make-it-genereic.patch +Patch0016: 0016-coreboot-Split-parts-that-are-platform-independent.patch +Patch0017: 0017-Rename-uboot-halt.c-to-dummy-halt.c.patch +Patch0018: 0018-Rename-uboot-datetime-to-dummy-datetime.patch +Patch0019: 0019-arm-coreboot-Start-new-port.patch +Patch0020: 0020-Add-support-for-device-tree-based-drivers.patch +Patch0021: 0021-arm-coreboot-Support-for-vexpress-timer.patch +Patch0022: 0022-arm-coreboot-Export-FDT-routines.patch +Patch0023: 0023-at_keyboard-Split-protocol-from-controller-code.patch +Patch0024: 0024-arm_coreboot-Support-keyboard-for-vexpress.patch +Patch0025: 0025-arm_coreboot-Support-grub-mkstandalone.patch +Patch0026: 0026-arm_coreboot-Support-loading-linux-images.patch +Patch0027: 0027-arm_coreboot-Support-DMA.patch +Patch0028: 0028-ehci-Split-core-code-from-PCI-part.patch +Patch0029: 0029-arm_coreboot-Support-EHCI.patch +Patch0030: 0030-Fix-bug-on-FDT-nodes-with-compatible-property.patch +Patch0031: 0031-fdtbus-Add-ability-to-send-receive-messages-on-paren.patch +Patch0032: 0032-rk3288_spi-Add-SPI-driver.patch +Patch0033: 0033-arm_coreboot-Add-Chromebook-keyboard-driver.patch +Patch0034: 0034-Missing-parts-of-previous-commit.patch +Patch0035: 0035-coreboot-Changed-cbmemc-to-support-updated-console-f.patch +Patch0036: 0036-at_keyboard-Fix-falco-chromebook-case.patch +Patch0037: 0037-sparc64-Close-cdboot-ihandle.patch +Patch0038: 0038-arm64-xen_boot-Fix-Xen-boot-using-GRUB2-on-AARCH64.patch +Patch0039: 0039-arm64-Add-nounzip-option-support-in-xen_module-comma.patch +Patch0040: 0040-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch +Patch0041: 0041-arm64-Update-the-introduction-of-Xen-boot-commands-i.patch +Patch0042: 0042-sparc64-Don-t-use-devspec-to-determine-the-OBP-path.patch +Patch0043: 0043-Allow-GRUB-to-mount-ext2-3-4-filesystems-that-have-t.patch +Patch0044: 0044-ehci-Fix-compilation-for-amd64.patch +Patch0045: 0045-cache-Fix-compilation-for-ppc-sparc-and-arm64.patch +Patch0046: 0046-ehci-Fix-compilation-on-i386.patch +Patch0047: 0047-crypto-Fix-use-after-free.patch +Patch0048: 0048-arm-efi-Fix-compilation.patch +Patch0049: 0049-fdt-silence-clang-warning.patch +Patch0050: 0050-Fix-bzr-s-ignore-artificats-in-.gitignore.patch +Patch0051: 0051-IBM-client-architecture-CAS-reboot-support.patch +Patch0052: 0052-for-ppc-reset-console-display-attr-when-clear-screen.patch +Patch0053: 0053-Disable-GRUB-video-support-for-IBM-power-machines.patch +Patch0054: 0054-Honor-a-symlink-when-generating-configuration-by-gru.patch +Patch0055: 0055-Move-bash-completion-script-922997.patch +Patch0056: 0056-Update-to-minilzo-2.08.patch +Patch0057: 0057-Allow-fallback-to-include-entries-by-title-not-just-.patch +Patch0058: 0058-Add-GRUB_DISABLE_UUID.patch +Patch0059: 0059-Make-exit-take-a-return-code.patch +Patch0060: 0060-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch +Patch0061: 0061-Make-efi-machines-load-an-env-block-from-a-variable.patch +Patch0062: 0062-DHCP-client-ID-and-UUID-options-added.patch +Patch0063: 0063-trim-arp-packets-with-abnormal-size.patch +Patch0064: 0064-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +Patch0065: 0065-Add-support-for-UEFI-operating-systems-returned-by-o.patch +Patch0066: 0066-Migrate-PPC-from-Yaboot-to-Grub2.patch +Patch0067: 0067-Add-fw_path-variable-revised.patch +Patch0068: 0068-Add-support-for-linuxefi.patch +Patch0069: 0069-Use-linuxefi-and-initrdefi-where-appropriate.patch +Patch0070: 0070-Don-t-allow-insmod-when-secure-boot-is-enabled.patch +Patch0071: 0071-Pass-x-hex-hex-straight-through-unmolested.patch +Patch0072: 0072-Add-X-option-to-printf-functions.patch +Patch0073: 0073-Search-for-specific-config-file-for-netboot.patch +Patch0074: 0074-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +Patch0075: 0075-Don-t-write-messages-to-the-screen.patch +Patch0076: 0076-Don-t-print-GNU-GRUB-header.patch +Patch0077: 0077-Don-t-add-to-highlighted-row.patch +Patch0078: 0078-Message-string-cleanups.patch +Patch0079: 0079-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +Patch0080: 0080-Use-the-correct-indentation-for-the-term-help-text.patch +Patch0081: 0081-Indent-menu-entries.patch +Patch0082: 0082-Fix-margins.patch +Patch0083: 0083-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +Patch0084: 0084-Use-linux16-when-appropriate-880840.patch +Patch0085: 0085-Enable-pager-by-default.-985860.patch +Patch0086: 0086-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +Patch0087: 0087-Don-t-say-GNU-Linux-in-generated-menus.patch +Patch0088: 0088-Don-t-draw-a-border-around-the-menu.patch +Patch0089: 0089-Use-the-standard-margin-for-the-timeout-string.patch +Patch0090: 0090-Add-.eh_frame-to-list-of-relocations-stripped.patch +Patch0091: 0091-Make-10_linux-work-with-our-changes-for-linux16-and-.patch +Patch0092: 0092-Don-t-print-during-fdt-loading-method.patch +Patch0093: 0093-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +Patch0094: 0094-Don-t-require-a-password-to-boot-entries-generated-b.patch +Patch0095: 0095-Don-t-emit-Booting-.-message.patch +Patch0096: 0096-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +Patch0097: 0097-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0098: 0098-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0099: 0099-Fix-convert-function-to-support-NVMe-devices.patch +Patch0100: 0100-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch +Patch0101: 0101-Use-the-default-device-tree-from-the-grub-default-fi.patch +Patch0102: 0102-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +Patch0103: 0103-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +Patch0104: 0104-Add-grub_util_readlink.patch +Patch0105: 0105-Make-editenv-chase-symlinks-including-those-across-d.patch +Patch0106: 0106-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0107: 0107-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0108: 0108-Load-arm-with-SB-enabled.patch +Patch0109: 0109-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0110: 0110-Update-info-with-grub.cfg-netboot-selection-order-11.patch +Patch0111: 0111-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +Patch0112: 0112-Handle-rssd-storage-devices.patch +Patch0113: 0113-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch +Patch0114: 0114-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0115: 0115-Add-friendly-grub2-password-config-tool-985962.patch +Patch0116: 0116-calibrate_tsc-use-the-Stall-EFI-boot-service-on-GRUB.patch +Patch0117: 0117-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0118: 0118-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch +Patch0119: 0119-tcp-add-window-scaling-support.patch +Patch0120: 0120-efinet-retransmit-if-our-device-is-busy.patch +Patch0121: 0121-Be-more-aggro-about-actually-using-the-configured-ne.patch +Patch0122: 0122-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch +Patch0123: 0123-Fix-security-issue-when-reading-username-and-passwor.patch +Patch0124: 0124-Warn-if-grub-password-will-not-be-read-1290803.patch +Patch0125: 0125-Clean-up-grub-setpassword-documentation-1290799.patch +Patch0126: 0126-Fix-locale-issue-in-grub-setpassword-1294243.patch +Patch0127: 0127-efiemu-Handle-persistent-RAM-and-unknown-possible-fu.patch +Patch0128: 0128-efiemu-Fix-compilation-failure.patch +Patch0129: 0129-Revert-reopen-SNP-protocol-for-exclusive-use-by-grub.patch +Patch0130: 0130-Add-a-url-parser.patch +Patch0131: 0131-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0132: 0132-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0133: 0133-Normalize-slashes-in-tftp-paths.patch +Patch0134: 0134-Fix-malformed-tftp-packets.patch +Patch0135: 0135-Fix-race-in-EFI-validation.patch +Patch0136: 0136-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0137: 0137-Use-device-part-of-chainloader-target-if-present.patch +Patch0138: 0138-Add-secureboot-support-on-efi-chainloader.patch +Patch0139: 0139-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +Patch0140: 0140-Make-grub_fatal-also-backtrace.patch +Patch0141: 0141-Rework-linux-command.patch +Patch0142: 0142-Rework-linux16-command.patch +Patch0143: 0143-Make-grub-editenv-build-again.patch +Patch0144: 0144-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0145: 0145-Re-work-some-intricacies-of-PE-loading.patch +Patch0146: 0146-Rework-even-more-of-efi-chainload-so-non-sb-cases-wo.patch +Patch0147: 0147-linuxefi-fix-double-free-on-verification-failure.patch +Patch0148: 0148-fix-machine-type-test-in-30_os-prober.in.patch +Patch0149: 0149-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch +Patch0150: 0150-efi-chainloader-truncate-overlong-relocation-section.patch +Patch0151: 0151-linuxefi-minor-cleanups.patch +Patch0152: 0152-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +Patch0153: 0153-Fix-up-linux-params-usage.patch +Patch0154: 0154-Make-exit-take-a-return-code.patch +Patch0155: 0155-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch +Patch0156: 0156-Add-some-grub_dprintf-in-the-secure-boot-verify-code.patch +Patch0157: 0157-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0158: 0158-print-more-debug-info-in-our-module-loader.patch +Patch0159: 0159-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0160: 0160-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0161: 0161-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0162: 0162-grub2-btrfs-03-follow_default.patch +Patch0163: 0163-grub2-btrfs-04-grub2-install.patch +Patch0164: 0164-grub2-btrfs-05-grub2-mkconfig.patch +Patch0165: 0165-grub2-btrfs-06-subvol-mount.patch +Patch0166: 0166-No-more-Bootable-Snapshot-submenu-in-grub.cfg.patch +Patch0167: 0167-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0168: 0168-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0169: 0169-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0170: 0170-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0171: 0171-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0172: 0172-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch +Patch0173: 0173-don-t-ignore-const.patch +Patch0174: 0174-don-t-use-int-for-efi-status.patch +Patch0175: 0175-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0176: 0176-Clean-up-some-errors-in-the-linuxefi-loader.patch diff --git a/grub2.spec b/grub2.spec index 4666c917..04f89f41 100644 --- a/grub2.spec +++ b/grub2.spec @@ -39,13 +39,13 @@ %endif -%global tarversion 2.02~beta3 +%global tarversion 2.02 %undefine _missing_build_ids_terminate_build Name: grub2 Epoch: 1 Version: 2.02 -Release: 0.39%{?dist} +Release: 1%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base @@ -58,6 +58,7 @@ Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz Source5: theme.tar.bz2 Source6: gitignore Source7: grub.patches +Source8: strtoull_test.c # generate with do-rebase %include %{SOURCE7} @@ -168,9 +169,12 @@ cd grub-%{tarversion} # place unifont in the '.' from which configure is run cp %{SOURCE4} unifont.pcf.gz cp %{SOURCE6} .gitignore +cp %{SOURCE8} ./grub-core/tests/strtoull_test.c git init echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore echo '!*.[[:digit:]]' > util/.gitignore +echo '!config.h' > grub-core/efiemu/runtime/.gitignore +echo '!config.h' > include/grub/emu/.gitignore git config user.email "%{name}-owner@fedoraproject.org" git config user.name "Fedora Ninjas" git config gc.auto 0 @@ -191,9 +195,12 @@ cd grub-%{tarversion} # place unifont in the '.' from which configure is run cp %{SOURCE4} unifont.pcf.gz cp %{SOURCE6} .gitignore +cp %{SOURCE8} ./grub-core/tests/strtoull_test.c git init echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore echo '!*.[[:digit:]]' > util/.gitignore +echo '!config.h' > grub-core/efiemu/runtime/.gitignore +echo '!config.h' > include/grub/emu/.gitignore git config user.email "%{name}-owner@fedoraproject.org" git config user.name "Fedora Ninjas" git config gc.auto 0 @@ -332,8 +339,11 @@ ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot $RPM_BUILD_ROOT%{_datarootdir}/locale/en -mv $RPM_BUILD_ROOT%{_infodir}/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info -mv $RPM_BUILD_ROOT%{_infodir}/grub-dev.info $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info +cp -a docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info +cp -a docs/grub-dev.info $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info +cp -a grub.html %{name}.html +cp -a grub-dev.html %{name}-dev.html +mv docs/font_char_metrics.png . rm $RPM_BUILD_ROOT%{_infodir}/dir # Defaults @@ -536,8 +546,9 @@ fi %doc grub-%{tarversion}/INSTALL %doc grub-%{tarversion}/NEWS grub-%{tarversion}/README %doc grub-%{tarversion}/THANKS grub-%{tarversion}/TODO -%doc grub-%{tarversion}/grub.html -%doc grub-%{tarversion}/grub-dev.html grub-%{tarversion}/docs/font_char_metrics.png +%doc grub-%{tarversion}/%{name}.html +%doc grub-%{tarversion}/%{name}-dev.html +%doc grub-%{tarversion}/font_char_metrics.png %license grub-%{tarversion}/themes/starfield/COPYING.CC-BY-SA-3.0 %files starfield-theme @@ -547,6 +558,9 @@ fi %{_datarootdir}/grub/themes/starfield %changelog +* Mon Jul 10 2017 Peter Jones - 2.02-1 +- Rebased to newer upstream for fedora-27 + * Wed Feb 01 2017 Stephen Gallagher - 2.02-0.39 - Add missing %%license macro - Fix deps that should have moved to -tools but didn't. diff --git a/sources b/sources index 5d089802..b00976af 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -566c4668b90b610c1f6c0c402cbd6ab0 theme.tar.bz2 -8c28087c5fcb3188f1244b390efffdbe unifont-5.1.20080820.pcf.gz -ab399fc6f74a97d66ff77f04b743149c grub-2.02~beta3.tar.xz +SHA512 (grub-2.02.tar.xz) = cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 +SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649 +SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c diff --git a/strtoull_test.c b/strtoull_test.c new file mode 100644 index 00000000..7da615ff --- /dev/null +++ b/strtoull_test.c @@ -0,0 +1,63 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2016 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 . + */ + +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static void +strtoull_testcase (const char *input, int base, unsigned long long expected, + int num_digits, grub_err_t error) +{ + char *output; + unsigned long long value; + grub_errno = 0; + value = grub_strtoull(input, &output, base); + grub_test_assert (grub_errno == error, + "unexpected error. Expected %d, got %d. Input \"%s\"", + error, grub_errno, input); + if (grub_errno) + { + grub_errno = 0; + return; + } + grub_test_assert (input + num_digits == output, + "unexpected number of digits. Expected %d, got %d, input \"%s\"", + num_digits, (int) (output - input), input); + grub_test_assert (value == expected, + "unexpected return value. Expected %llu, got %llu, input \"\%s\"", + expected, value, input); +} + +static void +strtoull_test (void) +{ + strtoull_testcase ("9", 0, 9, 1, GRUB_ERR_NONE); + strtoull_testcase ("0xaa", 0, 0xaa, 4, GRUB_ERR_NONE); + strtoull_testcase ("0xff", 0, 0xff, 4, GRUB_ERR_NONE); + strtoull_testcase ("0", 10, 0, 1, GRUB_ERR_NONE); + strtoull_testcase ("8", 8, 0, 0, GRUB_ERR_BAD_NUMBER); + strtoull_testcase ("38", 8, 3, 1, GRUB_ERR_NONE); + strtoull_testcase ("7", 8, 7, 1, GRUB_ERR_NONE); + strtoull_testcase ("1]", 16, 1, 1, GRUB_ERR_NONE); + strtoull_testcase ("18446744073709551616", 10, 0, 0, GRUB_ERR_OUT_OF_RANGE); +} + + +GRUB_FUNCTIONAL_TEST (strtoull_test, strtoull_test);