How to expand the storage memory on the Yún

dctsystems:
The suggestion that it's impractical to compile natively is bogus. Especially with this upgrade in place, storage is no longer an issue, and 400MHz/64Mb is actually pretty decent (I've compiled GCC on a 16MHz Machine with 4Mb RAM - it took pretty much a whole day, but that was totally OK).

I would love to see an installable gcc on the yun! It would also be a nice contribution to OpenWrt, that (AFAIK) has never had a installable package for gcc in 10 years
Since you've already done that, you may want to contribute with your experience

Fair call... I'll look into it...

I've seen a couple of people say they've had something working, but nothing released. The biggest problem is... there's no simple C compiler for Yun! Need to build the native compiler with a cross compiler, which I need to build on Debian, which is a pain.

Ian

The MIPS Linux pull request for the 3.14 kernel provides support for the MIPS interAptiv and proAptiv processor cores...

http://www.sniff.org.uk/2014/05/building-gcc-for-yun-in-12-not-easy.html

Done!

It was a torturous process, but I've got a working GCC toolchain running on Yun. It's got a couple of hacks in places and its completely untested, but I've complied a couple of simple test programs with it.

I'm currently making a tar file with a complete toolset in, and I'll add a link to that as soon as its uploaded somewhere. Hopefully my notes can help someone else to a better job, and turn into a proper installable package.

The sketch worked great, but as I noted in a separate thread, for me the 2GB data partition I specified runs around 12 times slower than the ext4 overlay partition. Rebooting without the sd card, inserting and reformatting sda1 as ext4 dropped a 1MB file create from 120 seconds to around 7 seconds.

When I come to the Proceed with partitioning micro SD card ,
I got err. formatting to FAT32.

I use a Kingston 8GB class 10 micro SD card.

Can you change

#define DEBUG 0

to

#define DEBUG 1

and paste the output?

This is the log :

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun.
Pleaseyou have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever.
Do you wish to proceed (yes/no)? yes

Starting Bridge...

Ready to install utility software. Please ensure your Arduino Yun is connected to internet.
Ready to proceed (yes/no)? yes

Updating software list...

Software list updated. Installing software (this will take a while)...

e2fsprogs mkdosfs fdisk rsync installed

Proceed with partitioning micro SD card (yes/no)? yes

Enter the size of the data partition in MB: 4000

Partitioning (this will take a while)...

mkfs.vfat 3.0.12 (29 Oct 2011)

err. formatting to FAT32


This is the system info :

Firmware Version Linino Barrier Breaker devel / LuCI Trunk (svn-r9877)
Kernel Version 3.8.3


First I try to reinstall the OpenWrt-Yun image by the web panel.
The WLAN keep blinking over 10-15 minutes and don't stop , which I think it is not right.

Then I try to do it using Terminal and I got the following error :
root@MyArduino:~# run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squash
fs-sysupgrade.bin
cp: read error: Input/output error

I'd say the sd card is broken

Actually , I bought 2 same SD cards , both of them can not pass the step too.

They run perfectly fine on mac and window, showing that it has around 8 GB free space.

However , when I test it on Arduino UNO with Ethernet shield, running the CardInfo example, I got strange result :

Volume type is FAT32

Volume size (bytes): 3654471680
Volume size (Kbytes): 3568820
Volume size (Mbytes): 3485

Files found on the card (name, date and size in bytes):

It shows only around 4GB space.

Does it mean Arduino has some max limitation on the SD volume ?
or Class 10 card , or Kingston brand card does not work on Arduino ?

Is it the matter of using a Micro SDHC card rather than Micro SD card ?
Have anyone use the Mirco SDHC card can pass the step ?

AFAIK, SDHC are supported Does Arduino Yún support microSDHC or microSDXC cards? - Arduino Yún - Arduino Forum

When the file-system is moved to the SD card (pivot root using:

config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0

is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?

hi ,
when the running the script , i got the following error.

"err formatting fat32"

Please help me to resolve this issue.Size of the micro sd card is 8GB

NewLine:
...
is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?

Power off Yun , take out SD card. power on Yun again to access flash.

infotorpk:
hi ,
when the running the script , i got the following error.
"err formatting fat32"
Please help me to resolve this issue.Size of the micro sd card is 8GB

take out SD card, put it into Windows machine to test format.

or

at Yun

fdisk /dev/sda
mkdosfs -F 32 /dev/sda1

partition and format SD card.

Thanks for the script :slight_smile:

NewLine:
Is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?

I found this tip on accessing the original flash drive while booted up on the external root: [OpenWrt Wiki] Extroot configuration

Basically, you boot up under the expanded drive, and add this to the end of /etc/config/fstab:

config mount
	option target	/overlay-boot
	option device	/dev/mtdblock3
	option fstype	jffs2
	option options	rw,sync
	option enabled	1
	option enabled_fsck 0

Next time you boot up under the expanded drive, the original file system on internal flash will be available under /overlay-boot. So to get to the original file system's fstab, use /overlay-boot/etc/config/fstab

I just tried this last night. First, I downloaded the 1.5.2 firmware image, and reflashed the Yun using the web interface.

Then I loaded the sketch and ran it, and it seemed to be successful. I used an 8GB card, and allocated 6GB (6144MB) to the data partition. This is what I get when I run df:

root@Yun:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                24806184    500740  23061720   2% /
/dev/root                 7680      7680         0 100% /rom
tmpfs                    30560       100     30460   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/sda2             24806184    500740  23061720   2% /overlay
overlayfs:/overlay    24806184    50074  236172   2%/
/dev/sda1              6279168        12   6279156   0% /mnt/sda1
root@Yun:/#

sda1 is 6GB, as expected, but the rootfs is 24 GB? On an 8GB card? It should be 2 GB with about 25% used.

If I plug the SD card into my Windows laptop, it says that it is not formatted. If I look at it using a partition manager, it shows the first partition is a 6GB FAT32 partition (as expected) and the second is a 23.7 GB Linux Ext4 partition.

Why is the first partition not accessible on my laptop?

Why is the second partition so huge?

This is the sketch output when I run it with "DEBUG 1" defined:

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun.
Please ensure you have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever.
Do you wish to proceed (yes/no)? yes

Starting Bridge...

Ready to install utility software. Please ensure your Arduino Yun is connected to internet.
Ready to proceed (yes/no)? yes
Updating software list...
Software list updated. Installing software (this will take a while)...
e2fsprogs mkdosfs fdisk rsync installed

Proceed with partitioning micro SD card (yes/no)? yes
Enter the size of the data partition in MB: 6144
Partitioning (this will take a while)...

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-62333951, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62333951, default 62333951): Partition 1 of type Linux and of size 6 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Command (m for help): Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): Partition number (1-4, default 2): First sector (12584960-62333951, default 12584960): Using default value 12584960
Last sector, +sectors or +size{K,M,G} (12584960-62333951, default 62333951): Using default value 62333951
Partition 2 of type Linux and of size 23.7 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.vfat 3.0.12 (29 Oct 2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1556480 inodes, 6218624 blocks
310931 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
190 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

Allocating group tables:   0/190  <lengthy-count-sequence-snipped>  189/190       done                            
Writing inode tables:   0/190  <lengthy-count-sequence-snipped>  189/190       done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:   0/190  <lengthy-count-sequence-snipped>  189/190       done

Micro SD card correctly partitioned

Creating 'arduino' folder structure...
Copying files from Arduino Yun flash to micro SD card...
Enabling micro SD as additional disk space... enabled

We are done! Yeah! Now press the YUN RST button to apply the changes.

I snipped out a long string of counter updates that included lots of backspaces between each update. I also didn't include the messages from the subsequent boot (but I saved them if needed.)

The only reason I get for having such a huge second partition is a tricky sd card. AFAIK, size of the sd card is written onto the sd card itself by the manufacturer. So you can make a 8G sd card and set its size to 24G

As for not being able to see the first one on windows, I don't know. Can you try with another sd card? An older one is better. A super new sd card may be unsupported by linux