Skip to contentSkip to conversation

How can I use grub_getcrc32 in fs module

DISCUSSION Jiro SEKIBA 2 participants 7 messages Mar 10, 2010 – Mar 16, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

How can I write Makefile to use grub_getcrc32 in file module?

I'm trying to use grub_getcrc32 function to calculate crc of the specific part of the disk so as to validate the disk.

I added lib/crc.c in SOURCES in common.rmk for the fs module. It looks OK to compile the target fs module.
However I got following link error for grub-setup and grub-probe.

grub_setup-fs_nilfs2.o: In function `grub_nilfs2_valid_sb':
nilfs2.c:(.text+0xe29): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe47): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe7e): undefined reference to `grub_getcrc32'
collect2: ld returned 1 exit status

I was trying to specify lib/crc.c in grub_setup_SOURCES, but got same result.

What is the best way to add dependency for those programs if I want to use crc calculation in fs module?

thank you very much in advance

Signature · 1 line
Jiro SEKIBA <[email protected]>
#1 lore raw
Quoted 7 lines · Jiro SEKIBA

Hi,

How can I write Makefile to use grub_getcrc32 in file module?

I'm trying to use grub_getcrc32 function to calculate crc of the specific part of the disk so as to validate the disk.

Filesystem modules are often size-constrained. So we skip the consistency checks unless they are inherent part of filesystem operation. If filesystem is corrupted there isn't much we can do other than hope that boot-related files aren't affected. GRUB itself never writes to fs metadata so it won't lead to any additional corruption

Quoted 4 lines

I added lib/crc.c in SOURCES in common.rmk for the fs module. It looks OK to compile the target fs module.
However I got following link error for grub-setup and grub-probe.

Quoted 9 lines

grub_setup-fs_nilfs2.o: In function `grub_nilfs2_valid_sb':
nilfs2.c:(.text+0xe29): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe47): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe7e): undefined reference to `grub_getcrc32'
collect2: ld returned 1 exit status

I was trying to specify lib/crc.c in grub_setup_SOURCES, but got same result.

Stupid question: have you rerun ./autogen.sh ?

Quoted 5 lines

What is the best way to add dependency for those programs if I want to use crc calculation in fs module?

thank you very much in advance

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

Hi,

At Wed, 10 Mar 2010 14:05:25 +0100,

Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 4 lines · Jiro SEKIBA

Hi,

How can I write Makefile to use grub_getcrc32 in file module?

Quoted 8 lines
Quoted 3 lines

I'm trying to use grub_getcrc32 function to calculate crc of the specific part of the disk so as to validate the disk.

Filesystem modules are often size-constrained. So we skip the consistency checks unless they are inherent part of filesystem operation. If filesystem is corrupted there isn't much we can do other than hope that boot-related files aren't affected. GRUB itself never writes to fs metadata so it won't lead to any additional corruption

Ah, I see. Ok, then we may skip checking super block crc. However, becuase of nature of nilfs2, a log file system, I need to roll forward the logs to find the latest log in case that super block does not point appropriate latest log on unclean unmounting.

In the forwarding process, log is verified by crc.

Quoted 10 lines
Quoted 10 lines

I added lib/crc.c in SOURCES in common.rmk for the fs module. It looks OK to compile the target fs module.
However I got following link error for grub-setup and grub-probe.

grub_setup-fs_nilfs2.o: In function `grub_nilfs2_valid_sb':
nilfs2.c:(.text+0xe29): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe47): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe7e): undefined reference to `grub_getcrc32'
collect2: ld returned 1 exit status

Quoted 4 lines
Quoted 3 lines

I was trying to specify lib/crc.c in grub_setup_SOURCES, but got same result.

Stupid question: have you rerun ./autogen.sh ?

Yes, I did. I should have mentioned.
What I did is

sh autogen.sh
make clean;./configure;make

Quoted 19 lines
Quoted 5 lines

What is the best way to add dependency for those programs if I want to use crc calculation in fs module?

thank you very much in advance

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


[1.2 OpenPGP digital signature <application/pgp-signature (7bit)>]

[2  <text/plain; us-ascii (7bit)>]
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Jiro SEKIBA <[email protected]>
#3 lore raw
Quoted 9 lines · Jiro SEKIBA
Quoted 6 lines

Filesystem modules are often size-constrained. So we skip the consistency checks unless they are inherent part of filesystem operation. If filesystem is corrupted there isn't much we can do other than hope that boot-related files aren't affected. GRUB itself never writes to fs metadata so it won't lead to any additional corruption

Ah, I see. Ok, then we may skip checking super block crc.

Skipping only part of crc checks doesn't bring anything.

Quoted 8 lines

However, becuase of nature of nilfs2, a log file system, I need to roll forward the logs to find the latest log in case that super block does not point appropriate latest log on unclean unmounting.

In the forwarding process, log is verified by crc.

In this case ok. Can you make tests and compare the size with either using lib/crc.c or CRC32 from crypto framework? This is something that would justify keeping lib/crc.c despite my previous plans on its removal if the difference is significant.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

I added lib/crc.c in SOURCES in common.rmk for the fs module. It looks OK to compile the target fs module.
However I got following link error for grub-setup and grub-probe.

grub_setup-fs_nilfs2.o: In function `grub_nilfs2_valid_sb':
nilfs2.c:(.text+0xe29): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe47): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe7e): undefined reference to `grub_getcrc32'
collect2: ld returned 1 exit status

I was trying to specify lib/crc.c in grub_setup_SOURCES, but got same result.

Quoted 10 lines
Quoted 2 lines

Stupid question: have you rerun ./autogen.sh ?

Yes, I did. I should have mentioned.
What I did is

sh autogen.sh
make clean;./configure;make

May I have a look at this part of the patch?

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

Hi,

At Sun, 14 Mar 2010 13:32:46 +0100,

Quoted 20 lines · Vladimir 'φ-coder/phcoder' Serbinenko

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 9 lines · Jiro SEKIBA
Quoted 6 lines

Filesystem modules are often size-constrained. So we skip the consistency checks unless they are inherent part of filesystem operation. If filesystem is corrupted there isn't much we can do other than hope that boot-related files aren't affected. GRUB itself never writes to fs metadata so it won't lead to any additional corruption

Ah, I see. Ok, then we may skip checking super block crc.

Skipping only part of crc checks doesn't bring anything.

Quoted 5 lines

However, becuase of nature of nilfs2, a log file system, I need to roll forward the logs to find the latest log in case that super block does not point appropriate latest log on unclean unmounting.

Quoted 7 lines
Quoted 3 lines

In the forwarding process, log is verified by crc.

In this case ok. Can you make tests and compare the size with either using lib/crc.c or CRC32 from crypto framework? This is something that would justify keeping lib/crc.c despite my previous plans on its removal if the difference is significant.

OK, I'll try to compare.

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 4 lines

I added lib/crc.c in SOURCES in common.rmk for the fs module. It looks OK to compile the target fs module.
However I got following link error for grub-setup and grub-probe.

Quoted 10 lines

grub_setup-fs_nilfs2.o: In function `grub_nilfs2_valid_sb':
nilfs2.c:(.text+0xe29): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe47): undefined reference to grub_getcrc32' nilfs2.c:(.text+0xe7e): undefined reference to `grub_getcrc32'
collect2: ld returned 1 exit status

I was trying to specify lib/crc.c in grub_setup_SOURCES, but got same result.

Stupid question: have you rerun ./autogen.sh ?

Quoted 8 lines
Quoted 7 lines

Yes, I did. I should have mentioned.
What I did is

sh autogen.sh
make clean;./configure;make

May I have a look at this part of the patch?

Sure, that I did the following in common.rmk.
And I see that added line is in a common.mk after rerun autogen.sh.

-------8<-------8<-------8<-------8<-------8<------- === modified file 'conf/common.rmk'

common.rmk +1 -0
@@ -132,6 +132,7 @@
 DISTCLEANFILES += grub_probe_init.c
 
 # For grub-setup.
+grub_setup_SOURCES = lib/crc.c
 grub_setup_init.lst: geninit.sh $(filter-out grub_setup_init.c,$(grub_setup_SOURCES))
 		      rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
 DISTCLEANFILES += grub_setup_init.lst

-------8<-------8<-------8<-------8<-------8<-------

thanks,

regards,

Quoted 13 lines
Signature · 12 lines
-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[1.2 OpenPGP digital signature <application/pgp-signature (7bit)>]

[2  <text/plain; us-ascii (7bit)>]
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Jiro SEKIBA <[email protected]>
#5 lore raw
Quoted 7 lines · Jiro SEKIBA

-------8<-------8<-------8<-------8<-------8<------- === modified file 'conf/common.rmk'

common.rmk

Quoted 8 lines
common.rmk +1 -1
@@ -132,6 +132,7 @@
 DISTCLEANFILES += grub_probe_init.c
 
 # For grub-setup.
+grub_setup_SOURCES = lib/crc.c
 grub_setup_init.lst: geninit.sh $(filter-out grub_setup_init.c,$(grub_setup_SOURCES))
 		      rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
 DISTCLEANFILES += grub_setup_init.lst
-------8<-------8<-------8<-------8<-------8<-------

grub_setup_SOURCES is in i386-pc.rmk and sparc64-ieee1275.rmk

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

grub_setup_SOURCES is in i386-pc.rmk and sparc64-ieee1275.rmk

Grr, that works. Thank you for helping.

Now then, I'll try to compare size of binaries with lib/crc.c and crypt framework.

thanks,

regards

Signature · 1 line
Jiro SEKIBA <[email protected]>