User Tools

Site Tools


Sidebar

Launch of Linino.org

wiki:upgradetolininoio

PLEASE READ CAREFULLY

If you have bought a Arduino Yun board and you want to upgrade your board to LininoIO, you must first upgrade your on-board OS from Openwrt-Yun to LininoOS as described here :

http://wiki.linino.org/doku.php?id=wiki:upgradeimage#upgrade_your_arduino_yun_with_sysupgrade

Once completed this first part, you will be able to proceed to the following steps…

Introduction

What changes if you install LininoIO? With LininoIO you don't need to write your C code application for the MCU.

It is enough to install LininoIO on the MCU side and all of the functionalities, like GPIO, ADC, PWM, I2C, etc. will be exported onto the LininoOS.

To install LininoIO we need to:

  • update the U-Boot, because we need a new version where the U-Boot environment can be saved
  • update with sysupgrade the firmware, kernel and rootfs
  • update the MCU firmware to LininoIO version

Preparations

Load the firmware into your board on the MCU to have the Linux serial console available on the USB connection. This can help in case of issues arising during the upgrade. If you have a LininoOS installed on your YÚN or LininoONE, connect to the board through an SSH connection, for example:

[your PC] > ssh root@linino.local or ssh root@arduino.local

to upgrade the firmware on the MCU (Atmel 32U4) run the following command:

For Arduino YÚN:

$ run-avrdude /etc/linino/YunSerialTerminal.hex

For Linino ONE:

$ run-avrdude /etc/linino/LininoOneSerialTerminal.hex

If terminal show all gibberish, try key combination ~1, ~2 to switch to 115200 or 25000 bauds.

If you don't have the latest image of LininoOS installed or you have the Arduino OpenWRT distribution, please download and install the serial terminal:

cd /tmp
wget http://donwload.linino.org/pkg-bin/serialTerminal.hex
run-avrdude /tmp/serialTerminal.hex

If you are using Arduino IDE, load onto the Arduino YÚN or Linino ONE the example YunSerialTerminal under the Bridge examples. This might save your board if, by any chance, something goes wrong.

Foreword

To be able to run this howto you must have an Ethernet connection.

U-Boot prompt

Once connected by means of the Arduino IDE or of a serial terminal as cu or minicom (i.e.) :

sudo cu -l /dev/ttyACM0 -s 115200

(if you use MACOSX 10.9.4, you must use this path: /dev/tty.usbmodem1411 ) push the Linux reset button and type lin to stop the boot of the Linux cpu.

You will be presented with the following output :

Linino Board (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:  0
linino>

If the output you obtain is not the same, you may have an old version of the U-Boot that doesn't permit to save the U-Boot environment. To use LininoIO you need to upgrade the U-Boot following the following instructions.

U-Boot upgrade

  • Verify that you have a TFTP server installed on your PC
  • Verify that the board and the PC are conencted via Ethernet on the same LAN
  • Setup the TFTP server and TFTP client IP addresses at the U-Boot prompt (Note about TFTP for MAC OS X 10.9.3):
setenv serverip <tftp-server-ip>; setenv ipaddr <linino-board-ip>;

on my setup I have:

server ip address: 192.168.0.101
linino board ip address: 192.168.0.120
ar7240> setenv ipaddr 192.168.0.120;
ar7240> ping 192.168.0.101
dup 1 speed 100
Using eth0 device
host 192.168.0.18 is alive
 
ar7240> setenv serverip 192.168.0.101; 
ar7240> setenv ipaddr 192.168.0.120;
 
ar7240> tftp 0x80060000 openwrt-ar71xx-generic-linino-u-boot.bin; 
Using eth0 device
TFTP from server 192.168.0.18; our IP address is 192.168.0.23
Filename 'openwrt-ar71xx-generic-linino-u-boot.bin'
Load address: 0x80060000
 
Loading: ####################################
 
done
 
Bytes transferred = 181852 (2c65c hex)
  • if the file was properly downloaded you can proceed: erase the flash and copy the new boot. In case of FAIL, try to understand if the Ethernet connection is present and if the file is in the right position on the TFTP server.

DON'T type the following command if the tftp failed!

ar7240> erase 0x9f000000 +0x40000; 
Erase Flash from 0x9f000000 to 0x9f03ffff in Bank #
First 0x0 last 0x3 sector size 0x10000
   3
Erased 4 sectors
ar7240> cp.b $fileaddr 0x9f000000 $filesize;
 
Copy to Flash... write addr: 9f000000
done

Congratulations! The new U-Boot is ready! Please reboot and proceed to install the new kernel image where the cmdline is taken from the U-Boot.

ar7240> reset

By default the new boots use the 115200 baud rate but the serial console on the MCU uses by default 250k. Please use the key combination ~1, ~2 to switch to 115200 or 25000 bauds.

New U-Boot prompt

U-Boot 1.1.4-linino-g033da82e-dirty (Jun 16 2014 - 23:37:27)
Linino Board (ar9331) U-boot
DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 217k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
*** Warning - bad CRC, using default environment
In:    serial
Out:   serial
Err:   serial
Net:   eth0: b4:21:8a:00:00:00
eth1: b4:21:8a:00:00:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
linino>

You can check the old configuration typing the following command:

linino> printenv
bootargs=console=ttyATH0,115200 board=linino-yun mem=64M rootfstype=squashfs,jffs2 noinitrd mtdparts=spi0.0:25
6k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware)
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
 
Environment size: 399/65532 bytes
 
linino>

Set properly the booargs, putting the console=spicons : For the ArduinoYÚN board:

linino> setenv bootargs 'console=spicons board=linino-yun mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd'

For the LininoONE board:

linino> setenv bootargs 'console=spicons board=linino-one mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd'

Set the proper baudrate:

linino> setenv baudrate 250000
--change the baudrate then press Enter--

You will probably be asked to change your baudrate to 250k, especially if you are working with serial terminals such as cu or minicom: type : ~2 ,where the first tilde works as an escape character. Then save your new environment with:

linino> saveenv; 
Saving Environment to Flash...
Protect off 9F040000 ... 9F04FFFF
Un-Protecting sectors 4..4 in bank 1
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000
   4
Erased 1 sectors
Writing to Flash... write addr: 9f040000
done
Protecting sectors 4..4 in bank 1
Protected 1 sectors
 
linino> printenv
bootcmd=bootm 0x9fea0000
bootdelay=4
baudrate=250000
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=console=spicons board=linino-yun mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(k
ernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd rootfstype=squa
shfs,jffs2 noinitrd
 
Environment size: 424/65532 bytes
 
linino> reset

Upgrade the Linino image

Update the Linino image using the following commands:

For Arduino YÚN

cd /tmp
wget http://download.linino.org/linino_distro/lininoIO/latest/lininoIO-generic-linino-yun-squashfs-sysupgrade.bin
sysupgrade -n -v lininoIO-generic-linino-yun-squashfs-sysupgrade.bin

For Linino ONE:

cd /tmp
wget http://download.linino.org/linino_distro/lininoIO/latest/lininoIO-generic-linino-one-squashfs-sysupgrade.bin
sysupgrade -n -v lininoIO-generic-linino-one-squashfs-sysupgrade.bin

Connect to the board by means of SSH: SSH root@linino.local or discover the IP assigned by DHCP to your board and install LininoIO on the MCU:

run-avrdude /etc/linino/bathos-one.hex
reboot && exit

then perform a reset of both MCU and MIPS or unplug the board and plug it again.

The Linux console from both the USB port and the SSH is now available ! ! !

PAY ATTENTION : if the user makes a mistake and gets a mismatch between the mcu firmware and the u-boot baudrates, they will panic because the u-boot cmd line is not reachable any more. However, a workaround is still possible if your board boots and you can reach it by ssh. You can still change the u-boot baudrate by means of the Linux userspace fw_printenv and fw_setenv commands (i.e.):

fw_setenv baudrate 250000

Upgrade LininoIO using linup

On the latest image of LininoIO it is possible to read the build information of the image itself by using the command

root@linino:/# cat /etc/linino_version
DISTRIB_ID="Linino"
DISTRIB_RELEASE="lininoIO"
DISTRIB_REVISION="0c1bd59"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
BUILD_DATE="2014-09-16"

to upgrade the image to the latest one, use the command linup:

USAGE : linup <revision> ( latest or YYYYMMDD.x where x=0,1,2...n ) \ 
            <branch> ( optional : lininoIO or master )
 
root@linino:/#  linup latest

If on your distribution the file /etc/linino_version is not preset, then you need to specify in what release of Linino you are interested. Use the following command to upgrade the board:

root@linino:/#  linup latest lininoIO
the current branch is master
 
Verifying internet connection...
 
The current kernel date is : 01 08 2014
Linino OS image date is : 15 09 2014
 
A new upgrade is available for your system !
 
Do you want to upgrade your board now ? (y/n)
 
Connecting to download.linino.org (88.198.63.58:80)
 
openwrt-ar71xx-gener 100% |*******************************| 15696k  0:00:00 ETA
 
Calculating MD5 checksums...
 
lininoIO-generic-linino-yun-squashfs-sysupgrade.bin: OK
 
 
1. Upgrade and keep your current setting
2. Upgrade and revert to default settings
0. Exit
 
Choose : 

Press 1 to upgrade the image keeping your settings and configuration. Press 2 to upgrade the image reverting the setting to the factory default.

The firmware will be upgraded and the board will reboot with the new enhanced version of LininoOS.

The lininoio script

Once rebooted and logged again in by means of SSH, you have to perform the final step by running the lininoio script to fully enable the lininoIO functionalities :

$ lininoio -h

USAGE : lininoio <-f> <start/stop> - enables/disable the LininoIO features with the optional `force` switch
	       lininoio -v : prints out the versioning details of the LininoIO operating system
	       lininoio -s : shows the current status of the LininoIO features (ENABLED/DISABLED)
	       lininoio -h : prints out this HELP

please also pay attention to the fact that you have to run this script when logged in by means of SSH otherwise you might damage your board. So once gained root access at the shell type :

$ lininoio start

and a disclaimer will appear :

WARNING ! Please be sure to run lininoio when connected by means of SSH to your board, otherwise you could damage your board !

Do you want to proceed ? [y/n]

then answer YES (y) and another question will pop-up before starting the actual process :

Do you want to enable the LininoIO OS features ? [y/n]

and answer YES (y) again. At the end of the process you will be asked to reboot your board, just answer YES (y) one more time and then wait a couple of minutes before logging in again.

/var/www/wiki.linino.org/data/pages/wiki/upgradetolininoio.txt · Last modified: 2015/09/08 03:55 by arturo

2014 © dog hunter llc and the Linino Community. Linino.org is a dog hunter sponsored community project. Credits