Hi,
I am quite new to grub2 anf I find some issue in make of grub2
I modify the hello module by adding a new file a.c, with a function test() in 
it.
I call the function test from hello entry point - grub_cmd_hello()
When I do a make, I get the error that 
test in hello is not defined
make: *** [moddep.lst] Error 1

I have modified the conf/common.mk accordingly as shown below.
# For hello.mod.
hello_mod_SOURCES = hello/hello.c hello/a.c
CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o 
hello_mod-hello_hello.o hello_mod-hello_a.o und-hello.lst
ifneq ($(hello_mod_EXPORTS),no)
CLEANFILES += def-hello.lst
DEFSYMFILES += def-hello.lst
endif
MOSTLYCLEANFILES += hello_mod-hello_hello.d  hello_mod-hello_a.d
UNDSYMFILES += und-hello.lst
hello.mod: pre-hello.o mod-hello.o
        -rm -f $@
        $(TARGET_CC) $(hello_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
        $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment $@
pre-hello.o: $(hello_mod_DEPENDENCIES) 
hello_mod-hello_hello.o hello_mod-hello_a.o
        -rm -f $@
        $(TARGET_CC) $(hello_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ 
hello_mod-hello_hello.o
mod-hello.o: mod-hello.c
        $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(hello_mod_CFLAGS) -c 
-o $@ $<
mod-hello.c: moddep.lst genmodsrc.sh
        sh $(srcdir)/genmodsrc.sh 'hello' $< > $@ || (rm -f $@; exit 1)
ifneq ($(hello_mod_EXPORTS),no)
def-hello.lst: pre-hello.o
        $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hello/' > $@
endif
und-hello.lst: pre-hello.o
        echo 'hello' > $@
        $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
hello_mod-hello_hello.o: hello/hello.c $(hello/hello.c_DEPENDENCIES)
        $(TARGET_CC) -Ihello -I$(srcdir)/hello $(TARGET_CPPFLAGS)  
$(TARGET_CFLAGS) $(hello_mod_CFLAGS) -MD -c -o $@ $<
-include hello_mod-hello_hello.d
hello_mod-hello_a.o: hello/a.c $(hello/a.c_DEPENDENCIES)
        $(TARGET_CC) -Ihello -I$(srcdir)/hello $(TARGET_CPPFLAGS)  
$(TARGET_CFLAGS) $(hello_mod_CFLAGS) -MD -c -o $@ $<
-include hello_mod-hello_a.d

CLEANFILES += cmd-hello_mod-hello_hello.lst fs-hello_mod-hello_hello.lst
COMMANDFILES += cmd-hello_mod-hello_hello.lst
FSFILES += fs-hello_mod-hello_hello.lst
cmd-hello_mod-hello_hello.lst: hello/hello.c $(hello/hello.c_DEPENDENCIES) 
gencmdlist.sh
        set -e;           $(TARGET_CC) -Ihello -I$(srcdir)/hello 
$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(hello_mod_CFLAGS) -E $<    | sh 
$(srcdir)/gencmdlist.sh hello > $@ || (rm -f $@; exit 1)
cmd-hello_mod-hello_a.lst: hello/a.c $(hello/a.c_DEPENDENCIES) gencmdlist.sh
        set -e;           $(TARGET_CC) -Ihello -I$(srcdir)/hello 
$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(hello_mod_CFLAGS) -E $<    | sh 
$(srcdir)/gencmdlist.sh hello > $@ || (rm -f $@; exit 1)

fs-hello_mod-hello_hello.lst: hello/hello.c $(hello/hello.c_DEPENDENCIES) 
genfslist.sh
        set -e;           $(TARGET_CC) -Ihello -I$(srcdir)/hello 
$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(hello_mod_CFLAGS) -E $<    | sh 
$(srcdir)/genfslist.sh hello > $@ || (rm -f $@; exit 1)
fs-hello_mod-hello_a.lst: hello/a.c $(hello/a.c_DEPENDENCIES) genfslist.sh
        set -e;           $(TARGET_CC) -Ihello -I$(srcdir)/hello 
$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(hello_mod_CFLAGS) -E $<    | sh 
$(srcdir)/genfslist.sh hello > $@ || (rm -f $@; exit 1)

Could anyone let me know whether I need to do anything more.
Viswesh


      Explore your hobbies and interests. Go to 
http://in.promos.yahoo.com/groups/
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to