Showing posts with label z4. Important Yun fixes. Show all posts
Showing posts with label z4. Important Yun fixes. Show all posts

Wednesday, December 31, 2014

Create a SWAP partition on the Arduino Yun

This will create a 128MB (=2x RAM) swap partition on the Yun's SD card. I already have 2 partitions on the SD, this will be the 3th. First create an extra partition and format it as explained at

http://myyafa.blogspot.be/2014/05/create-and-format-partitions-on-yun-sd.html

  After another reboot (maybe using mount command this reboot isn't needed?), df displays:
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                 4183000    410916   3562372  10% /
/dev/root                 7680      7680         0 100% /rom
tmpfs                    30560       112     30448   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/sda1              4183000    410916   3562372  10% /
/dev/sda2              3138272    112080   2868908   4% /mnt/sda2
/dev/sda3               129267      7982    114732   7% /mnt/sda3
Next do:
root@Arduino:~# umount /dev/sda3
root@Arduino:~# mkswap /dev/sda3
Setting up swapspace version 1, size = 131068 KiB
no label, UUID=54a098ed-4e70-4392-8232-bd1f394df68a
root@Arduino:~# swapon /dev/sda3
Probably if I hadn't rebooted or so, the unmounting wasnt necessary... In /etc/config/fstab add:
config swap
        option device   /dev/sda3
        option enabled  1

swapiness can be controlled via:
sysctl -w vm.swappiness=10
echo 10 > /proc/sys/vm/swappiness
This will not remember the value across booting. For that edit /etc/sysctl.conf so that it contains:
vm.swappiness = 10

The free command or 'swapon -s' command can be given to get info about your swap.

Sunday, May 25, 2014

Moving the linux filesystem OpenWrt to the SD card

Standard the OS is on the flash of the Yun. It is possible to move (most) to the SD card.

Advantages are:
- much more space, allowing to install many more packages
- the flash can be written only a limited amount of times. If you move the OS to the SD card, this is no longer an issue. The SD card also has a limited amount of writes, but typically more than the flash, and it is much easier to replace the SD card than the flash.

Before starting, create at least one ext4 partition on the SD card (see e.g. http://myyafa.blogspot.be/2014/05/create-and-format-partitions-on-yun-sd.html)

On the Yun do (pivot root option):
opkg update
opkg install block-mount
cd /
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
umount /tmp/cproot
edit the file /etc/config/fstab and add:


config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
That's it. Reboot and the OS should now reside on the SD. If you still want to access the old filesystem on the flash (this is still used at boot for example) you can do
cd /
mkdir original-boot
and add
config mount
        option target   /original-boot
        option device   /dev/mtdblock3
        option fstype   jffs2
        option options  rw,sync
        option enabled  1
        option enabled_fsck     0
to the /etc/config/fstab file (see also http://forum.arduino.cc/index.php?topic=289215.0) (the one on the SD card)

Saturday, May 24, 2014

Upgrade Yun with new image (OpenWrt-Yun 1.0)

There is a new image for the Yun with important fixes, and better link to OpenWrt.
More info and detailed installation guidelines can be found on http://forum.arduino.cc/index.php?topic=235360.msg1693350#msg1693350 Before doing the procedure I saved the installed packages to a file:
opkg list-installed
Next I formatted my SD card(not needed, but I want a clean start). First I did this on my Ubuntu PC but this gave issues with user groups and permissions. So I did the formatting on my Yun directly:
df
umount /mnt/sda1
mkfs.ext4 -L YunSD /dev/sda1
note the /dev/sda1 iso /mnt/sda1 for the mkfs command.
mkdir /mnt/sda1/arduino

Next, extract the zip file for the update into the root folder of the SD card.

ssh to the Yun and execute:
run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin
result is (nothing needs to be done when it looks like there is a prompt with the Writing from ...:
Sending TERM to remaining processes ... uhttpd dbus-daemon dnsmasq thd ntpd uSDaemon sftp-server sleep syslogd klogd hotplug2 procd ubusd netifd 
Sending KILL to remaining processes ... 
Switching to ramdisk...
Performing system upgrade...
Unlocking firmware ...

Writing from  to firmware ...     
Upgrade completed
Rebooting system...
Rebooting didnt seem to happen automatically. Power cycled and after a while I saw the USB led on, a sign of the new image. The Yun is completely fresh, so you need to start all over, connecting to the Yun wireless network, enter default password arduino, etc...

Monday, December 23, 2013

Bridge Communication - part 5

My part4 was maybe too optimistic. It seems some people still have problems with long strings over the Bridge. A fix was found (http://forum.arduino.cc/index.php?topic=196091.msg1517378#msg1517378)

Until an official release do:

  • Using SSH or YunSerialTerminal, connect to the linux side of the yun.
  • Edit file /usr/bin/run-bridge, changing "python bridge.py" with "python -u bridge.py" (ie: add a "-u" to the command line)
  • Edit file /usr/bin/kill-bridge, again changing "python bridge.py" with "python -u bridge.py" (ie: add a "-u" to the command line)
  • Type kill-bridge and re-run your sketch


Saturday, November 30, 2013

Bridge Communication - Part 4

The new IDE 1.5.5 was released with Bridge bug fixes. This solved so far all my Bridge issues :-)