Cubieboard2 NAND Install Hack

Creating a proper image seems to be a difficult task. First of all, Sunxi SoCs have a very specific boot process. Second, they use a proprietary partitioning tool called nand-part, whitch seems to have some major issues.

Warning: This is a real hack!

TODO:

  • Find a proper way to create a bootable image for «The void»
  • Create clean update path (mount /boot, merge boot.cmd with uenv.txt...)

The idea of this installation is to misuse an already prepared Debian image for Cubieboard 2 as a starting point, and then replace Debian with Void. A hack, but it seems to work.

Prepare NAND (optional)

Installing the Debian image to nand

Note: If you already have a bootable Debian installation on NAND, you can skip this step!

First, let's clone the sunxi livesuite:

git clone https://github.com/linux-sunxi/sunxi-livesuite.git
cd sunxi-livesuite/awusb/               # build the asusb module
make
insmod awusb.ko                         # load the module
cd ..
./LiveSuit.sh                           # start the GUI

Next, download the debian-nand.img.gz archive from here.

Now we have to burn the image. To start the process you'll have to trigger FEL mode, and there are several ways to accomplish this:

Through a special FEL button

This is either called recoveryuboot or fel. If your device features such a button, you just need to hold it during power-up, and the device should have entered FEL mode just fine.

By holding a standard button

This is usually one of the standard tablet buttons, like the VOL+ key or something. The following seems to work:

  • Press and hold the suspected or reported FEL key.
  • Press and hold the power key for about 2 seconds.
  • Release the power key, and press it at least 3 times immediately.

Boot1 is initialized using this method.

Through serial console

If you have access to the UART already, you can send the character '1' ('2' on some devices) to the device during power-up.

Boot1 is initialized using this method.

With the "efex" command

In later SoCs, Allwinner's U-boot supports the "efex" command. Entering this command at the u-boot prompt will trigger a reboot into FEL mode.

Through a special SD card image

Included in the sunxi-tools repository there is a small SDCARD boot image that does nothing more than jumping to FEL. Just install it on an SD card as you would with the u-boot SPL (be sure to change /dev/sdc to where your SD card is):

git clone git://github.com/linux-sunxi/sunxi-tools
dd if=sunxi-tools/bin/fel-sdboot.sunxi of=/dev/sdc bs=1024 seek=8

By having no valid boot image

If the BROM doesn't find any valid boot image, it will automatically enter FEL mode.

After the flashing of the image to nand you should be able to boot the new Debian installation.

Install Void on NAND

Boot from the Void SD card. For instructions on how to create the SD card, see this page.

Let's begin by mounting NAND:

mkdir /mnt/nanda
mount /dev/nanda /mnt/nanda
mkdir /mnt/nandb
mount /dev/nandb /mnt/nandb

Now let's remove Debian:

rm -rf /mnt/nandb/*

We now install rsync and create an exclude filelist:

xbps-install rsync
cat << EOF > ~/exclude.txt
/dev/*
/proc/*
/sys/*
/media/*
/mnt/*
/run/*
/tmp/*
EOF

We now use rsync to copy the rootfs.

rsync -avc --exclude-from ~/exclude.txt / /mnt/nandb

Next, we edit /mnt/nandb/fstab and remove the boot partition.

/dev/mmcblk0p1 /boot vfat defaults 0 2

Finally, we copy the new kernel to nanda:

cp -av /boot/uImage /mnt/nanda/

Now shutdown, remove the SD card and reboot.

This article is issued from Voidlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.