question about while(this_kernel->name)

Andy Green andy at openmoko.com
Mon Aug 25 16:32:22 CEST 2008


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

Somebody in the thread at some point said:
|> void bootloader_second_phase(void)
|> ......
|>         while (this_kernel->name) {    <--line 51
|
| if the SD kernel and NAND kernel both can not boot
| is this line[51] will cause something like "Segmentation fault"
|
| if we should add some code like:
|>     [2] = {
|>        .name = 0,
|>     },
|
| in .kernel_source = {

No, it isn't needed since gcc will take care about any undefined members
and array elements there being zero: there won't be any crash (and
because we don't handle the exception, it would just crash rather than
give us segfault).

Examine the ./image/qi.dis file eg

330020e8 <board_api_gta02>:
330020e8:       33001e90 00000518 30000000 08000000     ...3.......0....
330020f8:       30000100 33001c20 33001c00 33001cb4     ...0 ..3...3...3
33002108:       33001c40 33001ea4 33001eb8 33001c90     @..3...3...3...3
33002118:       33001c68 00000001 00000000 00000002     h..3............
33002128:       33001ec8 33001fc8 00000000 00000000     ...3...3........
33002138:       00000630 00000000 00000400 00000000     0...............
33002148:       33001fd4 00000000 00000000 00000000     ...3............
~        ...

3300220c <board_variants>:

in hexdump terms


~                            1e90 3300 0518 0000
00020f0 0000 3000 0000 0800 0100 3000 1c20 3300
0002100 1c00 3300 1cb4 3300 1c40 3300 1ea4 3300
0002110 1eb8 3300 1c90 3300 1c68 3300 0001 0000
0002120 0000 0000 0002 0000 1ec8 3300 1fc8 3300
0002130 0000 0000 0000 0000 0630 0000 0000 0000
0002140 0400 0000 0000 0000 1fd4 3300 0000 0000
0002150 0000 0000 0000 0000 0000 0000 0000 0000
*
0002200 0000 0000 0000 0000 0000 0000 20d8 3300

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

iEYEARECAAYFAkiywnYACgkQOjLpvpq7dMrefQCdGvM/MJ98E2nWQP86WcNsPZom
QEoAnAj01CV6x4e0AvZgo9sBfZYEIbik
=JibT
-----END PGP SIGNATURE-----



More information about the openmoko-kernel mailing list