From 8c6d42843d597360fe239b01e057fe135a77dd2d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 28 Mar 2016 17:08:21 -0600 Subject: [PATCH 1/2] Update README --- configs/sabre-6quad/README.txt | 113 +++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index f32f1b94d71..b8388503e05 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -11,6 +11,7 @@ Contents - Platform Features - Serial Console - LEDs and Buttons + - Using U-Boot to Run NuttX - Configurations Status @@ -29,6 +30,10 @@ that case). There is a lot of testing that could be done but, unfortunately, I still have no i.MX6 hardware to test on. +2016-03-28: I now have a used MCIMX6Q-SDB which is similar to the target +configuration described below except that it does not have the 10.1" LVDS +display. Next step: Figure out how to run a copy of NuttX using U-Boot. + Platform Features ================= @@ -179,6 +184,114 @@ apparently, running normally. If the LED is flashing at approximately Buttons ------- +Using U-Boot to Run NuttX +------------------------- + +The MCIMX6Q-SDB comes with a 8GB SD card containing the U-Boot and Android. +You simply put the SD card in the SD card slot SD3 (on the bottom of the +board next to the HDMI connect) and Android will boot. + +But we need some other way to boot NuttX. Here are some things that I have +experimented with. + +Building U-Boot (Attempt #1) +---------------------------- + +I have been unsuccessful getting building a working version of u-boot from +scratch. It builds, but it does not run. Here are the things I did: + +1. Get a copy of the u-boot i.MX6 code via: + + https://github.com/boundarydevices/u-boot-imx6/tree/production + + or + + $ git clone git://git.denx.de/u-boot.git + +2. Build U-Boot for the i.MX6Q Sabre using the following steps. This + assumes that you have the path to your arm-none-eabi- toolchain at the + beginning of your PATH variable: + + $ cd u-boot + $ export ARCH=arm + $ export CROSS_COMPILE=arm-none-eabi- + $ make mx6qsabresd_config + $ make + + This should create a number of files, including u-boot.imx + +3. Format an SD card + + Create a FAT16 partition at an offset of about 1MB into the SD card. + This is where we will put nuttx.bin. + +4. Put U-Boot on SD. U-boot should reside at offset 1024B of your SD + card. To put it there, do: + + $ dd if=u-boot.imx of=/dev/ bs=1k seek=1 + $ sync + + Your SD card device is typically something in /dev/sd or + /dev/mmcblk. Note that you need write permissions on the SD card + for the command to succeed, so you might need to su - as root, or use + sudo, or do a chmod a+w as root on the SD card device node to grant + permissions to users. + +Using the Other SD Card Slot (Attempt #2) +----------------------------------------- + +Another option is to use the version u-boot that came on the 8GB but put +NuttX on another SD card inserted in the other SD card slot at the opposite +corner of the board. + +To make a long story short: This doesn't work. As far as I can tell, +U-Boot does not support any other other SC card except for mmc 2 with is the +boot SD card slot. + +Replace Boot SD Card (Attempt #3) +--------------------------------- + +What if you remove the SD card after U-boot has booted, then then insert +another SD card containing the nuttx.bin image? + +1. Build nuttx.bin and copy it only a FAT formated SD card. Insert the SD + card containing NuttX into the "other" SD card slot. Insert the 8GB SD + card with U-boot already on it in the normal, boot SD card slot. + +2. Connect the VCOM port using the USB port next to the boot SD card slot. + +3. Start a console at 11500 8N1 on the VCOM port + +4. Power up the board with the 8GB SD card in place. U-Boot will start and + countdown before starting Linux. Press enter to break into U-Boot before + Linux is started. + +5. Remove the 8GB U-Boot SD card; insert in its place. + +6. Rescan the SD card: + + MX6Q SABRESD U-Boot > mmc dev 2 + mmc2 is current device + MX6Q SABRESD U-Boot > mmc rescan + MX6Q SABRESD U-Boot > fatls mmc 2 + system volume information/ + 87260 nuttx.bin + + 1 file(s), 1 dir(s) + +7. Then we can boot NuttX off the rescanned SD card: + + MX6Q SABRESD U-Boot > fatload mmc 2 0x20010000 nuttx.bin + reading nuttx.bin + + 87260 bytes read + MX6Q SABRESD U-Boot > go 0x2001040 + ## Starting application at 0x02001040 ... + + MX6Q SABRESD U-Boot > + + That seems to work okay and this is more than enough of this kind of + thing for a day. Configuration sub-directories ----------------------------- From d0036e5ff1a8304ea98f546a0ce6b58cbbdd548c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 28 Mar 2016 18:01:22 -0600 Subject: [PATCH 2/2] Update README --- configs/sabre-6quad/README.txt | 57 +++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index b8388503e05..b72111fc6d5 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -194,8 +194,8 @@ board next to the HDMI connect) and Android will boot. But we need some other way to boot NuttX. Here are some things that I have experimented with. -Building U-Boot (Attempt #1) ----------------------------- +Building U-Boot (Failed Attempt #1) +----------------------------------- I have been unsuccessful getting building a working version of u-boot from scratch. It builds, but it does not run. Here are the things I did: @@ -237,8 +237,8 @@ scratch. It builds, but it does not run. Here are the things I did: sudo, or do a chmod a+w as root on the SD card device node to grant permissions to users. -Using the Other SD Card Slot (Attempt #2) ------------------------------------------ +Using the Other SD Card Slot (Failed Attempt #2) +------------------------------------------------ Another option is to use the version u-boot that came on the 8GB but put NuttX on another SD card inserted in the other SD card slot at the opposite @@ -248,8 +248,8 @@ To make a long story short: This doesn't work. As far as I can tell, U-Boot does not support any other other SC card except for mmc 2 with is the boot SD card slot. -Replace Boot SD Card (Attempt #3) ---------------------------------- +Replace Boot SD Card (Successful Attempt #3) +-------------------------------------------- What if you remove the SD card after U-boot has booted, then then insert another SD card containing the nuttx.bin image? @@ -281,17 +281,50 @@ another SD card containing the nuttx.bin image? 7. Then we can boot NuttX off the rescanned SD card: - MX6Q SABRESD U-Boot > fatload mmc 2 0x20010000 nuttx.bin + MX6Q SABRESD U-Boot > fatload mmc 2 0x10800000 nuttx.bin reading nuttx.bin 87260 bytes read - MX6Q SABRESD U-Boot > go 0x2001040 - ## Starting application at 0x02001040 ... + MX6Q SABRESD U-Boot > go 0x10800040 + ## Starting application at 0x10800040 ... - MX6Q SABRESD U-Boot > + That seems to work okay. - That seems to work okay and this is more than enough of this kind of - thing for a day. +Use the FAT Partition on the 8GB SD Card (Untested Idea #4) +----------------------------------------------------------- + +Partition 4 on the SD card is an Android FAT file system. So one thing you +could do would be put the nuttx.bin file on that partition, then boot like: + + MX6Q SABRESD U-Boot > fatload mmc 2:4 0x10800000 nuttx.bin + +SD Card Image Copy (Successful Attempt #5) +------------------------------------- + +You can use the 'dd' command to copy the first couple of megabytes from the +8GB SD card and copy that to another SD card. You then have to use 'fdisk' +to fix the partition table and to add a single FAT16 partition at an offset +of 1MB or so. + +1. Insert the 8GB boot SD card into your PC: Copy the first 2Mb from the SD + card to a file: + + $ dd if=/dev/sdh of=sdh.img bs=512 count=4096 + +2. Remove the 8GB boot SD card and replace it with a fresh SD card. Copy the + saved file to the first the new SD card: + + $ dd of=/dev/sdh if=sdh.img bs=512 count=4096 + +3. Then make a FAT16 partition at the end of the SD card. You will also need + to format the partion for FAT. + +4. You can put nuttx.bin here and then boot very simply with: + + MX6Q SABRESD U-Boot > fatload mmc 2:1 0x10800000 nuttx.bin + MX6Q SABRESD U-Boot > go 0x10800040 + +A little hokey, but not such a bad solution. Configuration sub-directories -----------------------------