Home » Computers, pcDuino » pcDuino U-Boot – Part 2

In Part 1 I described connecting to the pcDuino serial port and accessing the U-Boot subsystem. With this access to the boot environment, the task of booting to a root file system other than the NAND flash looked promising.

Configuring the SD Card

The pcDuino accepts a micro-SD card (I just refer to it as SD to save typing) for additional storage. It is best to partition and format the card with a Linux file system for use on the pcDuino. If you are attempting this, the following steps will result in a loss of all data already on an SD card.

For some of the steps below, additional software needed to be installed on the pcDuino. For formatting a DOS FAT partition, the dosfstools package must be installed. For copying the files between filesystems, I use the rsync package.

First, the SD card must be inserted in the card slot and partitioned. By default, the pcDuino will attempt to automatically mount the SD card partitions, so these partitions must be unmounted after inserting the card. I’m lazy, so I just ask the system to unmount every thing accociated with the SD card slot. The redirection to /dev/null is to avoid error messages I would just ignore.

Next, the new partitions need defined. I set my card up with a small (16MB) FAT partition for future use as a /boot file system, and used the remaining space for the root file system. The pcDuino desktop DiskManager allows the formatting to be done from from a graphical interface. Or, as I prefer, the fdisk command line application can be used.

Once the partitions are created, the file systems need to be created, mounted, and a copy of the existing operating system copied to the corresponding locations. For my configuration, the following commands were used to accomplish this task.

With the new file systems on the card, I needed to make certain they were not automatically mounted.

Then, the file systems were copied. Starting with the /boot partition

And the root / file system

Testing the SD card image

To test, I rebooted the system with the serial debug output connected to my lap top as I described in Part 1 and entered into the U-Boot command line. From the U-Boot prompt, I set the default root device to my root partition on the SD card and booted.

After booting, it was necessary to check if the root / was being used from the SD card.

CONFIRMED: The pcDuino will boot to an alternate root file system. All that’s needed now is to make it permanent.

Setting a permanent new root file system

Time to reboot the system and back into U-Boot to make the environment change permanent. The saveenv command is used to permanently write environment changes to non-volatile storage. In the case of the pcDuino the environment is saved to a specific NAND flash area.

No errors were displayed, and a check of the mounted file systems showed the SD card was being used for the root file system. Time for the critical test. Reboot without entering U-Boot to confirm the change is permanent.

FAILURE! The changes are not persistent. The saveenv did not work. No errors were displayed, but the environment was not updated.


After a detailed investigation, I concluded the saveenv was non-functional in the pcDuino U-Boot version. The NAND flash write routines are not present or operational. More details of the investigation into alternatives for controlling the boot process will be in Part 3 and a workable solution will be presented. Stay tuned!


ONLY TRY THE ABOVE IF YOU UNDERSTAND WHAT YOU ARE DOING. Connecting to the serial debug port has the potential to damage your pcDuino if your connections are incorrect. Changes to the U-Boot environment can render your pcDuino unbootable. YOU HAVE BEEN WARNED!

Update 15-Mar-2013: Add information for installing dosfstools and rsync packages.

6 Responses to “pcDuino U-Boot – Part 2”

  1. March 14th, 2013 at 15:23 | #1

    Rock and roll, one more step…

    Now all we need is that last step of “setenv” or a new uboot that works!

    In the “best case” what I want is that the pcDuino boots from the flash on card when NO SD is “Clicked into the Slot”. When a SD that is “correct” is found then all of the changes I want are on this SD environment.

    I will use the “On Card Flash” as a “recovery” system and never have to worry about “getting of of the hole”.

    Then I can create a collection of SD Cards that BOOT into my application and be updated as needed. One for each test environment.

    Once I have a SD Solution, my next step is to Boot from CD with the “ROOT” mounted from a USB SSD drive. I have a 128G USB SSD that ROCKS!

    Please call any time:
    Cell:     916-202-1600
    Skype:  EdwardMGoldberg

    Edward M. Goldberg

  2. joseph
    June 5th, 2013 at 20:21 | #2

    Great effort toward a really functional PCDuino.

    I tried to do it. But I already get error messages when trying to do

    apt-get install -y dosfstools


    apt-get install -y rsync

    Beside a waring that “the package cannot be authenticated!” the error message says “There are problems and -y was used without –force-yes”. Is my pcduino different from yours?

  3. June 5th, 2013 at 21:10 | #3

    It is possible that some of the packages on your installed system are out of date. Try doing an “sudo apt-get upgrade” after the “sudo apt-get update” and see if things proceed better. Otherwise, it is possible a repository is currently unavailable and you will need to try again later.


  4. downloading
    July 7th, 2013 at 04:55 | #4

    suod apt-get install -y rsync

    suod should be typo

  5. July 6th, 2014 at 14:31 | #5

    Thank you for the article.

    Is it possible to change the boot sequence, without using a serial debug cable?

  6. July 23rd, 2014 at 13:25 | #6

    In Part 3 of this series, I provide a source package for writing the U-Boot environment from within Linux – eliminating the need for using a serial debug console. If you use the Linux tools, realize they are experimental and may cause issues if your U-Boot configuration is different than mine.


Add reply