Subject: Re: Kernels built from /usr/src won't boot
To: None <port-sparc@NetBSD.org>
From: Rob Quinn <rquinn@sec.sprint.net>
List: port-sparc
Date: 10/02/2003 11:14:28
> I'm unable to boot any of the kernels I build under NetBSD 1.6.1/Sparc64.
> [....] other than the original kernel from the distribution sets.

 I've had similar problems with NetBSD-current/sparc64.  I have a number of
kernels with identical md5's, and some boot and some do not.  In private email
Manuel Bouyer suggested it was related to the disk blocks occupied by the
kernels, and an integer overflow somewhere in the boot code.  Here are some
quotes from those emails:

> [...] last week my unbootable kernels came back, and I noticed something I
> had discounted before - only kernels that I installed by hand ("mv netbsd /")
> were failing.  If I did "make install" they worked fine.  Now that I look,
> all of the kernels I installed by hand had very high inodes (>530000), and
> the good kernels had very low inodes.

>> FFS tries to keep the data blocks close to the inode, so the blocks used by
>> a file have a dependancy on the inode number. [...] it's possible that the
>> boot code has problems with large root partitions.

>> How large is your / partition ?
> %df -kl   
> Filesystem  1K-blocks     Used     Avail Capacity  Mounted on
> /dev/wd0a     7728318  3464694   3877208    47%    /
>> Less than 8G, shouldn't cause any problems. 

>> If you have an unbootable kernel
>  I have about 20
>> can you use fsdb to find its block numbers ? 
>  A bad one followed by a good one:
  [....results below....]
>> OK, the last block of the good one is 0x1fda30, the bad one is in range
>> 0x208520-0x208a80 I suspect an integer overflow somewhere in the boot code
>> (0x1fda30 * 4 won't overflow a int32, but 0x208520 * 4 will - for a int32
>> it's a negative number)), but please post this to port-sparc64. Maybe it'll
>> ring a bell for someone.


 fsdb of a bad kernel:

   fsdb (inum: 531508)> blks
   I=531508 5536 blocks
   Direct blocks:
   0: 2131232 2131240 2131248 2131256 2131264 2131272 2131280 2131288
   8: 2131296 2131304 2131312 2131320 
   Indirect block 2131328 (level 1):
   12: 2131336 2131344 2131352 2131360 2131368 2131376 2131384 2131392
   20: 2131400 2131408 2131416 2131424 2131432 2131440 2131448 2131456
   28: 2131464 2131472 2131480 2131488 2131496 2131504 2131512 2131520
   36: 2131528 2131536 2131544 2131552 2131560 2131568 2131576 2131584
   44: 2131592 2131600 2131608 2131616 2131624 2131632 2131640 2131648
   52: 2131656 2131664 2131672 2131680 2131688 2131696 2131704 2131712
   60: 2131720 2131728 2131736 2131744 2131752 2131760 2131768 2131776
   68: 2131784 2131792 2131800 2131808 2131816 2131824 2131832 2131840
   76: 2131848 2131856 2131864 2131872 2131880 2131888 2131896 2131904
   84: 2131912 2131920 2131928 2131936 2131944 2131952 2131960 2131968
   92: 2131976 2131984 2131992 2132000 2132008 2132016 2132024 2132032
   100: 2132040 2132048 2132056 2132064 2132072 2132080 2132088 2132096
   108: 2132104 2132112 2132120 2132128 2132136 2132144 2132152 2132160
   116: 2132168 2132176 2132184 2132192 2132200 2132208 2132216 2132224
   124: 2132232 2132240 2132248 2132256 2132264 2132272 2132280 2132288
   132: 2132296 2132304 2132312 2132320 2132328 2132336 2132344 2132352
   140: 2132360 2132368 2132376 2132384 2132392 2132400 2132408 2132416
   148: 2132424 2132432 2132440 2132448 2132456 2132464 2132472 2132480
   156: 2132488 2132496 2132504 2132512 2132520 2132528 2132536 2132544
   164: 2132552 2132560 2132568 2132576 2132584 2132592 2132600 2132608

 fsdb of a good kernel:

   fsdb (inum: 531538)> blks
   I=531538 5536 blocks
   Direct blocks:
   0: 2077720 2077736 2077752 2077760 2077768 2077776 2077784 2077800
   8: 2077808 2077816 2077824 2077840 
   Indirect block 2077856 (level 1):
   12: 2077864 2077872 2077880 2077888 2077896 2077904 2077920 2077928
   20: 2077952 2077960 2077968 2077976 2077984 2077992 2078000 2078008
   28: 2078016 2078024 2078032 2078040 2078048 2078056 2078064 2078072
   36: 2078080 2078088 2078096 2078104 2078112 2078120 2086408 2086416
   44: 2086424 2086432 2086440 2086448 2086456 2086464 2086480 2086488
   52: 2086496 2086504 2086512 2086520 2086528 2086536 2086544 2086552
   60: 2086560 2086568 2086576 2086584 2086592 2086600 2086608 2086616
   68: 2086624 2086632 2086640 2086648 2086656 2086664 2086672 2086680
   76: 2086688 2086696 2086704 2086712 2086720 2086728 2086736 2086744
   84: 2086752 2086760 2086768 2086776 2086784 2086792 2086808 2086816
   92: 2086824 2086832 2086840 2086848 2086864 2086872 2086880 2086888
   100: 2086896 2086904 2086912 2086928 2086936 2086944 2086952 2086960
   108: 2086968 2086976 2086984 2086992 2087000 2087008 2087016 2087024
   116: 2087032 2087040 2087048 2087056 2087064 2087072 2087080 2087088
   124: 2087096 2087104 2087112 2087120 2087128 2087136 2087144 2087152
   132: 2087160 2087168 2087176 2087184 2087192 2087200 2087208 2087216
   140: 2087224 2087232 2087240 2087248 2087256 2087264 2087272 2087280
   148: 2087288 2087296 2087304 2087312 2087320 2087328 2087336 2087344
   156: 2087352 2087360 2087368 2087376 2087384 2087392 2087400 2087408
   164: 2087416 2087424 2087432 2087440 2087448 2087456 2087464 2087472