Solved Kernel fails to boot when kernel size greater than 64Mbytes.

allenshep

New Member


Messages: 2

#1
If the kernel size is less than 64M it boots just fine.
If it is larger the kernel just hangs, no fault, no core dumb just hangs.

Both the elf kernel as well as the kernel.bin versions behave the same way.

FreeBSD version “On branch releng/11.1”
u-boot-xlnx “xilinx-v2017.4”
cpu: armv6

The reason the kernel is so large, is because I am compiling the root fs into the kernel.

Kernel config file
Code:
    options         MD_ROOT
    makeoptions     MFS_IMAGE=/tmp/rootfs.ufs.uzip
    options         ROOTDEVNAME=\"ufs:md0.uzip\"
Initially I was using ubldr, afraid that this might be the problem now I am loading the kernel with u-boot alone with the same results.
 

tingo

Daemon

Thanks: 336
Messages: 1,835

#2
Yes, this happens. If you look at the source, you will find out that the early parts of the boot loader(s) have various limits on some of the architectures supported by FreeBSD. Due to the fact that only parts of the platform is initialized by them.
 
OP
OP
A

allenshep

New Member


Messages: 2

#3
The problem is in the kernel initialization code and yes it is dependent on the architecture since each architecture has its own initialization.

In the following file /sys/arm/arm/locore-v6.S I found the following peace of code.
Code:
/*
* Next we do 64MiB starting at the physical load address, mapped to
* the VA the kernel is linked for.
*/
mov     r1, r5
ldr     r2, =(KERNVIRTADDR)
mov     r3, #64
bl     build_pagetables
So it looks like they didn't bother trying to figure out how large the kernel was, they just arbitrarily assumed that it would never be larger than 64MiB.

So the hack solution is to change the kernel size in the above code to a size larger than your kernel and recompile and wa-lah (voila) your kernel will boot just fine.
 
Top