Cubieboard/Installing on NAND
Install Cubian to NAND is pretty simple. First, you need to install it to Micro-SD card by the tutorial above, then boot and login to your Cubieboard. Once you logged in, execute the following command sudo ~/nandinstall/install.sh
If you want to port Linux on your SD-card to NAND manually, please continue to read the tutorial below
First, download and uncompress a couple of files:
Debian Wheezy SD-card image from http://guillaumeplayground.net/mele-a2000-headless-debian-wheezy-armhf-with-nand-install-v1/ (Thanks Guillaume).
NAND boot partition and MBR image: http://dl.cubieforums.com/loz/boot_partition/bootloader/cubie_nand_uboot_partition_image.bin (Thanks Lawrence: http://www.cubieforums.com/index.php/topic,73.msg235.html#msg235)
The first step to installation is to copy the SD-card image to an SD card (make sure it's large enough!)
I'm using a Mac. If you are too, you can do this by:
- Typing mount. The mounted partition on the card will be listed in there somewhere, with a name like /dev/diskXs1 (where X is a number).
- Unmount it by typing umount /dev/diskXs1 (replace the X with the number from the previous steps). If there is more than one partition on the card (/dev/diskXs2, /dev/diskXs3 etc.) unmount them all.
- Now, you need to copy the Debian SD card image onto the SD card, with a command like sudo dd bs=4096 if=~/Downloads/debian_wheezy_armhf_v1_mele.img of=/dev/diskX - again, the X should be the same number as in the previous steps. Note that there's no trailing sY this time, because we're copying the image over the whole disk, and the numerical 'sY' suffixes refer to partitions.
- After the dd command is complete, the system will probably auto-mount the new boot partition on the SD card (this is just a small MS-DOS formatted partition that's used for booting). Eject it, and remove the SD card.
- Now you have Debian on the SD card!
On Linux, the steps will be quite similar. On Windows they will not, but the goal is the same.
Next you can boot your Cubieboard with the system on the SD card. Plug it in to your Ethernet network, plug in the SD card, and plug in the power. The power light will come on immediately, followed shortly (maybe 15-20 seconds later) by LED 2. In about 30 seconds, booting will be complete, and the Cubieboard will have obtained an IP from your DHCP server or router. You'll need to find out what this IP is from your router.
After you have the Cubieboard's IP, you can ssh to it. On a UNIX system like a Mac or Linux, that's just a simple ssh root@<CUBIEBOARD IP ADDRESS> in a terminal. The password is also root. You should be logged in and get a command prompt.
The next step is to get the Debian system onto the internal NAND.
First, we need to get the boot partition we downloaded earlier on onto the NAND. You can either copy it over using SCP, then use dd to write it to /dev/nand (dd bs=4096 if=./cubie_nand_uboot_partition_image.bin of=/dev/nand), or just copy it directly there with SCP (on my Mac, scp ~/Downloads/cubie_nand_uboot_partition_image.bin root@<CUBIEBOARD IP ADDRESS>:/dev/nand).
After that wait for 30 seconds (this seems like it should not be necessary, but guides I read recommended it, and I'm paranoidly cargo-culting the advice), then a 'reboot' is in order.
After the board reboots, SSH in to it again. Now, we'll create our Linux partition. The image we copied to the NAND already has the partition table and the boot partition on it, so all we need to do is format the partition we'll use by doing mkfs.ext4 /dev/nandb. After that, we can mount it with mount /dev/nandb /mnt.
Next, we'll copy the Linux kernel off the SD card. It's on the SD card's boot partition, not the one containing the root filesystem, so we'll mount it by creating a directory to mount it into (mkdir /tmp/boot), and then mounting it (mount /dev/mmcblk0p1 /tmp/boot). After that, we copy the kernel image out of it into a boot directory on our new partition (mkdir /mnt/boot then cp /tmp/boot/uImage /mnt/boot/uImage).
If you want to use Hwpack features, you should copy uImage and script.bin files from Hwpack kernel directory instead of /tmp/boot/uImage.
All that remains now is to copy over the Linux filesystem. I used rsync for that (thanks patwood: http://www.cubieforums.com/index.php/topic,73.msg241.html#msg241).
First, I created a file to contain all the directories I didn't want the contents of. The contents of that file were:
/dev/* /proc/* /sys/* /media/* /mnt/* /run/* /tmp/*
Then a simple rsync -avc --exclude-from=EXCLUDE_FILE / /mnt copied the files.
For using Cubieboard-specific modules from Hwpack, copy the Hwpack rootfs directory contents to /mnt.
That's it! Do a shutdown -h now, and when the lights go out, remove the SD card. Now, power the Cubieboard back up, and you'll have Debian running entirely from the NAND.
Now, it's time to properly set things up. An apt-get update then an apt-get dist-upgrade is a pretty good first step to get things up to date. You'll probably want to then create a user account and change the root password. My next steps were to edit /etc/hostname to give my board a good name, then apt-get install man and apt-get install g++. Most of the software you'll need can be installed with apt-get - but I won't go into more detail, that's all just generic Debian and Linux stuff, not specific to the Cubieboard.