]>
git.proxmox.com Git - grub2.git/blob - grub-core/genmod.sh.in
3 # Copyright (C) 2010 Free Software Foundation, Inc.
5 # This gensymlist.sh is free software; the author
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
17 # genmod.sh moddep.lst normal.module normal.mod
24 tmpfile
=${outfile}.tmp
25 modname
=`echo $infile | sed -e 's@\.module.*$@@'`
27 if ! grep ^
$modname: $moddep >/dev
/null
; then
28 echo "warning: moddep.lst has no dependencies for $modname" >&2
32 deps
=`grep ^$modname: $moddep | sed s@^.*:@@`
34 # remove old files if any
35 rm -f $tmpfile $outfile
37 # stripout .modname and .moddeps sections from input module
38 objcopy
-R .modname
-R .moddeps
$infile $tmpfile
40 # Attach .modname and .moddeps sections
42 printf "$modname\0" >$t1
45 for dep
in $deps; do printf "$dep\0" >> $t2; done
47 if test -n "$deps"; then
48 objcopy
--add-section .modname
=$t1 --add-section .moddeps
=$t2 $tmpfile
50 objcopy
--add-section .modname
=$t1 $tmpfile
54 if test x@TARGET_APPLE_CC@
!= x1
; then
55 if ! test -z "@TARGET_OBJ2ELF@"; then
56 .
/@TARGET_OBJ2ELF@
$tmpfile ||
exit 1
58 if test x@platform@
!= xemu
; then
59 @STRIP@
--strip-unneeded \
60 -K grub_mod_init
-K grub_mod_fini \
61 -K _grub_mod_init
-K _grub_mod_fini \
62 -R .note
-R .comment
$tmpfile ||
exit 1
65 # XXX Test these Apple CC fixes
66 cp $tmpfile $tmpfile.bin
67 @OBJCONV@
-f@TARGET_MODULE_FORMAT@ \
68 -nr:_grub_mod_init
:grub_mod_init \
69 -nr:_grub_mod_fini
:grub_mod_fini \
70 -wd1106 -ew2030 -ew2050 -nu -nd $tmpfile.bin
$tmpfile ||
exit 1