summaryrefslogtreecommitdiff
path: root/scripts/build/grub-cpmodules
blob: 4f9e26acce073e246c0c8d2f018bfffadce5ca12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /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