Linux on the i.MX6 sabre sd platform in a few commands

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linux on the i.MX6 sabre sd platform in a few commands

Linux on the i.MX6 sabre sd platform in a few commands

linux-sabresd.png

Here is a quick summary at booting Linux on the i.MX 6 sabre sd platform.

This assumes you already have u-boot working on your platform as described here. This implies you already have a "working" Linux development environment with some ARM cross-compilers at hand (e.g. Debian + Emdebian).

Get Linux sources

We will use git to fetch Linux sources:


  $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


This should create a linux directory with all the latest sources (after a while).


Note that for more stability you might want to checkout a release instead of the latest version; to do so, list the available release tags with e.g. git tag -l 'v*', and git checkout <the-desired-tag>.

Compile

Assuming your cross compiler is called e.g. arm-linux-gnueabihf-gcc, you can compile by doing:

  $ cd linux

  $ export ARCH=arm

  $ export CROSS_COMPILE=arm-linux-gnueabihf-

  $ make imx_v6_v7_defconfig

  $ make


You then need to supply a LOADADDR (as joowonkim pointed out); do:


  $ make uImage LOADADDR=0x10008000


This should create a number of files, including arch/arm/boot/uImage and arch/arm/boot/dts/imx6q-sabresd.dtb.

Put on SD

We need a proper FAT partition on the SD card, from which u-boot will be able to load the kernel and dtb. Also, we need to make sure we leave some space for u-boot starting from offset 1024B. Here is an example SD card layout:

  +-----+------+--------+-----+----------------

  | MBR |  ... | u-boot | ... | FAT partition ...

  +-----+------+--------+-----+----------------

  0     512    1024           1M

(offsets in bytes)

Here is an example SD card layout, as displayed by fdisk:

  Device    Boot      Start         End      Blocks   Id  System

  /dev/sdc1            2048     8054783     4026368    c  W95 FAT32 (LBA)

(units: 512B sectors)

You can format the FAT partition, mount, copy and unmount with:


  $ mkfs.vfat /dev/<your-sd-card-first-partition>

  $ mount /dev/<your-sd-card-first-partition> /mnt

  $ cp arch/arm/boot/uImage arch/arm/boot/dts/imx6q-sabresd.dtb /mnt/

  $ umount /mnt


Your SD card first partition is typically something in /dev/sd<X>1 or /dev/mmcblk<X>p1. 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.


Also, be sure to have u-boot on the SD card as explained in this post.

Boot!

That's it; u-boot already knows how to deal with your kernel by default so you are good to go. Insert the SD card into the SD card slot of your i.MX6 sabre sd platform, connect to the USB to UART port with a serial terminal set to 115200 baud, no parity, 8bit data and power up the platform. You should see u-boot messages:

  U-Boot 2013.07-rc1-00014-g74771f4 (Jun 21 2013 - 16:27:39)


u-boot should load the uImage and dtb from SD card and boot the kernel:


  (...)

  reading uImage

  4215344 bytes read in 449 ms (9 MiB/s)

  Booting from mmc ...

  reading imx6q-sabresd.dtb

  22818 bytes read in 22 ms (1012.7 KiB/s)

  ## Booting kernel from Legacy Image at 12000000 ...

     Image Name:   Linux-3.10.0-rc6

     Image Type:   ARM Linux Kernel Image (uncompressed)

     Data Size:    4215280 Bytes = 4 MiB

     Load Address: 10008000

     Entry Point:  10008000

     Verifying Checksum ... OK

  ## Flattened Device Tree blob at 11000000

     Booting using the fdt blob at 0x11000000

     Loading Kernel Image ... OK

  OK

     Using Device Tree in place at 11000000, end 11008921

  Starting kernel ...

The kernel should boot:

  Booting Linux on physical CPU 0x0

  Linux version 3.10.0-rc6 (vstehle@debian) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Fri Jun 21 18:09:26 CEST 2013


By default, the kernel will try to mount a root filesystem from the SD card second partition, as can be read in the default kernel command line:


  (...)

  Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw

...but we did not prepare a root filesystem partition, so after a number of boot messages the kernel will wait indefinitely:

  (...)

  mmc1: new SDHC card at address b368

  (...)

   mmcblk0: p1

  (...)

  Waiting for root device /dev/mmcblk1p2...

We will see in another post how to prepare this root filesystem on the second SD card partition. Enjoy!

See also...

  • If you plan to compile Linux often, you might want to use a C compiler cache; see this post.
  • Once you have Linux booting on your platform the next step is to give it a root filesystem. See this post for a Debian root filesystem, this post for a minimal busybox filesystem and this post for generating a root filesystem with buildroot.
Comments

Hi Vincent

This text is operating with u-boot, toolchain, gcc, LTIB?

Dear joowonkim,

This post deals really only with the Linux kernel.

  • For u-boot you might look at this post.
  • For the toolchain / gcc, you might want to use a more featured environment taking care of that for you, like LTIB you mentioned, or buildroot as pointed by this post.

Best regards,

V.

Hi vstehle.

I followed this post.

But appear error message.

"

This is incompatible with uImages

Specify LOADADDR on the commandline to build an uImage

arch/arm/boot/Makefile:79: recipe for target 'arch/arm/boot/uImage' failed

make[1]: *** [arch/arm/boot/uImage] Error 1

arch/arm/Makefile:308: recipe for target 'uImage' failed

make: *** [uImage] Error 2

"

I  succeed steps 'make', and I install U-Boot follow this post (u-boot on the i.MX6 sabre sd platform in a few commands)

But I whenever typing "make uImage" appear this error.

How to solve?

Best regards

JooWon.

Hi joowonkim,

Thanks for pointing that out; indeed you need to do:

  $ make uImage LOADADDR=0x10008000

The article should be updated shortly.

Best regards,

V.

Many thanks Vincent for all your help very kind of you to take time to help me . The problem is on my side , many thanks:smileyhappy:

Hi Vincent Stehle.

I succeed build the kernel!!  and  install U-Boot follow this post (u-boot on the i.MX6 sabre sd platform in a few commands).

Then, I operated my Board (i.MXQ SabreSDB Board) input the SD Card.

But not appear this message.

"

(...)

  reading uImage

  4215344 bytes read in 449 ms (9 MiB/s)

  Booting from mmc ...

  reading imx6q-sabresd.dtb

  22818 bytes read in 22 ms (1012.7 KiB/s)

  ## Booting kernel from Legacy Image at 12000000 ...

     Image Name:   Linux-3.10.0-rc6

     Image Type:   ARM Linux Kernel Image (uncompressed)

     Data Size:    4215280 Bytes = 4 MiB

     Load Address: 10008000

     Entry Point:  10008000

     Verifying Checksum ... OK

  ## Flattened Device Tree blob at 11000000

     Booting using the fdt blob at 0x11000000

     Loading Kernel Image ... OK

  OK

     Using Device Tree in place at 11000000, end 11008921

  Starting kernel ...

"

Perhaps first, install the kernel and second, install U-Boot?

If I install the U-Boot later, where install the SDcard partition?

And if install the kernel, recognized the keyboard and mouse?

help me please~

Best regards!

JooWon.

Hi joowonkim,

Could you please capture and send me a UART log? That would help in diagnosing the issue.

The order in which you install u-boot and the kernel should not really matter, provided you have enough space between the MBR and the FAT partition start.

About recognizing the keyboard and mouse, I think you could readily connect USB peripherals to your Sabre SD board, but you will need a USB adapter cable. You might also want to have a look at Freescale official release for Sabre SD on this page. At the time of writing, there is a release 3.10.53 available based on Yocto, with a full featured graphical environment. This should be even nicer for keyboard and mouse usage.

Best regards,

V.

Hi Vincent.

long time no see.

I installed U-boot my SDcard.(u-boot on the i.MX6 sabre sd platform in a few commands )

and, next step I try install kernel in my SDcard.

install is sucessfully.

But UART log is not appear this message

"

(...)

  reading uImage

  4215344 bytes read in 449 ms (9 MiB/s)

  Booting from mmc ...

  reading imx6q-sabresd.dtb

  22818 bytes read in 22 ms (1012.7 KiB/s)

  ## Booting kernel from Legacy Image at 12000000 ...

     Image Name:   Linux-3.10.0-rc6

     Image Type:   ARM Linux Kernel Image (uncompressed)

     Data Size:    4215280 Bytes = 4 MiB

     Load Address: 10008000

     Entry Point:  10008000

     Verifying Checksum ... OK

  ## Flattened Device Tree blob at 11000000

     Booting using the fdt blob at 0x11000000

     Loading Kernel Image ... OK

  OK

     Using Device Tree in place at 11000000, end 11008921

  Starting kernel ...

"

attatch Screenshot.

How to solve this problem?

Best regards!

JooWon.Screenshot from 2015-06-04 17_12_09.png

Dear joowonkim​,

That looks to me like an SD card issue. Try to remove all partitions or blank the card completely, then re-partition and re-flash u-boot and kernel. That might help. Or maybe, try another SD card.

Best regards,

V.

Hi Vincent Stehle

Long time no see.

I installed kernel in my SDCard.(8GB)

But I don't know successfully install.

Is this success ? Kernel.png

Hi joowonkim​,

It seems u-boot is not able to read the filesystem on your SD card.

Did you use the commands mentioned in the "put on sd" section?Best regards,

V.

I'm getting this error when I try to build for iMX6SX Sabre board:

drivers/built-in.o: In function `mxsfb_probe':
debugfs.c:(.text+0x4676c): undefined reference to `mxc_dispdrv_gethandle'
make: *** [vmlinux] Error 1
Makefile:933: recipe for target 'vmlinux' failed

What is happening?

Hi,

this doesn't seem to work anymore.

I tried to set up U-Boot and Kernel according to this Thread and the "u-boot on the i.MX6 sabre sd platform in a few commands"-Thread.

But this results always in a permanent bootup loop on my Board (2012)

The Devicetree of SabreSD has changed significally since Kernel 4.9.

There seem to exist a newer Version of SabreSD (2015). Is that compatible to newer Kernels? What are the Differences?

See attached Image for some obvious changes on SabreSD. Are there some other not so obvious changes which may lead to described behaviour?

SabreSD-Compare.jpg

No ratings
Version history
Last update:
‎06-21-2013 09:56 AM
Updated by: