October 18, 2019, 08:29:48 pm


Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/

Linaro 13.04 developer for A20 (read-only SD mount)

Started by patwood, October 14, 2013, 11:55:01 am

Previous topic - Next topic


October 14, 2013, 11:55:01 am Last Edit: October 14, 2013, 05:57:06 pm by patwood
I've uploaded a small patch to the Linaro 13.04 developer for A20 image that allows it to boot with the SD card's rootfs mounted read-only: http://dl.cubieforums.com/patwood/initrd.tar.  It works by running a custom script at boot time before the system's init process is started.

To use it, untar it in /boot on the disribution (note: it will overwrite uEnv.txt, so you may want to save a copy of yours).

By default, it will boot into a bash prompt on the serial port and tty1 before running init; /tmp, /var, and /etc are on regular ramdisks, and /root is on the initrd ramdisk (only about 2.5MB free space available on this).  All the other system directories are mounted read-only from the SD card's root fs, and the entire SD card is mounted read-only on /mnt/root.

You can poke around and see how it's set up; changes won't be persistent, and you can just unplug the board if you like without damaging anything (commands like shutdown and halt won't work at this point in the boot process).  The script that sets all this up is in /init/init.

To test booting into multi-user mode, just type:

exec /sbin/init

on the serial console.

At this point you'll be at run level 2, the network should be available, and if you have /etc/network/interfaces set up for wifi, that should work as well.  shutdown, halt, poweroff, and the power button will work now.

In addition to uEnv.txt, the tar archive contains the following files:

initrd.tar.gz -- original files for the initrd file system
initrd.gz -- compressed ext2 initrd file system
uInitrd -- initrd run though mkimage to produce a file u-boot will load

uEnv.txt was changed to load uInitrd and boot the kernel with its address as a parameter and set root=/dev/ram to use this file system as the root device instead of the SD card.

You can mount the initrd file system (as root; gunzip the file first) if you want to make changes with:

mount initrd /mnt

and you can rebuild uInitrd (don't forget to unmount and gzip the initrd file first) with:
mkimage -A arm -O linux -T ramdisk -C none -n initrd-3.4.61-sun7i+ -d initrd.gz uInitrd

You can force the system to boot into multi-user mode by putting the line

export RUNEXEC=1

in /initconfig on the SD card's root file system.  (You can also put other initialization commands in this file if you want to make changes without regenerating the initrd file system.)

To revert back to the original distro (with the SD card mounted read-write), just restore your /boot/uEnv.txt file.

This initrd will also work on an A10 linaro/ubuntu distro (but hasn't been tested on one, and has only been tested with this linaro distro on the A20).

Edit: I have also tested this on Cubiuntu A20; you'll need to use the uEnv-CU0.6.txt file in place of uEnv.txt (you may need to change the kernel= line from uImage.3.4.61-sun7i+ to uImage.3.4.43-sun7i+ depending on which one you're using).  I was able to get lxde running and play videos with vlc.

You can get the Linaro 13.04 distro here: http://dl.cubieforums.com/patwood/linaro-quantal-developer-20130422-342-A20-3.4.61.img.xz and read more about it here: http://www.cubieforums.com/index.php/topic,838.0.html


October 19, 2013, 12:51:45 pm #1 Last Edit: October 19, 2013, 02:32:22 pm by stu.mahdi
thanks it's great.,but what can I do for nand? urgent please