[sys-boot/grub] drop ubuntu-crappatchset completely
This commit is contained in:
+1
-16
@@ -37,21 +37,6 @@ AUX ubuntu-upstream-1.98/970_fix_locale_installation.diff 2332 RMD160 91465a322d
|
||||
AUX ubuntu-upstream-1.98/971_langpacks.diff 1266 RMD160 a9dc3b8c32a4903b8cf8c3b0f65b538b46749100 SHA1 29c681dd01942760f078f889cb9bf66a8a2a24c6 SHA256 c2ec2b37b5fbdd10214150659bca41c3dc016d75060e17d36f191af314222bc5
|
||||
AUX ubuntu-upstream-1.98/974_drive_probe.diff 959 RMD160 639eb5037c1e1e6e3bb58282dc7dd41333a6a7a5 SHA1 1698d3366e2aeb7aeca906059544d955744dd071 SHA256 4e73d0330b5093f48151e65d7bf12bb2a968d6ecfeccf0bdc97a48000cb43b03
|
||||
AUX ubuntu-upstream-1.98/975_hostdisk_hd.diff 4125 RMD160 bc514a49151ca9e155be5bea0974dd564c922f8b SHA1 1bda370ec48ee6660fa6b8ed2c9eaf3c2a84504d SHA256 0c53c9ab6d161c316a0f0d0e9476004f66e44d664c95e23c6324ef821b2970a9
|
||||
AUX ubuntu-upstream-1.99/boot_blocklist_hack.patch 548 RMD160 428131d0fa278c79b2f0cb2612510d94c73d8c06 SHA1 dfd8b4e58113b0c144be5b8a76751cff1a6f4beb SHA256 f6500271bee94aac0304ae69f815f82c5ab741de590eb6cf0de9b61478ac2efe
|
||||
AUX ubuntu-upstream-1.99/branch_devmapper.patch 7452 RMD160 d6795fda0336e1bd09ad07181451b11c40ca2244 SHA1 e57e61e216f08add14b673aedabcf1a48ef29abf SHA256 558b402787aef12f7557246b5c24876ae2f797e8f30d5b0bed938b361f5b578e
|
||||
AUX ubuntu-upstream-1.99/branch_fuse.patch 15086 RMD160 bc4182bd91a24a8fb39089387a2c3b4abdb7849e SHA1 834830c89cd0dce2942118ee9b08052b489e65e0 SHA256 3467f0aaada81c79ab2c8edcb9b97159e289c57db6ad9c6195f588044c860397
|
||||
AUX ubuntu-upstream-1.99/branch_longlinuxcmd.patch 5864 RMD160 533656a855bc69b346c7171356890b4a3d3576e4 SHA1 292744b4d246e4fd78df198e0df167640ae6a695 SHA256 df26f65077def80b71311832f18c2816dd1eda1e04182e35142f3d3a7eb02757
|
||||
AUX ubuntu-upstream-1.99/branch_squash.patch 18554 RMD160 2892b2a93611218f7391cecd6a7ba3566575b995 SHA1 0bd633e2f54240206b2a53b87de077ac333091cf SHA256 f365a9488d6e9af0c4567c90d03eec9b95d35209d50a0e7219296a0782047022
|
||||
AUX ubuntu-upstream-1.99/core_in_fs.patch 918 RMD160 ce705c159e3678d0a1322a71edeff5bed91e0d82 SHA1 ab5d9bb04d8782c50b7cc4ccc796b431d4003a33 SHA256 686d6d00135289de695ad62ea9ea91120f6f558e6e9a0a479a63fa5d2c0c6ae9
|
||||
AUX ubuntu-upstream-1.99/disable_floppies.patch 761 RMD160 dd379cf60c3c93f7ebc3fac9a8e2d62736bb1bce SHA1 3d41900d1c9509bf78ba4086fc53cb3517542713 SHA256 f7b43fe89364e9a335ce541363f823f2dbf069afb00e9c073bf4f757c97947d0
|
||||
AUX ubuntu-upstream-1.99/grub.cfg_400.patch 477 RMD160 22b1dc81336c19269a7461348b735a735b31f088 SHA1 4c358f538384f68356af6e474f386cfc2b937ae8 SHA256 b95351be2601caaa6e074590bd68a8fff751a7c811778fcb6997050e0cb73f79
|
||||
AUX ubuntu-upstream-1.99/grub_legacy_0_based_partitions.patch 1136 RMD160 adcddb60acf4ec6a5394d4637eb775fa2ba86356 SHA1 2a3f3394ccde6c4795bc9ad46709709ecc207833 SHA256 47c352f12ff15eeff41591cbbf622ecb1d1de244443d81930ce58f789fe41e8c
|
||||
AUX ubuntu-upstream-1.99/install_stage2_confusion.patch 690 RMD160 e1a431317ced8bc75bd6409e44fbf0d695aaec17 SHA1 ec74ac9a1a02a01135976cedc261807708f483d1 SHA256 c7739efed11e13fcccf27c23c7002a31aba425ec1f1fb169fa1cee217e4c7e4a
|
||||
AUX ubuntu-upstream-1.99/mkconfig_skip_dmcrypt.patch 1229 RMD160 9127e883e26dde0ca55649875a0681197d170a46 SHA1 2f0d83236ce204064f0f66e2cdb97edce9bbf544 SHA256 725d7a3ce4e95747af21af345ec3ff0f58352f988fc26b48aa64e0524144d072
|
||||
AUX ubuntu-upstream-1.99/mkrescue_diet.patch 2091 RMD160 f04fca4b518fd5ce0775524985d90d69f0500c69 SHA1 13205c574cc8d00fdc63395bb68de593a9ab092a SHA256 69df9fd2e62d490cb4d41f7504296c2b02170930dd85b9d807897b6e896397dc
|
||||
AUX ubuntu-upstream-1.99/olpc_prefix_hack.patch 1078 RMD160 fcb3b50bcaaac92c5324edc9d701b40e17cc8096 SHA1 e4d171006065269b7a08be44a0d92bec6c9c5b94 SHA256 b9239435a2c4d23fceda315dd6617fd1ecfaaa022f84218098f5aa3659335174
|
||||
AUX ubuntu-upstream-1.99/qemu_img_exists.patch 515 RMD160 2680bf0c19c9b745cf93553af10076715a8869b1 SHA1 566ce750b476dc43c18ce8fe99eb5eedebdacf4c SHA256 0467100566eb5307da77a4aefe19f0c2a68a105554ffe4f1e7db49fec76adcc0
|
||||
AUX ubuntu-upstream-1.99/series 333 RMD160 adec53e48c76ae650f02843bdb186a7042cf224d SHA1 e39e5d331cd245e2f134a9d50ab0a4d7eecba426 SHA256 76b8b16aa9923f17e71fb115e96e7dd75fce989cdb56c48083868a3733fe436b
|
||||
AUX ubuntu-upstream/01_uuids_and_lvm_dont_play_along_nicely.diff 611 RMD160 0269ad21a4e5723383b2f04670088cc6b1a1e636 SHA1 344e63b80d9e3d057d41bc50e980a1b1c311a426 SHA256 282635fd75266dfe9222afc892f02a9f9fbc227f05556054531fb63704f9cd55
|
||||
AUX ubuntu-upstream/904_disable_floppies.diff 743 RMD160 bc98e9c85245edac6c666f0eeca51da2b6b9cfb6 SHA1 bdba3cfe65b73c86ab3e74858a6baa3f8b20cf1e SHA256 930b1d38af76e477d4c0d9e357441882da3367fbe107561aa7fc25e8ccad2a80
|
||||
DIST grub-0.97-patches-1.9.tar.bz2 51809 RMD160 a745902212dbd22f4d9f0bb0d563ffd44b429eaa SHA1 1d9da2df8bccef9821ebbbc2f5c5353dbd90bf4d SHA256 6b8445c9260803f059031cbe7475a45fee6499fc2dbd911288af6169455c4028
|
||||
@@ -61,4 +46,4 @@ DIST grub-1.99.tar.xz 2639224 RMD160 d59a47fa40b2be0d5ea5b2b00ff5538cfa147747 SH
|
||||
EBUILD grub-0.97-r22.ebuild 7588 RMD160 86e8c77ec7ee193919bdec359e53a8236a4b4c77 SHA1 212944ff569048769c15fd6676a63e6eea4c0cef SHA256 ff5b303cedd5a05c39f8903fbfb215512ab58f12ff023773d739eb3fa244f8bd
|
||||
EBUILD grub-1.98-r10.ebuild 3654 RMD160 872a03a3073ca18bc853048b65159af52495c915 SHA1 1cb89aa08a8265a97834964661999cfe93c99b6b SHA256 875e175940856ef613be27a65f136772a366c93289100abc07cb083333ae46df
|
||||
EBUILD grub-1.98-r9.ebuild 3799 RMD160 70067983c5394c5f2f876e8be18eee97bf1dd4dd SHA1 149c73a384e913b0d27b7fee61d4d0110cf0eb34 SHA256 271d79ea8be44a6aeebcf9af6676a2c90c4ec43120882225a5b5b8fe3ba4f6d5
|
||||
EBUILD grub-1.99.ebuild 7338 RMD160 92da256f0a1484b604ec5986851841adfe3d4ccd SHA1 f24929ba57770d0375337474983c1a4fefae5b73 SHA256 682ee5addbd8c979b63a19172a84f3202737c83e1ab20f007f3661de7ffd227c
|
||||
EBUILD grub-1.99.ebuild 7112 RMD160 1acebe45c4ce913649062aac6fa562bcff6a3de4 SHA1 a7b04009aa3b420c77adf8215b916f370db7a630 SHA256 deb1e49ee9761ad0e38331dee53705d4004496f50f902a34925ef50797934ded
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Index: b/util/grub-setup.c
|
||||
===================================================================
|
||||
--- a/util/grub-setup.c
|
||||
+++ b/util/grub-setup.c
|
||||
@@ -541,6 +541,15 @@
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (core_path_dev);
|
||||
+
|
||||
+ if (grub_errno == GRUB_ERR_FILE_NOT_FOUND)
|
||||
+ {
|
||||
+ /* Clean the previous grub_errno */
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ strcpy (core_path_dev, "/grub/core.img");
|
||||
+ file = grub_file_open (core_path_dev);
|
||||
+ }
|
||||
+
|
||||
if (file)
|
||||
{
|
||||
if (grub_file_size (file) != core_size)
|
||||
@@ -1,285 +0,0 @@
|
||||
Description: Support for partitioned loop devices; improved devmapper support
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/devmapper/
|
||||
Forwarded: not-needed
|
||||
Last-Update: 2011-03-11
|
||||
|
||||
Index: b/grub-core/kern/emu/getroot.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/getroot.c
|
||||
+++ b/grub-core/kern/emu/getroot.c
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <stdint.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+# include <libdevmapper.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef __GNU__
|
||||
#include <hurd.h>
|
||||
#include <hurd/lookup.h>
|
||||
@@ -629,32 +633,65 @@
|
||||
}
|
||||
|
||||
static int
|
||||
-grub_util_is_dmraid (const char *os_dev)
|
||||
+grub_util_is_lvm (const char *os_dev)
|
||||
{
|
||||
- if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
|
||||
- return 1;
|
||||
+ if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
|
||||
+ return 0;
|
||||
+
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+ {
|
||||
+ struct dm_tree *tree;
|
||||
+ uint32_t maj, min;
|
||||
+ struct dm_tree_node *node = NULL;
|
||||
+ const char *node_uuid;
|
||||
+ struct stat st;
|
||||
|
||||
- return 0;
|
||||
+ if (stat (os_dev, &st) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ tree = dm_tree_create ();
|
||||
+ if (! tree)
|
||||
+ {
|
||||
+ grub_printf ("Failed to create tree\n");
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_create failed\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ maj = major (st.st_rdev);
|
||||
+ min = minor (st.st_rdev);
|
||||
+
|
||||
+ if (! dm_tree_add_dev (tree, maj, min))
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ node = dm_tree_find_node (tree, maj, min);
|
||||
+ if (! node)
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ node_uuid = dm_tree_node_get_uuid (node);
|
||||
+ if (! node_uuid)
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "LVM-", 4) != 0)
|
||||
+ {
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ dm_tree_free (tree);
|
||||
+ return 1;
|
||||
+ }
|
||||
+#else
|
||||
+ return 1;
|
||||
+#endif /* HAVE_DEVICE_MAPPER */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -666,13 +703,11 @@
|
||||
return GRUB_DEV_ABSTRACTION_NONE;
|
||||
|
||||
/* Check for LVM. */
|
||||
- if (!strncmp (os_dev, "/dev/mapper/", 12)
|
||||
- && ! grub_util_is_dmraid (os_dev)
|
||||
- && strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
|
||||
+ if (grub_util_is_lvm (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_LVM;
|
||||
|
||||
/* Check for RAID. */
|
||||
- if (!strncmp (os_dev, "/dev/md", 7))
|
||||
+ if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_RAID;
|
||||
#endif
|
||||
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <grub/err.h>
|
||||
#include <grub/emu/misc.h>
|
||||
#include <grub/emu/hostdisk.h>
|
||||
+#include <grub/emu/getroot.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/list.h>
|
||||
@@ -324,18 +325,23 @@
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
-#ifdef HAVE_DEVICE_MAPPER
|
||||
-static int
|
||||
-device_is_mapped (const char *dev)
|
||||
+int
|
||||
+grub_util_device_is_mapped (const char *dev)
|
||||
{
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
struct stat st;
|
||||
|
||||
+ if (!grub_device_mapper_supported ())
|
||||
+ return 0;
|
||||
+
|
||||
if (stat (dev, &st) < 0)
|
||||
return 0;
|
||||
|
||||
return dm_is_dm_major (major (st.st_rdev));
|
||||
-}
|
||||
+#else
|
||||
+ return 0;
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
+}
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
|
||||
static grub_disk_addr_t
|
||||
@@ -350,7 +356,7 @@
|
||||
# endif /* !defined(HAVE_DIOCGDINFO) */
|
||||
|
||||
# ifdef HAVE_DEVICE_MAPPER
|
||||
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
|
||||
+ if (grub_util_device_is_mapped (dev)) {
|
||||
struct dm_task *task = NULL;
|
||||
grub_uint64_t start, length;
|
||||
char *target_type, *params, *space;
|
||||
@@ -1047,6 +1053,54 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+static int
|
||||
+grub_util_get_dm_node_linear_info (const char *dev,
|
||||
+ int *maj, int *min)
|
||||
+{
|
||||
+ struct dm_task *dmt;
|
||||
+ void *next = NULL;
|
||||
+ uint64_t length, start;
|
||||
+ char *target, *params;
|
||||
+ char *ptr;
|
||||
+ int major, minor;
|
||||
+
|
||||
+ dmt = dm_task_create(DM_DEVICE_TABLE);
|
||||
+ if (!dmt)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!dm_task_set_name(dmt, dev))
|
||||
+ return 0;
|
||||
+ dm_task_no_open_count(dmt);
|
||||
+ if (!dm_task_run(dmt))
|
||||
+ return 0;
|
||||
+ next = dm_get_next_target(dmt, next, &start, &length,
|
||||
+ &target, ¶ms);
|
||||
+ if (grub_strcmp (target, "linear") != 0)
|
||||
+ return 0;
|
||||
+ major = grub_strtoul (params, &ptr, 10);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (*ptr != ':')
|
||||
+ return 0;
|
||||
+ ptr++;
|
||||
+ minor = grub_strtoul (ptr, 0, 10);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (maj)
|
||||
+ *maj = major;
|
||||
+ if (min)
|
||||
+ *min = minor;
|
||||
+ return 1;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static char *
|
||||
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
|
||||
{
|
||||
@@ -1223,9 +1277,39 @@
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
- else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
+ if (strncmp (node_uuid, "LVM-", 4) == 0)
|
||||
{
|
||||
+ grub_dprintf ("hostdisk", "%s is an LVM\n", path);
|
||||
+ node = NULL;
|
||||
+ goto devmapper_out;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "mpath-", 6) == 0)
|
||||
+ {
|
||||
+ /* Multipath partitions have partN-mpath-* UUIDs, and are
|
||||
+ linear mappings so are handled by
|
||||
+ grub_util_get_dm_node_linear_info. Multipath disks are not
|
||||
+ linear mappings and must be handled specially. */
|
||||
+ grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
|
||||
+ mapper_name = dm_tree_node_get_name (node);
|
||||
+ goto devmapper_out;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
+ {
|
||||
+ int major, minor;
|
||||
+ const char *node_name;
|
||||
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
|
||||
+
|
||||
+ if ((node_name = dm_tree_node_get_name (node))
|
||||
+ && grub_util_get_dm_node_linear_info (node_name,
|
||||
+ &major, &minor))
|
||||
+ {
|
||||
+ if (tree)
|
||||
+ dm_tree_free (tree);
|
||||
+ free (path);
|
||||
+ char *ret = grub_find_device (NULL, (major << 8) | minor);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
Index: b/include/grub/emu/misc.h
|
||||
===================================================================
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path)
|
||||
__attribute__ ((warn_unused_result));
|
||||
+int
|
||||
+grub_util_device_is_mapped (const char *dev);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
@@ -1,613 +0,0 @@
|
||||
Description: Add grub-mount utility
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/fuse/
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-01/msg00056.html
|
||||
Last-Update: 2011-04-08
|
||||
|
||||
Index: b/Makefile.util.def
|
||||
===================================================================
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -216,6 +216,21 @@
|
||||
};
|
||||
|
||||
program = {
|
||||
+ name = grub-mount;
|
||||
+ mansection = 1;
|
||||
+ common_nodist = grub_fstest_init.c;
|
||||
+ common = util/grub-mount.c;
|
||||
+ common = grub-core/kern/emu/hostfs.c;
|
||||
+ common = grub-core/disk/host.c;
|
||||
+
|
||||
+ ldadd = libgrubmods.a;
|
||||
+ ldadd = libgrubkern.a;
|
||||
+ ldadd = grub-core/gnulib/libgnu.a;
|
||||
+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)' '-lfuse';
|
||||
+ condition = COND_GRUB_MOUNT;
|
||||
+};
|
||||
+
|
||||
+program = {
|
||||
name = grub-mkfont;
|
||||
mansection = 1;
|
||||
common = util/grub-mkfont.c;
|
||||
Index: b/configure.ac
|
||||
===================================================================
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -856,6 +856,37 @@
|
||||
AC_SUBST([freetype_cflags])
|
||||
AC_SUBST([freetype_libs])
|
||||
|
||||
+AC_ARG_ENABLE([grub-mount],
|
||||
+ [AS_HELP_STRING([--enable-grub-mount],
|
||||
+ [build and install the `grub-mount' utility (default=guessed)])])
|
||||
+if test x"$enable_grub_mount" = xno ; then
|
||||
+ grub_mount_excuse="explicitly disabled"
|
||||
+fi
|
||||
+
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+ AC_CHECK_LIB([fuse], [fuse_main_real], [],
|
||||
+ [grub_mount_excuse="need FUSE library"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+ # Check for fuse headers.
|
||||
+ SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
+ CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
|
||||
+ AC_CHECK_HEADERS([fuse/fuse.h], [],
|
||||
+ [grub_mount_excuse=["need FUSE headers"]])
|
||||
+ CPPFLAGS="$SAVED_CPPFLAGS"
|
||||
+fi
|
||||
+
|
||||
+if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
|
||||
+ AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
|
||||
+fi
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+enable_grub_mount=yes
|
||||
+else
|
||||
+enable_grub_mount=no
|
||||
+fi
|
||||
+AC_SUBST([enable_grub_mount])
|
||||
+
|
||||
AC_ARG_ENABLE([device-mapper],
|
||||
[AS_HELP_STRING([--enable-device-mapper],
|
||||
[enable Linux device-mapper support (default=guessed)])])
|
||||
@@ -958,6 +989,7 @@
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||
+AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
||||
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
||||
@@ -1034,5 +1066,10 @@
|
||||
else
|
||||
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
||||
fi
|
||||
+if [ x"$grub_mount_excuse" = x ]; then
|
||||
+echo grub-mount: Yes
|
||||
+else
|
||||
+echo grub-mount: No "($grub_mount_excuse)"
|
||||
+fi
|
||||
echo "*******************************************************"
|
||||
]
|
||||
Index: b/docs/man/grub-mount.h2m
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/docs/man/grub-mount.h2m
|
||||
@@ -0,0 +1,2 @@
|
||||
+[NAME]
|
||||
+grub-mount \- export GRUB filesystem with FUSE
|
||||
Index: b/util/grub-mount.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/util/grub-mount.c
|
||||
@@ -0,0 +1,508 @@
|
||||
+/* grub-mount.c - FUSE driver for filesystems that GRUB understands */
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+#define FUSE_USE_VERSION 26
|
||||
+#include <config.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/emu/misc.h>
|
||||
+#include <grub/util/misc.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/device.h>
|
||||
+#include <grub/disk.h>
|
||||
+#include <grub/file.h>
|
||||
+#include <grub/fs.h>
|
||||
+#include <grub/env.h>
|
||||
+#include <grub/term.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/lib/hexdump.h>
|
||||
+#include <grub/crypto.h>
|
||||
+#include <grub/command.h>
|
||||
+#include <grub/i18n.h>
|
||||
+#include <fuse/fuse.h>
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include "progname.h"
|
||||
+#include "argp.h"
|
||||
+
|
||||
+static char *root = NULL;
|
||||
+grub_device_t dev = NULL;
|
||||
+grub_fs_t fs = NULL;
|
||||
+static char **images = NULL;
|
||||
+static char *debug_str = NULL;
|
||||
+static char **fuse_args = NULL;
|
||||
+static int fuse_argc = 0;
|
||||
+static int num_disks = 0;
|
||||
+
|
||||
+static grub_err_t
|
||||
+execute_command (char *name, int n, char **args)
|
||||
+{
|
||||
+ grub_command_t cmd;
|
||||
+
|
||||
+ cmd = grub_command_find (name);
|
||||
+ if (! cmd)
|
||||
+ grub_util_error (_("can\'t find command %s"), name);
|
||||
+
|
||||
+ return (cmd->func) (cmd, n, args);
|
||||
+}
|
||||
+
|
||||
+/* Translate GRUB error numbers into OS error numbers. Print any unexpected
|
||||
+ errors. */
|
||||
+static int
|
||||
+translate_error (void)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ switch (grub_errno)
|
||||
+ {
|
||||
+ case GRUB_ERR_NONE:
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_OUT_OF_MEMORY:
|
||||
+ grub_print_error ();
|
||||
+ ret = -ENOMEM;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_BAD_FILE_TYPE:
|
||||
+ /* This could also be EISDIR. Take a guess. */
|
||||
+ ret = -ENOTDIR;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_FILE_NOT_FOUND:
|
||||
+ ret = -ENOENT;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_FILE_READ_ERROR:
|
||||
+ case GRUB_ERR_READ_ERROR:
|
||||
+ case GRUB_ERR_IO:
|
||||
+ grub_print_error ();
|
||||
+ ret = -EIO;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_SYMLINK_LOOP:
|
||||
+ ret = -ELOOP;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ grub_print_error ();
|
||||
+ ret = -EINVAL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Any previous errors were handled. */
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_getattr (const char *path, struct stat *st)
|
||||
+{
|
||||
+ char *filename, *pathname, *path2;
|
||||
+ const char *pathname_t;
|
||||
+ struct grub_dirhook_info file_info;
|
||||
+ int file_exists = 0;
|
||||
+
|
||||
+ /* A hook for iterating directories. */
|
||||
+ auto int find_file (const char *cur_filename,
|
||||
+ const struct grub_dirhook_info *info);
|
||||
+ int find_file (const char *cur_filename,
|
||||
+ const struct grub_dirhook_info *info)
|
||||
+ {
|
||||
+ if ((info->case_insensitive ? grub_strcasecmp (cur_filename, filename)
|
||||
+ : grub_strcmp (cur_filename, filename)) == 0)
|
||||
+ {
|
||||
+ file_info = *info;
|
||||
+ file_exists = 1;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (path[0] == '/' && path[1] == 0)
|
||||
+ {
|
||||
+ st->st_dev = 0;
|
||||
+ st->st_ino = 0;
|
||||
+ st->st_mode = 0555 | S_IFDIR;
|
||||
+ st->st_uid = 0;
|
||||
+ st->st_gid = 0;
|
||||
+ st->st_rdev = 0;
|
||||
+ st->st_size = 0;
|
||||
+ st->st_blksize = 512;
|
||||
+ st->st_blocks = (st->st_blksize + 511) >> 9;
|
||||
+ st->st_atime = st->st_mtime = st->st_ctime = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ file_exists = 0;
|
||||
+
|
||||
+ pathname_t = grub_strchr (path, ')');
|
||||
+ if (! pathname_t)
|
||||
+ pathname_t = path;
|
||||
+ else
|
||||
+ pathname_t++;
|
||||
+ pathname = xstrdup (pathname_t);
|
||||
+
|
||||
+ /* Remove trailing '/'. */
|
||||
+ while (*pathname && pathname[grub_strlen (pathname) - 1] == '/')
|
||||
+ pathname[grub_strlen (pathname) - 1] = 0;
|
||||
+
|
||||
+ /* Split into path and filename. */
|
||||
+ filename = grub_strrchr (pathname, '/');
|
||||
+ if (! filename)
|
||||
+ {
|
||||
+ path2 = grub_strdup ("/");
|
||||
+ filename = pathname;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ filename++;
|
||||
+ path2 = grub_strdup (pathname);
|
||||
+ path2[filename - pathname] = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* It's the whole device. */
|
||||
+ (fs->dir) (dev, path2, find_file);
|
||||
+
|
||||
+ grub_free (path2);
|
||||
+ if (!file_exists)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+ st->st_dev = 0;
|
||||
+ st->st_ino = 0;
|
||||
+ st->st_mode = file_info.dir ? (0555 | S_IFDIR) : (0444 | S_IFREG);
|
||||
+ st->st_uid = 0;
|
||||
+ st->st_gid = 0;
|
||||
+ st->st_rdev = 0;
|
||||
+ if (!file_info.dir)
|
||||
+ {
|
||||
+ grub_file_t file;
|
||||
+ file = grub_file_open (path);
|
||||
+ if (! file)
|
||||
+ return translate_error ();
|
||||
+ st->st_size = file->size;
|
||||
+ grub_file_close (file);
|
||||
+ }
|
||||
+ else
|
||||
+ st->st_size = 0;
|
||||
+ st->st_blksize = 512;
|
||||
+ st->st_blocks = (st->st_size + 511) >> 9;
|
||||
+ st->st_atime = st->st_mtime = st->st_ctime = file_info.mtimeset
|
||||
+ ? file_info.mtime : 0;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_opendir (const char *path, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* FIXME */
|
||||
+static grub_file_t files[65536];
|
||||
+static int first_fd = 1;
|
||||
+
|
||||
+static int
|
||||
+fuse_open (const char *path, struct fuse_file_info *fi __attribute__ ((unused)))
|
||||
+{
|
||||
+ grub_file_t file;
|
||||
+ file = grub_file_open (path);
|
||||
+ if (! file)
|
||||
+ return translate_error ();
|
||||
+ files[first_fd++] = file;
|
||||
+ fi->fh = first_fd;
|
||||
+ files[first_fd++] = file;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_read (const char *path, char *buf, size_t sz, off_t off,
|
||||
+ struct fuse_file_info *fi)
|
||||
+{
|
||||
+ grub_file_t file = files[fi->fh];
|
||||
+ grub_ssize_t size;
|
||||
+
|
||||
+ if (off > file->size)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ file->offset = off;
|
||||
+
|
||||
+ size = grub_file_read (file, buf, sz);
|
||||
+ if (size < 0)
|
||||
+ return translate_error ();
|
||||
+ else
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return size;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_release (const char *path, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ grub_file_close (files[fi->fh]);
|
||||
+ files[fi->fh] = NULL;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_readdir (const char *path, void *buf,
|
||||
+ fuse_fill_dir_t fill, off_t off, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ char *pathname;
|
||||
+
|
||||
+ auto int call_fill (const char *filename,
|
||||
+ const struct grub_dirhook_info *info);
|
||||
+ int call_fill (const char *filename, const struct grub_dirhook_info *info)
|
||||
+ {
|
||||
+ fill (buf, filename, NULL, 0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ pathname = xstrdup (path);
|
||||
+
|
||||
+ /* Remove trailing '/'. */
|
||||
+ while (pathname [0] && pathname[1]
|
||||
+ && pathname[grub_strlen (pathname) - 1] == '/')
|
||||
+ pathname[grub_strlen (pathname) - 1] = 0;
|
||||
+
|
||||
+ (fs->dir) (dev, pathname, call_fill);
|
||||
+ free (pathname);
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+struct fuse_operations grub_opers = {
|
||||
+ .getattr = fuse_getattr,
|
||||
+ .open = fuse_open,
|
||||
+ .release = fuse_release,
|
||||
+ .opendir = fuse_opendir,
|
||||
+ .readdir = fuse_readdir,
|
||||
+ .read = fuse_read
|
||||
+};
|
||||
+
|
||||
+static grub_err_t
|
||||
+fuse_init (void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < num_disks; i++)
|
||||
+ {
|
||||
+ char *argv[2];
|
||||
+ char *host_file;
|
||||
+ char *loop_name;
|
||||
+ loop_name = grub_xasprintf ("loop%d", i);
|
||||
+ if (!loop_name)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ host_file = grub_xasprintf ("(host)%s", images[i]);
|
||||
+ if (!host_file)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ argv[0] = loop_name;
|
||||
+ argv[1] = host_file;
|
||||
+
|
||||
+ if (execute_command ("loopback", 2, argv))
|
||||
+ grub_util_error (_("loopback command fails"));
|
||||
+
|
||||
+ grub_free (loop_name);
|
||||
+ grub_free (host_file);
|
||||
+ }
|
||||
+
|
||||
+ grub_lvm_fini ();
|
||||
+ grub_mdraid09_fini ();
|
||||
+ grub_mdraid1x_fini ();
|
||||
+ grub_raid_fini ();
|
||||
+ grub_raid_init ();
|
||||
+ grub_mdraid09_init ();
|
||||
+ grub_mdraid1x_init ();
|
||||
+ grub_lvm_init ();
|
||||
+
|
||||
+ dev = grub_device_open (0);
|
||||
+ if (! dev)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ fs = grub_fs_probe (dev);
|
||||
+ if (! fs)
|
||||
+ {
|
||||
+ grub_device_close (dev);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
+ fuse_main (fuse_argc, fuse_args, &grub_opers, NULL);
|
||||
+
|
||||
+ for (i = 0; i < num_disks; i++)
|
||||
+ {
|
||||
+ char *argv[2];
|
||||
+ char *loop_name;
|
||||
+
|
||||
+ loop_name = grub_xasprintf ("loop%d", i);
|
||||
+ if (!loop_name)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ argv[0] = "-d";
|
||||
+ argv[1] = loop_name;
|
||||
+
|
||||
+ execute_command ("loopback", 2, argv);
|
||||
+
|
||||
+ grub_free (loop_name);
|
||||
+ }
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct argp_option options[] = {
|
||||
+ {"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
|
||||
+ {"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
|
||||
+ {"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("Print verbose messages."), 2},
|
||||
+ {0, 0, 0, 0, 0, 0}
|
||||
+};
|
||||
+
|
||||
+/* Print the version information. */
|
||||
+static void
|
||||
+print_version (FILE *stream, struct argp_state *state)
|
||||
+{
|
||||
+ fprintf (stream, "%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
+}
|
||||
+void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
|
||||
+
|
||||
+error_t
|
||||
+argp_parser (int key, char *arg, struct argp_state *state)
|
||||
+{
|
||||
+ char *p;
|
||||
+
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case 'r':
|
||||
+ root = arg;
|
||||
+ return 0;
|
||||
+
|
||||
+ case 'd':
|
||||
+ debug_str = arg;
|
||||
+ return 0;
|
||||
+
|
||||
+ case 'v':
|
||||
+ verbosity++;
|
||||
+ return 0;
|
||||
+
|
||||
+ case ARGP_KEY_ARG:
|
||||
+ if (arg[0] != '-')
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ if (!arg)
|
||||
+ return 0;
|
||||
+
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 1) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = xstrdup (arg);
|
||||
+ fuse_argc++;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (arg[0] != '/')
|
||||
+ {
|
||||
+ fprintf (stderr, "%s", _("Must use absolute path.\n"));
|
||||
+ argp_usage (state);
|
||||
+ }
|
||||
+ images = xrealloc (images, (num_disks + 1) * sizeof (images[0]));
|
||||
+ images[num_disks] = xstrdup (arg);
|
||||
+ num_disks++;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+struct argp argp = {
|
||||
+ options, argp_parser, N_("IMAGE1 [IMAGE2 ...] MOUNTPOINT"),
|
||||
+ N_("Debug tool for filesystem driver."),
|
||||
+ NULL, NULL, NULL
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ char *default_root, *alloc_root;
|
||||
+
|
||||
+ set_program_name (argv[0]);
|
||||
+
|
||||
+ grub_util_init_nls ();
|
||||
+
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = xstrdup (argv[0]);
|
||||
+ fuse_argc++;
|
||||
+ /* Run single-threaded. */
|
||||
+ fuse_args[fuse_argc] = xstrdup ("-s");
|
||||
+ fuse_argc++;
|
||||
+
|
||||
+ argp_parse (&argp, argc, argv, 0, 0, 0);
|
||||
+
|
||||
+ if (num_disks < 2)
|
||||
+ grub_util_error ("need an image and mountpoint");
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = images[num_disks - 1];
|
||||
+ fuse_argc++;
|
||||
+ num_disks--;
|
||||
+ fuse_args[fuse_argc] = NULL;
|
||||
+
|
||||
+ /* Initialize all modules. */
|
||||
+ grub_init_all ();
|
||||
+
|
||||
+ if (debug_str)
|
||||
+ grub_env_set ("debug", debug_str);
|
||||
+
|
||||
+ default_root = (num_disks == 1) ? "loop0" : "md0";
|
||||
+ alloc_root = 0;
|
||||
+ if (root)
|
||||
+ {
|
||||
+ if ((*root >= '0') && (*root <= '9'))
|
||||
+ {
|
||||
+ alloc_root = xmalloc (strlen (default_root) + strlen (root) + 2);
|
||||
+
|
||||
+ sprintf (alloc_root, "%s,%s", default_root, root);
|
||||
+ root = alloc_root;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ root = default_root;
|
||||
+
|
||||
+ grub_env_set ("root", root);
|
||||
+
|
||||
+ if (alloc_root)
|
||||
+ free (alloc_root);
|
||||
+
|
||||
+ /* Do it. */
|
||||
+ fuse_init ();
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_print_error ();
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Free resources. */
|
||||
+ grub_fini_all ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -1,178 +0,0 @@
|
||||
Description: Support long Linux command lines
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/longlinuxcmd/
|
||||
Forwarded: not-needed
|
||||
Last-Update: 2011-01-05
|
||||
|
||||
Index: b/grub-core/loader/i386/linux.c
|
||||
===================================================================
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -55,7 +55,6 @@
|
||||
#endif
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
-#define GRUB_LINUX_CL_END_OFFSET 0x2000
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
@@ -72,6 +71,7 @@
|
||||
static grub_uint32_t initrd_pages;
|
||||
static struct grub_relocator *relocator = NULL;
|
||||
static void *efi_mmap_buf;
|
||||
+static grub_size_t maximal_cmdline_size;
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
static grub_efi_uintn_t efi_mmap_size;
|
||||
#else
|
||||
@@ -186,7 +186,7 @@
|
||||
grub_err_t err;
|
||||
|
||||
/* Make sure that each size is aligned to a page boundary. */
|
||||
- real_size = GRUB_LINUX_CL_END_OFFSET;
|
||||
+ real_size = GRUB_LINUX_CL_OFFSET + maximal_cmdline_size;
|
||||
prot_size = page_align (prot_size);
|
||||
mmap_size = find_mmap_size ();
|
||||
|
||||
@@ -657,6 +657,14 @@
|
||||
goto fail;
|
||||
}
|
||||
|
||||
+ if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
+ maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
+ else
|
||||
+ maximal_cmdline_size = 256;
|
||||
+
|
||||
+ if (maximal_cmdline_size < 128)
|
||||
+ maximal_cmdline_size = 128;
|
||||
+
|
||||
setup_sects = lh.setup_sects;
|
||||
|
||||
/* If SETUP_SECTS is not set, set it to the default (4). */
|
||||
@@ -670,7 +678,7 @@
|
||||
goto fail;
|
||||
|
||||
params = (struct linux_kernel_params *) real_mode_mem;
|
||||
- grub_memset (params, 0, GRUB_LINUX_CL_END_OFFSET);
|
||||
+ grub_memset (params, 0, GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
grub_memcpy (¶ms->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
|
||||
|
||||
params->ps_mouse = params->padding10 = 0;
|
||||
@@ -865,7 +873,7 @@
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)real_mode_mem + GRUB_LINUX_CL_OFFSET
|
||||
+ sizeof (LINUX_IMAGE) - 1,
|
||||
- GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
len = prot_size;
|
||||
Index: b/grub-core/loader/i386/pc/linux.c
|
||||
===================================================================
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <grub/lib/cmdline.h>
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x9000
|
||||
-#define GRUB_LINUX_CL_END_OFFSET 0x90FF
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
@@ -47,6 +46,7 @@
|
||||
static grub_addr_t grub_linux_real_target;
|
||||
static char *grub_linux_real_chunk;
|
||||
static grub_size_t grub_linux16_prot_size;
|
||||
+static grub_size_t maximal_cmdline_size;
|
||||
|
||||
static grub_err_t
|
||||
grub_linux16_boot (void)
|
||||
@@ -126,15 +126,20 @@
|
||||
setup_sects = lh.setup_sects;
|
||||
linux_mem_size = 0;
|
||||
|
||||
+ maximal_cmdline_size = 256;
|
||||
+
|
||||
if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
|
||||
&& grub_le_to_cpu16 (lh.version) >= 0x0200)
|
||||
{
|
||||
grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL);
|
||||
lh.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
|
||||
|
||||
+ if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
+ maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
+
|
||||
/* Put the real mode part at as a high location as possible. */
|
||||
grub_linux_real_target = grub_mmap_get_lower ()
|
||||
- - GRUB_LINUX_SETUP_MOVE_SIZE;
|
||||
+ - (GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
/* But it must not exceed the traditional area. */
|
||||
if (grub_linux_real_target > GRUB_LINUX_OLD_REAL_MODE_ADDR)
|
||||
grub_linux_real_target = GRUB_LINUX_OLD_REAL_MODE_ADDR;
|
||||
@@ -151,7 +156,8 @@
|
||||
{
|
||||
lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
|
||||
lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET);
|
||||
- lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
+ lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -183,12 +189,13 @@
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- if (grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE
|
||||
+ if (grub_linux_real_target + GRUB_LINUX_CL_OFFSET + maximal_cmdline_size
|
||||
> grub_mmap_get_lower ())
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"too small lower memory (0x%x > 0x%x)",
|
||||
- grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE,
|
||||
+ grub_linux_real_target + GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size,
|
||||
(int) grub_mmap_get_lower ());
|
||||
goto fail;
|
||||
}
|
||||
@@ -261,7 +268,8 @@
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
grub_linux_real_target,
|
||||
- GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
+ GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size);
|
||||
if (err)
|
||||
return err;
|
||||
grub_linux_real_chunk = get_virtual_current_address (ch);
|
||||
@@ -292,7 +300,7 @@
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)grub_linux_real_chunk
|
||||
+ GRUB_LINUX_CL_OFFSET + sizeof (LINUX_IMAGE) - 1,
|
||||
- GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
if (grub_linux_is_bzimage)
|
||||
Index: b/include/grub/i386/linux.h
|
||||
===================================================================
|
||||
--- a/include/grub/i386/linux.h
|
||||
+++ b/include/grub/i386/linux.h
|
||||
@@ -41,7 +41,6 @@
|
||||
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
|
||||
#define GRUB_LINUX_VID_MODE_VESA_START 0x0300
|
||||
|
||||
-#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
|
||||
#define GRUB_LINUX_CL_MAGIC 0xA33F
|
||||
|
||||
#ifdef __x86_64__
|
||||
@@ -130,6 +129,10 @@
|
||||
grub_uint16_t pad1; /* Unused */
|
||||
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
|
||||
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
|
||||
+ grub_uint32_t kernel_alignment;
|
||||
+ grub_uint8_t relocatable;
|
||||
+ grub_uint8_t pad[3];
|
||||
+ grub_uint32_t cmdline_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
|
||||
@@ -1,691 +0,0 @@
|
||||
Description: Add squashfs 4 support
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/squash/
|
||||
Forwarded: not-needed
|
||||
Last-Update: 2011-01-04
|
||||
|
||||
Index: b/Makefile.util.def
|
||||
===================================================================
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -65,6 +65,7 @@
|
||||
common = grub-core/fs/ntfscomp.c;
|
||||
common = grub-core/fs/reiserfs.c;
|
||||
common = grub-core/fs/sfs.c;
|
||||
+ common = grub-core/fs/squash4.c;
|
||||
common = grub-core/fs/tar.c;
|
||||
common = grub-core/fs/udf.c;
|
||||
common = grub-core/fs/ufs2.c;
|
||||
Index: b/grub-core/Makefile.core.def
|
||||
===================================================================
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -985,6 +985,11 @@
|
||||
};
|
||||
|
||||
module = {
|
||||
+ name = squash4;
|
||||
+ common = fs/squash4.c;
|
||||
+};
|
||||
+
|
||||
+module = {
|
||||
name = tar;
|
||||
common = fs/tar.c;
|
||||
};
|
||||
Index: b/grub-core/fs/squash4.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/grub-core/fs/squash4.c
|
||||
@@ -0,0 +1,546 @@
|
||||
+/* squash4.c - SquashFS */
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/file.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/disk.h>
|
||||
+#include <grub/dl.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/fshelp.h>
|
||||
+#include <grub/deflate.h>
|
||||
+
|
||||
+/*
|
||||
+ object format Pointed by
|
||||
+ superblock RAW Fixed offset (0)
|
||||
+ data RAW ? Fixed offset (60)
|
||||
+ inode table Chunk superblock
|
||||
+ dir table Chunk superblock
|
||||
+ fragment table Chunk unk1
|
||||
+ unk1 RAW, Chunk superblock
|
||||
+ unk2 RAW superblock
|
||||
+ UID/GID Chunk exttblptr
|
||||
+ exttblptr RAW superblock
|
||||
+
|
||||
+ UID/GID table is the array ot uint32_t
|
||||
+ unk1 contains pointer to unk3 followed by some chunk.
|
||||
+ unk2 containts one uint64_t
|
||||
+*/
|
||||
+
|
||||
+struct grub_squash_super
|
||||
+{
|
||||
+ grub_uint32_t magic;
|
||||
+#define SQUASH_MAGIC 0x73717368
|
||||
+ grub_uint32_t dummy1;
|
||||
+ grub_uint32_t creation_time;
|
||||
+ grub_uint32_t dummy2;
|
||||
+ grub_uint64_t dummy3;
|
||||
+ grub_uint8_t flags;
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_INODES 1
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_DATA 2
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_FRAGMENTS 8
|
||||
+ grub_uint8_t dummy4[7];
|
||||
+ grub_uint16_t root_ino_offset;
|
||||
+ grub_uint32_t root_ino_chunk;
|
||||
+ grub_uint16_t dummy5;
|
||||
+ grub_uint64_t total_size;
|
||||
+ grub_uint64_t exttbloffset;
|
||||
+ grub_uint64_t dummy6;
|
||||
+ grub_uint64_t inodeoffset;
|
||||
+ grub_uint64_t diroffset;
|
||||
+ grub_uint64_t unk1offset;
|
||||
+ grub_uint64_t unk2offset;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+
|
||||
+/* Chunk-based */
|
||||
+struct grub_squash_inode
|
||||
+{
|
||||
+ /* Same values as direlem types. */
|
||||
+ grub_uint16_t type;
|
||||
+ grub_uint16_t dummy[3];
|
||||
+ grub_uint32_t mtime;
|
||||
+ union
|
||||
+ {
|
||||
+ struct {
|
||||
+ grub_uint32_t dummy;
|
||||
+ grub_uint32_t chunk;
|
||||
+ grub_uint32_t fragment;
|
||||
+ grub_uint32_t offset;
|
||||
+ grub_uint32_t size;
|
||||
+ } __attribute__ ((packed)) file;
|
||||
+ struct {
|
||||
+ grub_uint32_t dummy1;
|
||||
+ grub_uint32_t chunk;
|
||||
+ grub_uint32_t dummy2;
|
||||
+ grub_uint16_t size;
|
||||
+ grub_uint32_t offset;
|
||||
+ grub_uint16_t dummy3;
|
||||
+ } __attribute__ ((packed)) dir;
|
||||
+ struct {
|
||||
+ grub_uint64_t dummy;
|
||||
+ grub_uint32_t namelen;
|
||||
+ char name[0];
|
||||
+ } __attribute__ ((packed)) symlink;
|
||||
+ } __attribute__ ((packed));
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+/* Chunk-based. */
|
||||
+struct grub_squash_dirent_header
|
||||
+{
|
||||
+ /* Actually the value is the number of elements - 1. */
|
||||
+ grub_uint32_t nelems;
|
||||
+ grub_uint64_t ino_chunk;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+struct grub_squash_dirent
|
||||
+{
|
||||
+ grub_uint16_t ino_offset;
|
||||
+ grub_uint16_t dummy;
|
||||
+ grub_uint16_t type;
|
||||
+#define SQUASH_TYPE_DIR 1
|
||||
+#define SQUASH_TYPE_REGULAR 2
|
||||
+#define SQUASH_TYPE_SYMLINK 3
|
||||
+ /* Actually the value is the length of name - 1. */
|
||||
+ grub_uint16_t namelen;
|
||||
+ char name[0];
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+struct grub_squash_frag_desc
|
||||
+{
|
||||
+ grub_uint64_t offset;
|
||||
+ grub_uint64_t dummy;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+#define SQUASH_CHUNK_SIZE 0x2000
|
||||
+#define SQUASH_CHUNK_FLAGS 0x8000
|
||||
+#define SQUASH_CHUNK_UNCOMPRESSED 0x8000
|
||||
+
|
||||
+struct grub_squash_data
|
||||
+{
|
||||
+ grub_disk_t disk;
|
||||
+ struct grub_squash_super sb;
|
||||
+ struct grub_squash_inode ino;
|
||||
+ grub_uint64_t fragments;
|
||||
+};
|
||||
+
|
||||
+struct grub_fshelp_node
|
||||
+{
|
||||
+ struct grub_squash_data *data;
|
||||
+ struct grub_squash_inode ino;
|
||||
+ grub_uint32_t ino_chunk;
|
||||
+ grub_uint16_t ino_offset;
|
||||
+};
|
||||
+
|
||||
+static grub_err_t
|
||||
+read_chunk (grub_disk_t disk, void *buf, grub_size_t len,
|
||||
+ grub_uint64_t chunk, grub_off_t offset)
|
||||
+{
|
||||
+ grub_uint64_t chunk_start;
|
||||
+ chunk_start = grub_le_to_cpu64 (chunk);
|
||||
+ while (len > 0)
|
||||
+ {
|
||||
+ grub_uint64_t csize;
|
||||
+ grub_uint16_t d;
|
||||
+ grub_err_t err;
|
||||
+ while (1)
|
||||
+ {
|
||||
+ err = grub_disk_read (disk, chunk_start >> GRUB_DISK_SECTOR_BITS,
|
||||
+ chunk_start & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ sizeof (d), &d);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ if (offset < SQUASH_CHUNK_SIZE)
|
||||
+ break;
|
||||
+ offset -= SQUASH_CHUNK_SIZE;
|
||||
+ chunk_start += 2 + (grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS);
|
||||
+ }
|
||||
+
|
||||
+ csize = SQUASH_CHUNK_SIZE - offset;
|
||||
+ if (csize > len)
|
||||
+ csize = len;
|
||||
+
|
||||
+ if (grub_le_to_cpu16 (d) & SQUASH_CHUNK_UNCOMPRESSED)
|
||||
+ {
|
||||
+ grub_disk_addr_t a = chunk_start + 2 + offset;
|
||||
+ err = grub_disk_read (disk, (a >> GRUB_DISK_SECTOR_BITS),
|
||||
+ a & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ csize, buf);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ char *tmp;
|
||||
+ grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS;
|
||||
+ grub_disk_addr_t a = chunk_start + 2;
|
||||
+ tmp = grub_malloc (bsize);
|
||||
+ if (!tmp)
|
||||
+ return grub_errno;
|
||||
+ /* FIXME: buffer uncompressed data. */
|
||||
+ err = grub_disk_read (disk, (a >> GRUB_DISK_SECTOR_BITS),
|
||||
+ a & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ bsize, tmp);
|
||||
+ if (err)
|
||||
+ {
|
||||
+ grub_free (tmp);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ if (grub_zlib_decompress (tmp, bsize, offset,
|
||||
+ buf, csize) < 0)
|
||||
+ {
|
||||
+ grub_free (tmp);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+ grub_free (tmp);
|
||||
+ }
|
||||
+ len -= csize;
|
||||
+ offset += csize;
|
||||
+ buf = (char *) buf + csize;
|
||||
+ }
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct grub_squash_data *
|
||||
+squash_mount (grub_disk_t disk)
|
||||
+{
|
||||
+ struct grub_squash_super sb;
|
||||
+ grub_err_t err;
|
||||
+ struct grub_squash_data *data;
|
||||
+ grub_uint64_t frag;
|
||||
+
|
||||
+ err = grub_disk_read (disk, 0, 0, sizeof (sb), &sb);
|
||||
+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not a squash4");
|
||||
+ if (err)
|
||||
+ return NULL;
|
||||
+ if (grub_le_to_cpu32 (sb.magic) != SQUASH_MAGIC)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not squash4");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ err = grub_disk_read (disk, grub_le_to_cpu32 (sb.unk1offset)
|
||||
+ >> GRUB_DISK_SECTOR_BITS,
|
||||
+ grub_le_to_cpu32 (sb.unk1offset)
|
||||
+ & (GRUB_DISK_SECTOR_SIZE - 1), sizeof (frag), &frag);
|
||||
+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not a squash4");
|
||||
+ if (err)
|
||||
+ return NULL;
|
||||
+
|
||||
+ data = grub_malloc (sizeof (*data));
|
||||
+ if (!data)
|
||||
+ return NULL;
|
||||
+ data->sb = sb;
|
||||
+ data->disk = disk;
|
||||
+ data->fragments = frag;
|
||||
+
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+grub_squash_read_symlink (grub_fshelp_node_t node)
|
||||
+{
|
||||
+ char *ret;
|
||||
+ grub_err_t err;
|
||||
+ ret = grub_malloc (grub_le_to_cpu32 (node->ino.symlink.namelen) + 1);
|
||||
+
|
||||
+ err = read_chunk (node->data->disk, ret,
|
||||
+ grub_le_to_cpu32 (node->ino.symlink.namelen),
|
||||
+ grub_le_to_cpu64 (node->data->sb.inodeoffset)
|
||||
+ + node->ino_chunk,
|
||||
+ node->ino_offset + (node->ino.symlink.name
|
||||
+ - (char *) &node->ino));
|
||||
+ if (err)
|
||||
+ {
|
||||
+ grub_free (ret);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ ret[grub_le_to_cpu32 (node->ino.symlink.namelen)] = 0;
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+grub_squash_iterate_dir (grub_fshelp_node_t dir,
|
||||
+ int NESTED_FUNC_ATTR
|
||||
+ (*hook) (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node))
|
||||
+{
|
||||
+ grub_uint32_t off = grub_le_to_cpu16 (dir->ino.dir.offset);
|
||||
+ grub_uint32_t endoff;
|
||||
+ unsigned i;
|
||||
+
|
||||
+ /* FIXME: why - 3 ? */
|
||||
+ endoff = grub_le_to_cpu32 (dir->ino.dir.size) + off - 3;
|
||||
+
|
||||
+ while (off < endoff)
|
||||
+ {
|
||||
+ struct grub_squash_dirent_header dh;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &dh, sizeof (dh),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+ off += sizeof (dh);
|
||||
+ for (i = 0; i < (unsigned) grub_le_to_cpu16 (dh.nelems) + 1; i++)
|
||||
+ {
|
||||
+ char *buf;
|
||||
+ int r;
|
||||
+ struct grub_fshelp_node *node;
|
||||
+ enum grub_fshelp_filetype filetype = GRUB_FSHELP_REG;
|
||||
+ struct grub_squash_dirent di;
|
||||
+ struct grub_squash_inode ino;
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &di, sizeof (di),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+ off += sizeof (di);
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &ino, sizeof (ino),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.inodeoffset)
|
||||
+ + grub_le_to_cpu32 (dh.ino_chunk),
|
||||
+ grub_cpu_to_le16 (di.ino_offset));
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+
|
||||
+ buf = grub_malloc (grub_le_to_cpu16 (di.namelen) + 2);
|
||||
+ if (!buf)
|
||||
+ return 0;
|
||||
+ err = read_chunk (dir->data->disk, buf,
|
||||
+ grub_le_to_cpu16 (di.namelen) + 1,
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+
|
||||
+ off += grub_le_to_cpu16 (di.namelen) + 1;
|
||||
+ buf[grub_le_to_cpu16 (di.namelen) + 1] = 0;
|
||||
+ if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_DIR)
|
||||
+ filetype = GRUB_FSHELP_DIR;
|
||||
+ if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_SYMLINK)
|
||||
+ filetype = GRUB_FSHELP_SYMLINK;
|
||||
+
|
||||
+ node = grub_malloc (sizeof (*node));
|
||||
+ if (! node)
|
||||
+ return 0;
|
||||
+ *node = *dir;
|
||||
+ node->ino = ino;
|
||||
+ node->ino_chunk = grub_le_to_cpu32 (dh.ino_chunk);
|
||||
+ node->ino_offset = grub_le_to_cpu16 (di.ino_offset);
|
||||
+
|
||||
+ r = hook (buf, filetype, node);
|
||||
+
|
||||
+ grub_free (buf);
|
||||
+ if (r)
|
||||
+ return r;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+make_root_node (struct grub_squash_data *data, struct grub_fshelp_node *root)
|
||||
+{
|
||||
+ grub_memset (root, 0, sizeof (*root));
|
||||
+ root->data = data;
|
||||
+
|
||||
+ return read_chunk (data->disk, &root->ino, sizeof (root->ino),
|
||||
+ grub_le_to_cpu64 (data->sb.inodeoffset)
|
||||
+ + grub_le_to_cpu16 (data->sb.root_ino_chunk),
|
||||
+ grub_cpu_to_le16 (data->sb.root_ino_offset));
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_dir (grub_device_t device, const char *path,
|
||||
+ int (*hook) (const char *filename,
|
||||
+ const struct grub_dirhook_info *info))
|
||||
+{
|
||||
+ auto int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node);
|
||||
+
|
||||
+ int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node)
|
||||
+ {
|
||||
+ struct grub_dirhook_info info;
|
||||
+ grub_memset (&info, 0, sizeof (info));
|
||||
+ info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
+ info.mtimeset = 1;
|
||||
+ info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||
+ return hook (filename, &info);
|
||||
+ }
|
||||
+
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+ struct grub_fshelp_node *fdiro = 0;
|
||||
+ struct grub_fshelp_node root;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ data = squash_mount (device->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ err = make_root_node (data, &root);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ grub_fshelp_find_file (path, &root, &fdiro, grub_squash_iterate_dir,
|
||||
+ grub_squash_read_symlink, GRUB_FSHELP_DIR);
|
||||
+ if (!grub_errno)
|
||||
+ grub_squash_iterate_dir (fdiro, iterate);
|
||||
+
|
||||
+ grub_free (data);
|
||||
+
|
||||
+ return grub_errno;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_open (struct grub_file *file, const char *name)
|
||||
+{
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+ struct grub_fshelp_node *fdiro = 0;
|
||||
+ struct grub_fshelp_node root;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ data = squash_mount (file->device->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ err = make_root_node (data, &root);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ grub_fshelp_find_file (name, &root, &fdiro, grub_squash_iterate_dir,
|
||||
+ grub_squash_read_symlink, GRUB_FSHELP_REG);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_free (data);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
+ file->data = data;
|
||||
+ data->ino = fdiro->ino;
|
||||
+ file->size = grub_le_to_cpu32 (fdiro->ino.file.size);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_ssize_t
|
||||
+grub_squash_read_data (struct grub_squash_data *data,
|
||||
+ grub_disk_t disk, const struct grub_squash_inode *ino,
|
||||
+ grub_off_t off, char *buf, grub_size_t len)
|
||||
+{
|
||||
+ grub_err_t err;
|
||||
+ grub_uint64_t a, b;
|
||||
+ int compressed = 0;
|
||||
+
|
||||
+ if (grub_le_to_cpu16 (ino->file.fragment) == 0xffff)
|
||||
+ {
|
||||
+ if (grub_le_to_cpu32 (ino->file.chunk))
|
||||
+ a = grub_le_to_cpu32 (ino->file.chunk);
|
||||
+ else
|
||||
+ a = sizeof (struct grub_squash_super);
|
||||
+ compressed = !(data->sb.flags & SQUASH_FLAG_UNCOMPRESSED_DATA);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct grub_squash_frag_desc frag;
|
||||
+ err = read_chunk (disk, &frag, sizeof (frag),
|
||||
+ data->fragments, sizeof (frag)
|
||||
+ * grub_le_to_cpu16 (ino->file.fragment));
|
||||
+ if (err)
|
||||
+ return -1;
|
||||
+ a = grub_le_to_cpu64 (frag.offset) + grub_le_to_cpu32 (ino->file.chunk);
|
||||
+ compressed = !(data->sb.flags & SQUASH_FLAG_UNCOMPRESSED_FRAGMENTS);
|
||||
+ }
|
||||
+
|
||||
+ b = grub_le_to_cpu32 (data->ino.file.offset) + off;
|
||||
+
|
||||
+ /* FIXME: cache uncompressed chunks. */
|
||||
+ if (compressed)
|
||||
+ err = grub_zlib_disk_read (disk, a, b, buf, len);
|
||||
+ else
|
||||
+ err = grub_disk_read (disk, (a + b) >> GRUB_DISK_SECTOR_BITS,
|
||||
+ (a + b) & (GRUB_DISK_SECTOR_SIZE - 1), len, buf);
|
||||
+ if (err)
|
||||
+ return -1;
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+static grub_ssize_t
|
||||
+grub_squash_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
+{
|
||||
+ struct grub_squash_data *data = file->data;
|
||||
+
|
||||
+ return grub_squash_read_data (data, file->device->disk, &data->ino,
|
||||
+ file->offset, buf, len);
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_close (grub_file_t file)
|
||||
+{
|
||||
+ grub_free (file->data);
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_mtime (grub_device_t dev, grub_int32_t *tm)
|
||||
+{
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+
|
||||
+ data = squash_mount (dev->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+ *tm = grub_le_to_cpu32 (data->sb.creation_time);
|
||||
+ grub_free (data);
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct grub_fs grub_squash_fs =
|
||||
+ {
|
||||
+ .name = "squash4",
|
||||
+ .dir = grub_squash_dir,
|
||||
+ .open = grub_squash_open,
|
||||
+ .read = grub_squash_read,
|
||||
+ .close = grub_squash_close,
|
||||
+ .mtime = grub_squash_mtime,
|
||||
+#ifdef GRUB_UTIL
|
||||
+ .reserved_first_sector = 0,
|
||||
+#endif
|
||||
+ .next = 0
|
||||
+ };
|
||||
+
|
||||
+GRUB_MOD_INIT(squash4)
|
||||
+{
|
||||
+ grub_fs_register (&grub_squash_fs);
|
||||
+}
|
||||
+
|
||||
+GRUB_MOD_FINI(squash4)
|
||||
+{
|
||||
+ grub_fs_unregister (&grub_squash_fs);
|
||||
+}
|
||||
+
|
||||
Index: b/grub-core/io/gzio.c
|
||||
===================================================================
|
||||
--- a/grub-core/io/gzio.c
|
||||
+++ b/grub-core/io/gzio.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <grub/fs.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/dl.h>
|
||||
+#include <grub/disk.h>
|
||||
#include <grub/deflate.h>
|
||||
|
||||
/*
|
||||
@@ -62,6 +63,9 @@
|
||||
/* If input is in memory following fields are used instead of file. */
|
||||
grub_size_t mem_input_size, mem_input_off;
|
||||
grub_uint8_t *mem_input;
|
||||
+ grub_disk_addr_t disk_input_off;
|
||||
+ grub_disk_addr_t disk_input_start;
|
||||
+ grub_disk_t disk_input;
|
||||
/* The offset at which the data starts in the underlying file. */
|
||||
grub_off_t data_offset;
|
||||
/* The type of current block. */
|
||||
@@ -382,8 +386,21 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (grub_file_tell (gzio->file) == (grub_off_t) gzio->data_offset
|
||||
- || gzio->inbuf_d == INBUFSIZ)
|
||||
+ if (gzio->disk_input && (gzio->disk_input_off == gzio->data_offset
|
||||
+ || gzio->inbuf_d == INBUFSIZ))
|
||||
+ {
|
||||
+ grub_disk_addr_t d = gzio->disk_input_start + gzio->disk_input_off;
|
||||
+ gzio->inbuf_d = 0;
|
||||
+ grub_disk_read (gzio->disk_input,
|
||||
+ d >> GRUB_DISK_SECTOR_BITS,
|
||||
+ d & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ INBUFSIZ, gzio->inbuf);
|
||||
+ gzio->disk_input_off += INBUFSIZ;
|
||||
+ }
|
||||
+
|
||||
+ if (gzio->file && (grub_file_tell (gzio->file)
|
||||
+ == (grub_off_t) gzio->data_offset
|
||||
+ || gzio->inbuf_d == INBUFSIZ))
|
||||
{
|
||||
gzio->inbuf_d = 0;
|
||||
grub_file_read (gzio->file, gzio->inbuf, INBUFSIZ);
|
||||
@@ -401,8 +418,10 @@
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"attempt to seek outside of the file");
|
||||
else
|
||||
- gzio->mem_input_off = gzio->data_offset;
|
||||
+ gzio->mem_input_off = off;
|
||||
}
|
||||
+ else if (gzio->disk_input)
|
||||
+ gzio->disk_input_off = off;
|
||||
else
|
||||
grub_file_seek (gzio->file, off);
|
||||
}
|
||||
@@ -1296,6 +1315,34 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
+grub_err_t
|
||||
+grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
+ grub_off_t off, char *outbuf, grub_size_t outsize)
|
||||
+{
|
||||
+ grub_gzio_t gzio = 0;
|
||||
+ grub_ssize_t ret;
|
||||
+
|
||||
+ gzio = grub_zalloc (sizeof (*gzio));
|
||||
+ if (! gzio)
|
||||
+ return -1;
|
||||
+
|
||||
+ gzio->disk_input_off = 0;
|
||||
+ gzio->disk_input_start = zlibstart;
|
||||
+ gzio->disk_input = disk;
|
||||
+
|
||||
+ if (!test_zlib_header (gzio))
|
||||
+ {
|
||||
+ grub_free (gzio);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ ret = grub_gzio_read_real (gzio, off, outbuf, outsize);
|
||||
+ grub_free (gzio);
|
||||
+
|
||||
+ /* FIXME: Check Adler. */
|
||||
+ return ret < 0 ? grub_errno : GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
static struct grub_fs grub_gzio_fs =
|
||||
Index: b/include/grub/deflate.h
|
||||
===================================================================
|
||||
--- a/include/grub/deflate.h
|
||||
+++ b/include/grub/deflate.h
|
||||
@@ -23,4 +23,8 @@
|
||||
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
|
||||
char *outbuf, grub_size_t outsize);
|
||||
|
||||
+grub_err_t
|
||||
+grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
+ grub_off_t off, char *outbuf, grub_size_t outsize);
|
||||
+
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
Index: b/util/grub-setup.c
|
||||
===================================================================
|
||||
--- a/util/grub-setup.c
|
||||
+++ b/util/grub-setup.c
|
||||
@@ -76,6 +76,7 @@
|
||||
|
||||
#define DEFAULT_BOOT_FILE "boot.img"
|
||||
#define DEFAULT_CORE_FILE "core.img"
|
||||
+#define CORE_IMG_IN_FS "setup_left_core_image_in_filesystem"
|
||||
|
||||
#ifdef GRUB_MACHINE_SPARC64
|
||||
#define grub_target_to_host16(x) grub_be_to_cpu16(x)
|
||||
@@ -488,6 +489,8 @@
|
||||
|
||||
grub_free (sectors);
|
||||
|
||||
+ unlink (DEFAULT_DIRECTORY "/" CORE_IMG_IN_FS);
|
||||
+
|
||||
goto finish;
|
||||
}
|
||||
#endif
|
||||
@@ -513,6 +516,9 @@
|
||||
/* The core image must be put on a filesystem unfortunately. */
|
||||
grub_util_info ("will leave the core image on the filesystem");
|
||||
|
||||
+ fp = fopen (DEFAULT_DIRECTORY "/" CORE_IMG_IN_FS, "w");
|
||||
+ fclose (fp);
|
||||
+
|
||||
/* Make sure that GRUB reads the identical image as the OS. */
|
||||
tmp_img = xmalloc (core_size);
|
||||
core_path_dev_full = grub_util_get_path (dir, core_file);
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
Author: Robert Millan
|
||||
|
||||
An ugly kludge. Should this be merged upstream?
|
||||
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -963,6 +963,18 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
|
||||
+ {
|
||||
+ char *q = p + sizeof ("/dev/fd") - 1;
|
||||
+ if (*q >= '0' && *q <= '9')
|
||||
+ {
|
||||
+ free (map[drive].drive);
|
||||
+ map[drive].drive = NULL;
|
||||
+ grub_util_info ("`%s' looks like a floppy drive, skipping", p);
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
#ifdef __linux__
|
||||
/* On Linux, the devfs uses symbolic links horribly, and that
|
||||
confuses the interface very much, so use realpath to expand
|
||||
@@ -1,15 +0,0 @@
|
||||
Index: b/util/grub-mkconfig.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -291,6 +291,10 @@
|
||||
esac
|
||||
done
|
||||
|
||||
+if [ "x${grub_cfg}" != "x" ] && ! grep -q "^password " ${grub_cfg}.new ; then
|
||||
+ chmod 444 ${grub_cfg}.new || true
|
||||
+fi
|
||||
+
|
||||
if test "x${grub_cfg}" != "x" ; then
|
||||
if ! ${grub_script_check} ${grub_cfg}.new; then
|
||||
echo "Syntax errors are detected in generated GRUB config file." >&2
|
||||
@@ -1,43 +0,0 @@
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -1017,7 +1017,7 @@
|
||||
char *bsd_part_str = NULL;
|
||||
|
||||
if (dos_part >= 0)
|
||||
- dos_part_str = xasprintf (",%d", dos_part + 1);
|
||||
+ dos_part_str = xasprintf (",%d", dos_part + (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS") ? 0 : 1));
|
||||
|
||||
if (bsd_part >= 0)
|
||||
bsd_part_str = xasprintf (",%d", bsd_part + 1);
|
||||
@@ -1492,6 +1492,29 @@
|
||||
|
||||
if (start == part_start)
|
||||
{
|
||||
+ if (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS"))
|
||||
+ {
|
||||
+ int dos_part, bsd_part;
|
||||
+ char *fullname, *comma;
|
||||
+
|
||||
+ if (partition->parent)
|
||||
+ {
|
||||
+ dos_part = partition->parent->number;
|
||||
+ bsd_part = partition->number;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dos_part = partition->number;
|
||||
+ bsd_part = -1;
|
||||
+ }
|
||||
+
|
||||
+ fullname = make_device_name (drive, dos_part, bsd_part);
|
||||
+ comma = strchr (fullname, ',');
|
||||
+ partname = comma ? xstrdup (comma + 1) : NULL;
|
||||
+ free (fullname);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
partname = grub_partition_get_name (partition);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
Description: If GRUB Legacy is still around, tell packaging to ignore it
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Bug-Debian: http://bugs.debian.org/586143
|
||||
Forwarded: not-needed
|
||||
Last-Update: 2010-06-18
|
||||
|
||||
Index: b/util/grub-install.in
|
||||
===================================================================
|
||||
--- a/util/grub-install.in
|
||||
+++ b/util/grub-install.in
|
||||
@@ -653,6 +653,13 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
+# If vestiges of GRUB Legacy still exist, tell the Debian packaging that
|
||||
+# they can ignore them.
|
||||
+if test -z "$rootdir" && \
|
||||
+ test -e /boot/grub/stage2 && test -e /boot/grub/menu.lst; then
|
||||
+ touch /boot/grub/grub2-installed
|
||||
+fi
|
||||
+
|
||||
echo "Installation finished. No error reported."
|
||||
|
||||
# Bye.
|
||||
@@ -1,30 +0,0 @@
|
||||
Description: Warn and return without error if /boot is a dm-crypt device
|
||||
With any luck the administrator knows what they're doing; in any event, we
|
||||
probably can't improve matters by having update-grub exit non-zero.
|
||||
Author: Marc Haber <mh+debian-bugs@zugschlus.de>
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Origin: other, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542165#25
|
||||
Bug-Debian: http://bugs.debian.org/542165
|
||||
Forwarded: no
|
||||
Last-Update: 2010-06-05
|
||||
|
||||
Index: b/util/grub-mkconfig_lib.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -99,6 +99,15 @@
|
||||
{
|
||||
device=$1
|
||||
|
||||
+ if dmsetup status $device 2>/dev/null | grep -q 'crypt[[:space:]]$'; then
|
||||
+ grub_warn \
|
||||
+ "$device is a crypto device, which GRUB cannot read directly. Some" \
|
||||
+ "necessary modules may be missing from /boot/grub/grub.cfg. You may" \
|
||||
+ "need to list them in GRUB_PRELOAD_MODULES in /etc/default/grub. See" \
|
||||
+ "http://bugs.debian.org/542165 for details."
|
||||
+ return 0
|
||||
+ fi
|
||||
+
|
||||
# Abstraction modules aren't auto-loaded.
|
||||
abstraction="`${grub_probe} --device ${device} --target=abstraction`"
|
||||
for module in ${abstraction} ; do
|
||||
@@ -1,54 +0,0 @@
|
||||
Description: Allow reducing size of xorriso-created rescue images
|
||||
This lets us create smaller images that will fit on floppy disks. It has
|
||||
been approved by the upstream maintainer but has not yet been applied.
|
||||
Author: Thomas Schmitt <scdbackup@gmx.net>
|
||||
Origin: other, http://lists.gnu.org/archive/html/grub-devel/2010-05/msg00100.html
|
||||
Forwarded: yes
|
||||
Last-Update: 2010-06-02
|
||||
|
||||
Index: b/util/grub-mkrescue.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkrescue.in
|
||||
+++ b/util/grub-mkrescue.in
|
||||
@@ -44,6 +44,7 @@
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
|
||||
xorriso=xorriso
|
||||
+diet=no
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
@@ -59,6 +60,7 @@
|
||||
--rom-directory=DIR save rom images in DIR [optional]
|
||||
--xorriso=FILE use FILE as xorriso [optional]
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
+ --diet apply size reducing measures [optional]
|
||||
|
||||
$self generates a bootable rescue image with specified source files, source
|
||||
directories, or mkisofs options listed by: xorriso -as mkisofs -help
|
||||
@@ -133,6 +135,9 @@
|
||||
--xorriso=*)
|
||||
xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
|
||||
|
||||
+ --diet)
|
||||
+ diet=yes ;;
|
||||
+
|
||||
*)
|
||||
source="${source} ${option} $@"; break ;;
|
||||
esac
|
||||
@@ -303,7 +308,14 @@
|
||||
fi
|
||||
|
||||
# build iso image
|
||||
-"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
+if [ "${diet}" = yes ]; then
|
||||
+ if [ -e "${output_image}" ]; then
|
||||
+ rm "${output_image}" || exit 1
|
||||
+ fi
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points -no-pad ${grub_mkisofs_arguments} --protective-msdos-label -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source} | cat >"${output_image}"
|
||||
+else
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
+fi
|
||||
rm -rf ${iso9660_dir}
|
||||
|
||||
rm -f ${embed_img}
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
This sucks, but it's better than what OFW was giving us.
|
||||
|
||||
Index: b/grub-core/kern/ieee1275/init.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/ieee1275/init.c
|
||||
+++ b/grub-core/kern/ieee1275/init.c
|
||||
@@ -53,6 +53,7 @@
|
||||
grub_ieee1275_exit ();
|
||||
}
|
||||
|
||||
+#ifndef __i386__
|
||||
/* Translate an OF filesystem path (separated by backslashes), into a GRUB
|
||||
path (separated by forward slashes). */
|
||||
static void
|
||||
@@ -67,13 +68,16 @@
|
||||
backslash = grub_strchr (filepath, '\\');
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
void
|
||||
grub_machine_set_prefix (void)
|
||||
{
|
||||
+#ifndef __i386__
|
||||
char bootpath[64]; /* XXX check length */
|
||||
char *filename;
|
||||
char *prefix;
|
||||
+#endif
|
||||
|
||||
if (grub_prefix[0])
|
||||
{
|
||||
@@ -82,6 +86,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+#ifdef __i386__
|
||||
+ grub_env_set ("prefix", "(sd,1)/");
|
||||
+#else
|
||||
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
|
||||
sizeof (bootpath), 0))
|
||||
{
|
||||
@@ -120,6 +127,7 @@
|
||||
|
||||
grub_free (filename);
|
||||
grub_free (prefix);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Claim some available memory in the first /memory node. */
|
||||
@@ -1,18 +0,0 @@
|
||||
Description: Skip partmap test if qemu-img doesn't exist (e.g. on the Hurd)
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Forwarded: no
|
||||
Last-Update: 2010-11-22
|
||||
|
||||
Index: b/tests/partmap_test.in
|
||||
===================================================================
|
||||
--- a/tests/partmap_test.in
|
||||
+++ b/tests/partmap_test.in
|
||||
@@ -51,6 +51,8 @@
|
||||
echo
|
||||
}
|
||||
|
||||
+which qemu-img >/dev/null 2>&1 || exit 77
|
||||
+
|
||||
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
olpc_prefix_hack.patch
|
||||
core_in_fs.patch
|
||||
boot_blocklist_hack.patch
|
||||
grub_legacy_0_based_partitions.patch
|
||||
disable_floppies.patch
|
||||
grub.cfg_400.patch
|
||||
mkrescue_diet.patch
|
||||
mkconfig_skip_dmcrypt.patch
|
||||
install_stage2_confusion.patch
|
||||
qemu_img_exists.patch
|
||||
branch_devmapper.patch
|
||||
branch_squash.patch
|
||||
branch_longlinuxcmd.patch
|
||||
branch_fuse.patch
|
||||
@@ -149,14 +149,6 @@ src_prepare() {
|
||||
epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
|
||||
epatch "${FILESDIR}"/${PN}-1.99-wallpaper-settings-support.patch
|
||||
epatch "${FILESDIR}"/${PN}-1.98-add-legacy-rootfs-detection.patch
|
||||
# Ubuntu and upstream patches
|
||||
series_file="${FILESDIR}/ubuntu-upstream-1.99/series"
|
||||
for p in `cat ${series_file}`; do
|
||||
if [ "${p}" = "series" ]; then
|
||||
continue
|
||||
fi
|
||||
epatch "${FILESDIR}/ubuntu-upstream-1.99/${p}"
|
||||
done
|
||||
epatch_user
|
||||
# Genkernel doesn't support "single" for rescue mode
|
||||
# but rather init_opts=single
|
||||
|
||||
Reference in New Issue
Block a user