08-02-2013 04:23 AM
I'm experiencing problems passing bootargs from U-Boot to Linux, the reason for using U-Boot is that for our development boards I would like to set a different nfsroot.
If I configure the Kernel to force the kernel boot args then U-Boot can boot the kernel fine. I've rebuilt the Linux Kernel without the force boot args option and use the following U-Boot commands:
setenv bootargs console=ttyUL0 ip=dhcp rootfstype=nfs root=/dev/nfs rw nfsroot=192.168.0.24:/export/nfsroot,tcp,nolock,wsize=4096,rsize=4096
tftp c2000000 192.168.0.24:xilinx.dtb
tftp c1000000 192.168.0.24:simpleImage.xilinx.ub
bootm c1000000 - c2000000
and see no sign of the bootargs being used in the console output. My undertanding is that the bootargs in U-Boot override those in the Device Tree which I have left blank so it uses the default. But from the log below it looks like it is using these default args from the device tree.
U-Boot> bootm c1000000 - c2000000
bootm c1000000 - c2000000
## Booting kernel from Legacy Image at c1000000 ...
Image Name: Linux-3.9.0
Image Type: MicroBlaze Linux Kernel Image (uncompressed)
Data Size: 5120304 Bytes = 4.9 MiB
Load Address: c0000000
Entry Point: c0000000
Verifying Checksum ... OK
## Flattened Device Tree blob at c2000000
Booting using the fdt blob at 0xc2000000
Loading Kernel Image ... OK
Early console on uartlite at 0x40600000
bootconsole [earlyser0] enabled
Ramdisk addr 0x00000000,
FDT at 0xc2000000
Linux version 3.9.0 (martin@martin-Aspire-5740) (gcc version 4.6.2 20111018 (prerelease) (crosstool-NG 1.14.1) ) #12 PREEMPT Fri Aug 2 11:53:10 BST 2013
setup_cpuinfo: Using full CPU PVR support
setup_memory: max_mapnr: 0x4000
setup_memory: min_low_pfn: 0xc0000
setup_memory: max_low_pfn: 0xc4000
setup_memory: max_pfn: 0xc4000
DMA [mem 0xc0000000-0xc3ffffff]
Movable zone start for each node
Early memory node ranges
node 0: [mem 0xc0000000-0xc3ffffff]
On node 0 totalpages: 16384
free_area_init_node: node 0, pgdat c04b0dd0, node_mem_map c0901000
DMA zone: 128 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 16384 pages, LIFO batch:3
early_printk_console remapping from 0x40600000 to 0xff7ff000
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc:  0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyUL0,9600
PID hash table entries: 256 (order: -2, 1024 bytes)
I've connected up gdb and followed the bootm command to the point where it calls the following to start the Kernel in arch/microblaze/lib/bootm.c
* Linux Kernel Parameters (passing device tree):
* r5: pointer to command line
* r6: pointer to ramdisk
* r7: pointer to the fdt, followed by the board info data
thekernel(commandline, rd_data_start, (ulong)of_flat_tree);
and commandline contains the correct bootargs.
Any suggestions as to why they aren't being used by the Kernel would be very welcome.
08-02-2013 04:54 AM
I think I've found the problem, after stepping through the Kernel startup code for the Microblaze I was suprised to see the code that checks for the command line args as not being compiled in. So I looked in head.S and see the following
* handling command line
* copy command line directly to cmd_line placed in data section.
beqid r5, skip /* Skip if NULL pointer */
or r11, r0, r0 /* incremment */
Now I reckon it should check R5 for command line even if the default command line args are set and override these with any that are passed in from the bootloader. So
should be the config item that is used to force the command line args
Does this sound right??
08-06-2013 12:36 AM
Finally found the problem, it looks like a second bug in head.S. Although the command line is setup properly by copying the passed bootargs string from U-Boot in R5 into the cmd_line variable(head.S) this is then overwritten later on when in calls machine_early_init which calls early_init_devtree in prom.c which has the offending line
By commenting out this line I can now use U-Boot to setup up the kernel bootargs.
My understanding is that the U-Boot bootargs should supercede the device tree ones so the proper fix would be to copy the bootargs string in R5 from U-Boot after calling machine_early_init.
12-04-2013 05:58 AM
I am also having trouble with connecting nfs server, i think so that my ip settings are overwritten after bootargs,
i am not familiar with linux, are there any way to solve this without compiling the kernel again, if not how can i change the kernel to solve this problem? Are there bug free versions of this kernel?