CubieBoard Forum

Cubieboard itself => Beginners => Topic started by: reddriver21 on November 07, 2014, 07:39:29 am

Title: Boot from nand failed with "waiting for mmcblk0p2"
Post by: reddriver21 on November 07, 2014, 07:39:29 am
I have installed cubian into sdcard, that's ok. But I have problem with booting from nand. I used the script from, sudo cubian-nandinstall. The script was successful. From serial i got "waiting for mmcblk0p2". Sdcard was removed. I have tried do some change in file uEnv.txt without success. Thanks for reply.
Title: Re: Boot from nand failed with "waiting for mmcblk0p2"
Post by: paulAlting on November 08, 2014, 06:22:33 pm
Unfortunately installing Cubian to NAND is not so easy as it was with previous releases.

You don't detail which version of Cubian you are wanting to install.

I am not sure you can even put the new X1 verion to NAND.
My only success is with version r4, and did this the other day remotely for a chap over ssh on the other side of the planet.

Again, unfortunately, it seems that to successfully get Cubian installed to NAND you need to first use Livesuite to put an image of lubuntu to NAND. This is required for some reason to place some sort of special boot startup on the boot partition.

Once you have lubuntu in NAND and starting up, you can then put your SD card back in and boot Cubian.
Then proceed to using Cubian-nandinstall to copy the Cubian to NAND.

After that, you need to change the contents of one file on the NAND that should have been done as part of the nandinstall procedure.
Todo this, you need to mount nanda to /mnt/nanda and then edit the file /boot/uEnv.txt and change root=nandc to root=nandb.

There is no nandc, you will only have 2 partitions after Cubian-nandinstall, nanda and nandb and your root file system will be on nandb.

I can confirm that this method, as stupid as it sounds, works with version r4 which is available from the downloads section of

Once installed and running from NAND, you can then go and do Cubian-update to bring everything up to date.

I recently posted on the Cubian wiki issues list explaining my frustrations with their wiki 'how to do' is so out dated and does not reflect how to do things with the different releases of Cubian. Also, that the people supporting Cubian are not answering with clear and specific detail, the questions so many people ask about Cubian, especially with problems of installing the OS to NAND.

In reality, it's a total mess and I can understand how many people who wish to put Cubian to NAND are having such a problem.

I have a Cubieboard 2 and have had Cubian installed to NAND from day 2, and have really like it, but I will say that I am now looking more seriously to installing NetBSD at some point if I can't see the support of Cubian being maintained.

Read the Cubian Github issues section for more information, and good luck.
Title: Re: Boot from nand failed with "waiting for mmcblk0p2"
Post by: seng on November 17, 2014, 11:12:34 am

I have a CubieTruck and also for me the latest cubian-nandinstall didn't work for the new Cubian X.
But finally I have managed to put it into the NAND with nandinstall (not without pain) after modifying some lines.
Below what I have done, if it can help someone:

1. Edit the script /usr/lib/cubian-nandinstall/

2. The first modification is in the function formatNand() which will create both nanda and nandb partitions.
Change below line which will create a /dev/nanda with only a size of 1MB.
(echo y;) | $NANDPART -f a20 $NAND_DEVICE 128 'bootloader 2048' 'linux 0'
by this line, nanda will have a size of 64 MB (useful for later)
(echo y;) | $NANDPART -f a20 $NAND_DEVICE 32768 'bootloader 131072' 'linux 0'

3. Modification in the function installBootloader().
Find the line below, which try to transfer configuration files in /dev/nandb/boot (don't know why nandb instead of nanda ...)
rsync -avc /boot/script.bin /boot/uEnv.txt /boot/uImage* $MNT_ROOT/boot/

Replace it by these both lines (I have replaced $MNT_ROOT by $MNT_BOOT and without the directory boot):
rsync -avc /boot/script.bin /boot/uEnv.txt $MNT_BOOT/
cp -p /boot/uImage-3.4.79-sun7i $MNT_BOOT/uImage

The cp command was mandatory for me because on my microSD uImage was a symbolic link to uImage-3.4.79-sun7i and nanda does not allow to create symbolic link by rsync.
My uImage-3.4.79-sun7i  file has a size of 5 MB, it makes sens now why our nanda is created with a size of 64 MB. I have written in hard the name (and version) of my file, maybe you will need to write what you see for your version.

4. Always in same function find the below line :
sed -e 's|root=/dev/mmcblk0p1|root='$NAND_ROOT_DEVICE'|g' -i $MNT_ROOT/uEnv.txt

Which should attempt to change in uEnv.txt the location of rootfs (from microSD) to the new /dev/nandb.
Unfortunately it did not work for me because my rootfs was not on mmcblk0p1 but on mmcblk0p2.
And I have replaced above line by :
sed -e 's|root=/dev/mmcblk0p2|root=/dev/nandb|' -i $MNT_BOOT/uEnv.txt

Again, $MNT_ROOT has been replaced by $MNT_BOOT.

5. Always in same function, same path substitution, replace :
echo "machid=${MACH_ID}" >> $MNT_ROOT/boot/uEnv.txt
echo "machid=${MACH_ID}" >> $MNT_BOOT/uEnv.txt

6. Save your file and start it
sudo /usr/lib/cubian-nandinstall/

As what I see Nand is slower than microSD, hence do not forget to migrate your rootfs on SATA afterward  ;)
I see that CubianX is really faster than other distrib on my CubieTruck.
Title: Re: Boot from nand failed with "waiting for mmcblk0p2"
Post by: balodja on September 12, 2015, 03:10:26 pm
seng, you are very good man. Those bugfixes helped me to install Cubian X1 to my Cubietruck. Thank you.