Skip to contentSkip to conversation

grub 1.99 add own module / dep problem

DISCUSSION Robert Schumann 2 participants 4 messages Feb 9, 2012

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Heyho guys!

I'm sorry if I didn't RTFM somewhere but I just couldn't find _any_ information on how to correctly add/patch own modules into the grub 1.99. The problem:

1. mymod.c depends on a function in biosdisk.c
2. mymod.c includes the biosdisk.h header correctly I suppose
3. I patched grub-core/Makefile.core.def with

module = {
name = mymod;
common = mymod/mymod.c;
enable = biosdisk;
};

4. I patched grub-core/Makefile.core.am with basically a copy from the hello.c module stuff (although I should probably take the arch dependend definitions from biosdisk mod? but I'm building i386 so it should work any way?)

5. ./configure && make works as expected for another module which doesn't include a foreign function.

6. For mymod.c I receive
mymod/mymod.c:68: error: implicit declaration of function 'grub_biosdisk_get_diskinfo_standard'

which is of course in biosdisk.c. Now my question: How do I solve this mystery on a code/patch base? ;) I know that I can add the biosdisk.c to the common code functions, but that shouldn't be necessary, huh? I thought that enable = biosdisk would do the trick with linked functions, but well... maybe you could shed some light on it.

Cheers
Robert

- --

|-------------------------------------------------address-+
| work:  jacob-und-wilhelm-grimm-zentrum
|        geschwister-scholl-str. 1, 10117 berlin
| mail:  humboldt-universität zu berlin
|        computer- und medienservice
|        unter den linden 6, 10099 berlin
|-------------------------------------------------contact-+
| mail:  [email protected]
| icq:   93163687  |  xmpp:  [email protected]
| fb: 	 fb.com/rschumann  |  phone:  +49(0)30-2093-70133
|-------------------------------------------------gpg/pgp-+
| key:   remembrance.de/gpg/0xA5A5FAA2.asc
| fprnt: 9220-9732-7390-7A0C-5623-3336-4233-FDF8-A5A5-FAA2
|---------------------------------------------------------+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8zljkACgkQQjP9+KWl+qLypgCfb6Hbwo8YwvjTbGg7h9BVKZJd QNQAoLSsg7RhpsZ/ovACGkuO42JpZozI
=oLeZ
-----END PGP SIGNATURE-----

#1 lore raw
Quoted 10 lines · Robert Schumann

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Heyho guys!

I'm sorry if I didn't RTFM somewhere but I just couldn't find _any_ information on how to correctly add/patch own modules into the grub 1.99. The problem:

1. mymod.c depends on a function in biosdisk.c

Avoid this as much as possible. Biosdisk is arch-specific, use generic disk functions.

Quoted 7 lines

2. mymod.c includes the biosdisk.h header correctly I suppose
3. I patched grub-core/Makefile.core.def with

module = {
   name = mymod;
   common = mymod/mymod.c;
   enable = biosdisk;

enable=i386_pc; not biosdisk

Quoted 6 lines

};

4. I patched grub-core/Makefile.core.am with basically a copy from the hello.c module stuff (although I should probably take the arch dependend definitions from biosdisk mod? but I'm building i386 so it should work any way?)

Don't touch this file. Just rerun ./autogen.sh

Quoted 7 lines

5. ./configure&& make works as expected for another module which doesn't include a foreign function.

6. For mymod.c I receive
mymod/mymod.c:68: error: implicit declaration of function 'grub_biosdisk_get_diskinfo_standard'

This function is static ("private"). Moreover it's for very old C/H/S addressing. Looks like you're going the wrong way. Can you detail what's your end goal?

Quoted 5 lines

which is of course in biosdisk.c. Now my question: How do I solve this mystery on a code/patch base? ;) I know that I can add the biosdisk.c to the common code functions, but that shouldn't be necessary, huh? I thought that enable = biosdisk would do the trick with linked functions, but well... maybe you could shed some light on it.

Dependencies are tracked automatically.

Quoted 34 lines

Cheers
Robert

- --

|-------------------------------------------------address-+
| work:  jacob-und-wilhelm-grimm-zentrum
|        geschwister-scholl-str. 1, 10117 berlin
| mail:  humboldt-universität zu berlin
|        computer- und medienservice
|        unter den linden 6, 10099 berlin
|-------------------------------------------------contact-+
| mail:  [email protected]
| icq:   93163687  |  xmpp:  [email protected]
| fb: 	 fb.com/rschumann  |  phone:  +49(0)30-2093-70133
|-------------------------------------------------gpg/pgp-+
| key:   remembrance.de/gpg/0xA5A5FAA2.asc
| fprnt: 9220-9732-7390-7A0C-5623-3336-4233-FDF8-A5A5-FAA2
|---------------------------------------------------------+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8zljkACgkQQjP9+KWl+qLypgCfb6Hbwo8YwvjTbGg7h9BVKZJd QNQAoLSsg7RhpsZ/ovACGkuO42JpZozI
=oLeZ
-----END PGP SIGNATURE-----

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Vladimir!

Thanks for your timely response :)

Am 09.02.2012 12:13, schrieb Vladimir 'φ-coder/phcoder' Serbinenko:

Quoted 9 lines

On 09.02.2012 10:47, Robert Schumann wrote: Heyho guys!

I'm sorry if I didn't RTFM somewhere but I just couldn't find _any_ information on how to correctly add/patch own modules into the grub 1.99. The problem:

1. mymod.c depends on a function in biosdisk.c

Quoted 2 lines

Avoid this as much as possible. Biosdisk is arch-specific, use generic disk functions.

Totally agreed here, but this is the use-case, which I think I cannot modify. I have to stick with biosdisk functions for now, but I'll look into better alternatives (for future use).

Quoted 6 lines

2. mymod.c includes the biosdisk.h header correctly I suppose 3. I patched grub-core/Makefile.core.def with

module = { name = mymod; common = mymod/mymod.c; enable = biosdisk;

Quoted 1 line

enable=i386_pc; not biosdisk

Alright, I had this too but still with Makefile.core.am changes, maybe that's why it didn't work ;-)

Quoted 7 lines

};

4. I patched grub-core/Makefile.core.am with basically a copy from the hello.c module stuff (although I should probably take the arch dependend definitions from biosdisk mod? but I'm building i386 so it should work any way?)

Quoted 1 line

Don't touch this file. Just rerun ./autogen.sh

Oh ok, that sounds indeed simple, thanks for this pointer!

Quoted 8 lines

5. ./configure&& make works as expected for another module which doesn't include a foreign function.

6. For mymod.c I receive mymod/mymod.c:68: error: implicit declaration of function 'grub_biosdisk_get_diskinfo_standard'

Quoted 3 lines

This function is static ("private"). Moreover it's for very old C/H/S addressing. Looks like you're going the wrong way. Can you detail what's your end goal?

Basically it's about NTFS system partition imaging. Relocating of the NT bootloader ntldr seems to need a run of "ntfsreloc" with the proper BIOS values in CHS format. I'm open to every better idea, but that seemed to be the only reliable way (at least on this i386 Win XP platform).

Quoted 7 lines

which is of course in biosdisk.c. Now my question: How do I solve this mystery on a code/patch base? ;) I know that I can add the biosdisk.c to the common code functions, but that shouldn't be necessary, huh? I thought that enable = biosdisk would do the trick with linked functions, but well... maybe you could shed some light on it.

Quoted 1 line

Dependencies are tracked automatically.

Another good news, thank you very much!

Cheers
Robert

- --

|-------------------------------------------------address-+
| work:  jacob-und-wilhelm-grimm-zentrum
|        geschwister-scholl-str. 1, 10117 berlin
| mail:  humboldt-universität zu berlin
|        computer- und medienservice
|        unter den linden 6, 10099 berlin
|-------------------------------------------------contact-+
| mail:  [email protected]
| icq:   93163687  |  xmpp:  [email protected]
| fb: 	 fb.com/rschumann  |  phone:  +49(0)30-2093-70133
|-------------------------------------------------gpg/pgp-+
| key:   remembrance.de/gpg/0xA5A5FAA2.asc
| fprnt: 9220-9732-7390-7A0C-5623-3336-4233-FDF8-A5A5-FAA2
|---------------------------------------------------------+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8ztRAACgkQQjP9+KWl+qKmAQCffcAHDBNL+W+GQeuycPnkDuc6 V0gAoJanFp9klu6ffLgWuRe+kQp3yvQk
=NprO
-----END PGP SIGNATURE-----

#3 lore raw
Quoted 8 lines · Robert Schumann

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Basically it's about NTFS system partition imaging. Relocating of the NT bootloader ntldr seems to need a run of "ntfsreloc" with the proper BIOS values in CHS format. I'm open to every better idea, but that seemed to be the only reliable way (at least on this i386 Win XP platform).

Have a look at chainloader --bpb and ntldr commands. They both do the necessary patching. You need to change only partition start and bios disk values. I don't know the behaviour on a system which supports only C/H/S addressing (that would put it around 95, probably even earlier) but I'd expect that such an old machine is simply not powerful enough to run Windows XP. Also any modern system, especially with disks over C/H/S limit (8.3GB) emulate the same 255/63 geometry

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko