summaryrefslogtreecommitdiff
path: root/scripts/build/grub-cpmodules
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/grub-cpmodules')
-rwxr-xr-xscripts/build/grub-cpmodules55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/build/grub-cpmodules b/scripts/build/grub-cpmodules
new file mode 100755
index 000000000..437ebdf2b
--- /dev/null
+++ b/scripts/build/grub-cpmodules
@@ -0,0 +1,55 @@
+#! /bin/sh
+set -e
+
+# Copyright (C) 2010, 2011 Canonical Ltd.
+# Author: Colin Watson <cjwatson@ubuntu.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Copy GRUB modules.
+
+# TODO: take the modules list as parameter, and only include the needed modules, using moddeps.lst to get dependencies
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+ echo "usage: $0 OUTPUT-DIRECTORY GRUB-PLATFORM"
+ exit 1
+fi
+
+outdir="$1"
+platform="$2"
+
+# Copy over GRUB modules, except for those already built in.
+cp -a "/usr/lib/grub/$platform"/*.lst "$outdir/boot/grub/$platform/"
+for x in "/usr/lib/grub/$platform"/*.mod; do
+ # TODO: Some of these exclusions are based on knowledge of module
+ # dependencies. It would be nice to have a way to read the module
+ # list directly out of the image.
+ case $(basename "$x" .mod) in
+ configfile|fshelp|iso9660|memdisk|search|search_fs_file|search_fs_uuid|search_label|tar)
+ # included in boot image
+ ;;
+ affs|afs|afs_be|befs|befs_be|minix|nilfs2|sfs|zfs|zfsinfo)
+ # unnecessary filesystem modules
+ ;;
+ example_functional_test|functional_test|hello)
+ # other cruft
+ ;;
+ *)
+ cp -a "$x" "$outdir/boot/grub/$platform/"
+ ;;
+ esac
+done
+
+exit 0