Bad Magic Number after reflashing yun

I reflashed the the kernel and openwrt as instructed in http://arduino.cc/en/Tutorial/YunUBootReflash and it seemed to go ok but now I can only connect to it through YunSerialTerminal. It goes directly into u-boot, and I cannot get out of u-boot. When it tries to boot openwrt, it fails and responds “Bad Magic Number”
When I enter “reset” in u-boot I get the following (from serial monitor) response:

ar7240> reset

U-Boot 1.1.4-gd995931a-dirty (Aug 7 2013 - 16:16:04)

Arduino Yun (ar9331) U-boot

DRAM: 64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 142k for U-Boot at: 83fdc000
Reserving 192k for malloc() at: 83fac000
Reserving 44 Bytes for Board Info at: 83fabfd4
Reserving 36 Bytes for Global Data at: 83fabfb0
Reserving 128k for boot params() at: 83f8bfb0
Stack Pointer at: 83f8bf98
Now running in RAM - U-Boot at: 83fdc000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
Using default environment

In: serial
Out: serial
Err: serial
Net: ag7240_enet_initialize...
No valid address in Flash. Using fixed address
No valid address in Flash. Using fixed address
: cfg1 0x5 cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
eth0 up
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Hit any key to stop autoboot: 4 3 2 1 0

Booting image at 9fea0000 ...

Bad Magic Number
ar7240>

and back in u-boot. Same thing happens when I enter bootm 0x9fea0000. Does anyone know what Bad Magic Number means? Some kind of checksum? Has anyone had this problem?

sevenory:
::::SNIP::::
eth1 up
eth0, eth1
Hit any key to stop autoboot: 4 3 2 1 0

Booting image at 9fea0000 ...

Bad Magic Number
ar7240>

and back in u-boot. Same thing happens when I enter bootm 0x9fea0000. Does anyone know what Bad Magic Number means? Some kind of checksum? Has anyone had this problem?

@sevenory,
When it says:

Booting image at 9fea0000 ...

That says, it is trying the image that it needs to load at memory location: 9fea0000 (the kernel or a supporting module) and it (the image) failed with a with a Bad Magic Number. The "Bad Magic Number" is a number stored in the image being loaded; the number is in a predefined location. Your best solution is to reload the software. The software you uploaded (flashed ) has been corrupted. So reflash the Yun.

I hope this is clear. If not, please ask questions.

Jesse

Thank you. I can no longer see the yun on the network. I can only communicate with it through YunSerialTerminal. It does seem to be connected as the WAN led is on and blinks occasionally, but I cannot find the yun on the network. Any ideas?

sevenory:
Thank you. I can no longer see the yun on the network. I can only communicate with it through YunSerialTerminal. It does seem to be connected as the WAN led is on and blinks occasionally, but I cannot find the yun on the network. Any ideas?

@sevenory
in type ifconfig (of course, hit enter when done). Please post the results as listing in the terminal. (copy and paste). Please use markup. You should see results like those below.

TIA
Jesse

root@Arduino:/# ifconfig
eth1      Link encap:Ethernet  HWaddr 90:A2:DA:F8:0A:22  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:4 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1716 (1.6 KiB)  TX bytes:1716 (1.6 KiB)

wlan0     Link encap:Ethernet  HWaddr 90:A2:DA:F8:0A:22  
          inet addr:192.168.43.237  Bcast:192.168.43.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:89 errors:0 dropped:0 overruns:0 frame:0
          TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:17282 (16.8 KiB)  TX bytes:11934 (11.6 KiB)

root@Arduino:/#

arduino_markup.png

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 418  bytes 31932 (31.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 418  bytes 31932 (31.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.49  netmask 255.255.255.0  broadcast 10.0.1.255
        inet6 fe80::3ab1:dbff:febc:e0cb  prefixlen 64  scopeid 0x20<link>
        ether 38:b1:db:bc:e0:cb  txqueuelen 1000  (Ethernet)
        RX packets 105526  bytes 41699367 (39.7 MiB)
        RX errors 0  dropped 10  overruns 0  frame 0
        TX packets 88215  bytes 12438182 (11.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Thanks Jesse for looking into this. The response I get to ifconfig (see above) looks quite different from your example. I am using the shell in a chromebook.

@sevenory,
your YUN has an IP of 10.0.1.49
See if you can log into it.
Check your own IP first.

Jesse

sevenory:
Thanks Jesse for looking into this. The response I get to ifconfig (see above) looks quite different from your example. I am using the shell in a chromebook.

Did you type this command while at the shell of the Chromebook? If so, then it is the network information for the Chromebook, not your Yun, which would explain why it looks so different.

Or, once at the Chrombook's shell, did you use the SSH command to get to your Yun and THEN issue the command?

The Chromebook's shell won't be very interesting here. The command needs to be issued at the Yun, which if you are not able to connect over the network means you will have to issue it using YunSerialTerminal. However, I don't know why Jesse is asking you to run this command: if uboot is failing with a bad magic number, the Yun really hasn't even started to boot, and does not have the ability to run any Linux commands. That command will not be recognized.

The good news is that uboot is still working. The bad news is that your Linux image is corrupt. I think your only option is to follow the instructions for re flashing the system software onto your Yun, and fortunately you can skip reflashing uboot which is the dangerous step. See: Reflashing the OpenWrt-Yun image on the Yún

Thank you for your suggestions/comments. I think i have not been clear -- I cannot see the yun on my network in wifi or ethernet and therefore cannot connect to it through the network. I can only connect to it using YunSerialTerminal, through USB,and it cannot boot into Openwrt, but stays in u-boot. By your suggestions it seems clear that the image is corrupted and should be reflashed. Is there a way to reflash through YunSerialTerminal in u-boot? Can I put the image on an sd card, and access the card through u-boot? Thanks for any suggestions.

sevenory:
Is there a way to reflash through YunSerialTerminal in u-boot?

Yes, you need to have YunSerialTerminal loaded and running so that you can interrupt the uboot process and type the necessary commands to uboot.

Can I put the image on an sd card, and access the card through u-boot?

I don't believe so, there isn't enough of a system running to be able to access the SD card.

The process is spelled out in the link from my previous post. Basically the steps are:

  • Set up a TFTP server that has the flash image files.
  • Use YunSerialTerminal to interrupt booting and get the uboot prompt
  • Configure basic network settings so your Yun can see you TFTP server
  • Download the image file to the Yun's RAM
  • Program the image file to flash memory

Yes, I understand the Yun is not appearing on the network, but you do need to set up the network server to be able to reflash the Yun. Once you are in uboot, it has a very simple network driver built into it. You will manually configure the IP addresses, and then copy the files from your server to the Yun. It's all spelled out on that page.

And once again, since uboot is working for you, skip the optional step about reflashing uboot.

Thank you ShapeShifter for your clear procedure for reflashing the yun. I have tried it and it times out when loading the image to the yun. I think the problem is in configuring the net work settings so the yun can see the tftp server. I gave the yun an ip by setting the ipaddr in uboot. But tftp server does not seem to see it. Does the tftp server go through the network server to see the yun? Or should the yun be connected to the computer that has the tftp server? Thanks for any suggestions.

sevenory:
But tftp server does not seem to see it. Does the tftp server go through the network server to see the yun? Or should the yun be connected to the computer that has the tftp server?

I'm confused by all of this. What is the network server, and what do you mean by "go through it"?

And what do you mean by the TFTP sever going to the Yun?

The idea is you set up the TFTP server on a computer. Then everything else is driven by the Yun: you give the Yun an address for itself, and you tell it the address of the computer running the TFTP server. Then you issue commands on the Yun to fetch the files from the TFTP server. (Forgive me if this is obvious, but it sounds like you are trying to drive the upgrade from the server?)

It would be helpful if you posted the IP address of the server, and then posted a complete transcript of your flashing attempt from the time of rebooting the Linux side and entering uboot, through any and all error messages you get. Also, tell us how you have everything connected (cabling, any routers involved, what the LEDS on the Ethernet connector are doing, etc.) It's probably something simple, but it's hard to tell without all of the information.

Problem solved! I was able to successfully reflash the yun. Thank you very much ShapeShifter for your detailed instructions.

Congratulations! Thanks for the follow-up. 8)