3

I'am using Arduino Yun and i want mount rootfs over NFS.

I downloaded openwrt sources, build the project and then copied the generated rootfs from build_dir/target-mips_34kc_musl-1.1.15/root-ar71xx under /home/user/srv/nfs/root-ar71xx

in the uboot prompt the command line i used is :

setenv bootargs root=/dev/nfs rw nfsroot=192.168.1.1:/home/user/srv/nfs/root-ar71xx ip=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0::off; bootm

uboot environement variables:

ar7240> printenv
bootcmd=bootm 0x9fea0000
bootdelay=4
baudrate=115200
ethaddr=0xb4:0x21:0x8a:0x00:0x00:0x10
ipaddr=192.168.1.2
serverip=192.168.1.1 
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
bootargs=root=/dev/nfs rw nfsroot=192.168.1.1:/home/user/srv/nfs/root-ar71xx     
ip=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0::off

Environment size: 319/65532 bytes

But i got :

## Booting image at 81000000 ...
Bad Magic Number

I read in this link, that there is a kind of encapsulation for the kernel in order to be "known" by U-Boot. Is it the same thing for the rootfs

I have another question but it's not very related to the topic: After building the project i have several binaries (24) under bin/ar71xx/:

openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-tftp.bin 
openwrt-ar71xx-generic-tl-mr11u-v1-squashfs-sysupgrade.bin
openwrt-ar71xx-generic-wzr-hp-g300nh2-squashfs-factory.bin
...

I expect only one kernel image what all these images are supposed to do ?

Thanks in advance.

EDIT:

I change the cmd line to :

setenv bootargs root=/dev/nfs rw nfsroot=192.168.1.1:/home/bou6/srv /nfs/root-ar71xx ip=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0::off;  bootm 0x9fea0000

and i don"t have Bad Magic Number anymore, but still questions:

1- How can we know the load address of the kernel

2- I noticed even though the ethernet cable is not branched the kernel continue to use the default file system flashed on the Yun, is there a method to desactivate this.

4
  • I don't know about Arduino, but usually for U-Boot you have some environment vars that defines where kernel is stored, where to copy and start the kernel. Same thing for the second question: there is a script of boot: analyze.
    – LPs
    Nov 24, 2016 at 7:11
  • For U-Boot issues, you should include in your post the boot log (that shows all operations leading up the boot failure) and the environment variables (i.e. from the printenv command). " there is a kind of encapsulation for the kernel " -- That would the U-Boot wrapper header installed by the mkimage utility. Apparently the "Bad Magic Number" error you're getting is due to the fact you're booting from RAM that has no kernel image (i.e. the bootm command is using a default address).
    – sawdust
    Nov 24, 2016 at 8:25
  • "How can we know the load address of the kernel" -- It should already be in the uImage header, but the uImage should not be loaded at that address. "I noticed even though the ethernet cable is not branched ..." -- I don't understand what you mean by "not branched". "the kernel continue to use the default file system" -- There is no such thing as a "default (root) filesystem" (except for the initramfs). The full boot log would probably explain what's going on.
    – sawdust
    Nov 24, 2016 at 8:32
  • Thanks @sawdust and @LPs : 1- I will attach the log when i get back home 2- "is not branched" , i have to say "The board and the NFS server are disconnected ". As @LPs mentioned it seems that it's a uboot configuration(uboot tells the kernel if you don't get the rootfs in the cmd line try the other ) 3- OK for the load address is in the uImage, so in which case the bootm is useful
    – Mouin
    Nov 24, 2016 at 15:20

1 Answer 1

0

It is not enough to just set bootargs then call bootm ... you need to load a kernel image from somewhere - so the answer to question 1 is "pick any address you like - as long as it is in RAM and there is enough space there to fit the kernel image that you will load into it".

To load the kernel image, set up a tftp server and use the tftpboot u-boot command. e.g.

tftpboot <address> openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-tftp.bin

(I am guessing that this is the file containing the kernel image, but probably not) - then you can use the bootm command e.g.

bootm <address>

You might find some clues here.

As an aside, the ip=... kernel command line has this format:

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>

so I feel like there should be two colons before off e.g.

ip=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0:::off

but I could be wrong about that.

Re question 2, I would expect the boot to fail and u-boot to fall back to the prompt - not continue on and use the filesystem in flash.

And finally, you need to list all 24 file names from bin/ar71xx so we can determine which of them is the kernel image (my guess above doesn't feel right).

1
  • Thank u for the feedback Ok for (1). Concerning the good kernel image, i'am not sure if i'am passing the good kernel image,this is the whole list , thank u for pointing me to the good one. For the command line, i guess using <hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip> are optional isn't that correct
    – Mouin
    Nov 25, 2016 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .