Linux booting on IMX6 SABRESDB

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

Linux booting on IMX6 SABRESDB

26,246 Views
bottleneck
Contributor II

Hi,

I tried porting linux kernel (3.11) latest version on IMX.6 SABRESDB (for smart devices). U-Boot is on SD card, kernel and root file system is

loaded through tftp at following addresses,

0x10800000 and 0x11000000.

and booted using 'bootm' command.

It shows 'Starting the kernel...' after that there is no log for the rest of  kernel on serial console.

Could anyone guide me for this issue.

Thanks

Umamahesh

Tags (2)
21 Replies

3,100 Views
EdSutter
Senior Contributor II

I've just spent the last few weeks walking through this whole thing, so here are the steps that I recorded:

This includes using buildroot to create a rootfs and even pulls down a cross-compiler...

At the highest level there are three things to build: rootfs, kernel & u-boot.

# Unpack the following files to directories 'kernel', 'uboot' & 'rootfs':

# kernel: https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.11.4.tar.xz

# uboot:  http://ftp.denx.de/pub/u-boot/u-boot-2013.10.tar.bz2

# buildroot:  http://buildroot.org/downloads/buildroot-2013.08.tar.gz


# You should now have the directories:

  - kernel/linux-3.11.4

  - uboot/u-boot-2013.10

  - rootfs/buildroot-2013.08


################################################

# Create ROOTFS (and install cross compiler):

# (note I got most of this step from boundary devices blog)

$ cd buildroot-2013.08

$ make menuconfig...

#   Target ARM (Little-Endian)

#   Target Cortex A-9

#   Under toolchain:

#       External

#       Sourcery Codebench ARM 2013.05

#       Downloaded and installed

#   Under System Configuration, chose ttymxc0 as the Port to run a getty (login prompt) on,

#   Under Target Packages->Filesystem and Flash utilities: enable dosfstools and e2fsprogs

#   Under Filesystem Images, selected Output cpio - gzipped; tar the root filesystem

$ make busybox-menuconfig...

#   Do nothing, just exit (this step probably isn't necessary).

$ make V=1 2>&1 | tee make.out

#

# To build a bootable ramdisk image:

$ mkimage -A arm -O linux -T ramdisk -n "Initial Ram Disk" -d output/images/rootfs.cpio.gz /tftpboot/uramdisk.img

################################################

# Build the kernel:

$ cd linux-3.11.4

$ make mrproper

$ make imx_v6_v7_defconfig

# Modified .config directly to add compiler path...

#  CONFIG_CROSS_COMPILE="/home/els/imx6/pass4/rootfs/buildroot-2013.08/output/host/usr/bin/arm-none-linux-gnueabi-"

$ make V=1 2>&1 | tee make.out

# This creates 'arch/arm/boot/zImage' which then needs to have the u-boot header added with this...

$ mkimage -A arm -O linux -T kernel -C none -a 0x10008000 -e 0x10008000 -d arch/arm/boot/zImage /tftpboot/uImage

# Also copy the flattened device tree binary...

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

################################################

# Build u-boot:

$ cd u-boot-2013.10

$ export ARCH=arm

$ export PLATFORM=imx_v6_v7

$ export CROSS_COMPILE="TOPDIR_HERE/rootfs/buildroot-2013.08/output/host/usr/bin/arm-none-linux-gnueabi-"

$ make mx6qsabresd_config

$ make 2>&1 | tee make.out

# Install this image on your SD card (your 'of' devname may vary):

sudo dd if=u-boot.imx of=/dev/sdd bs=512 seek=2 conv=fsync

With all of the above in completed, the files 'uImage', 'imx6q-sabresd.dtb' and 'uramdisk.img' should be under /tftpboot.

So now install the SD card (SW6: 01000010) and boot to a uboot prompt, and run these commands:


U-Boot> setenv ipaddr YOUR_BOARDS_IPADDRESS

U-Boot>setenv serverip YOUR_TFTPSERVERS_IPADDRESS

U-Boot> tftpboot 0x11000000 imx6q-sabresd.dtb

U-Boot> tftpboot 0x11800000 uramdisk.img

U-Boot> tftpboot 0x12000000 uImage

U-Boot> bootm 0x12000000 0x11800000 0x11000000


This should give you a buildroot login prompt.

3,093 Views
LeonardoSandova
Specialist I

Hi Ed,

your post deserves a document by itself! Thanks for the info :smileyhappy:

Leo

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi Ed,

Thanks  a lot for your response. Did you check instead of creating ramdisk from rootfs, is it possible to mount the rootfs in the linux kernel and make it has uImage.

0 Kudos

3,100 Views
EdSutter
Senior Contributor II

I'm not aware of any way to do that; however, when it comes to combining images, there appears to be some EXPERIMENTAL way to combine the .dtb file and the kernel image.  Referring to the kernel's "make menuconfig", there's an item under Boot->Options titled "Use appended device tree blob to zImage (EXPERIMENTAL)".  I've tried this, but it doesn't seem to work.  Not sure if I'm just doing something wrong or if it really doesn't work.

I've already got a question posted on this (https://community.freescale.com/thread/315490), so if you're interested in that, follow that thread.

0 Kudos

3,097 Views
bottleneck
Contributor II

Ed,

Few years back for different architecture I did it, by mounting the rootfs in kernel. Procedure as follows:

1. create a root folder, under usr in linux kernel

2. mount the rootfs to that root folder

3. create a symbolic links of busybox to your init, ln -s /bin/busybox init

4. Under /etc/inittab update the following:

    # Mount filesystems

     null::sysinit:/bin/mount -t proc proc /proc

     null::sysinit:/bin/mount -t devpts devpts /dev/pts

    # Start a sh shell

    ::askfirst:/bin/sh

5. Enable initrd support (Device driver ->Block devices)and path to rootfs as usr/root

    initramfs usr/root -----> rootfs location

6. give make and get uImage, now you can directly port the uImage without porting rootfs.

Need to check the above procedure for IMX.6

0 Kudos

3,100 Views
fabio_estevam
NXP Employee
NXP Employee

Make sure you have a recent U-boot as well. U-boot 2009.08 does not support device tree booting.

You can use the latest U-boot 2013.10 on sabresd to boot a mainline kernel.

Regards,

Fabio Estevam

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi Fabio ,

Thanks for your reply. I need another information, consider the scenario.On SD card I have uboot old version( 2009) without disturbing that,

I wanted recent version(pre-compiled available in L3.035_4.0.0_130424_images_MX6) in the RAM.

To which location can I load the pre-compiled u-boot and execute the same.

Please guide me.

Thanks

Umamahesh Y V

0 Kudos

3,100 Views
fabio_estevam
NXP Employee
NXP Employee

Just reflash the new U-boot in the SD card. No need to keep the old 2009 version.

Regards,

Fabio Estevam

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi Fabio Estevam,

I used "dd" command to write it on SD card but it is not booting. Even MFG tool I have followed the latest document as said, but no progress. Since the SD card came along with the SABRESD board got corrupted and couldn't recover the Android version in that. Can you guide me with your procedure or do you have any idea about to which address I need to write the u-boot in RAM so that I can copy it to eMMC.

Thanks

Umamahesh

0 Kudos

3,100 Views
EdSutter
Senior Contributor II

What arguments did you use with your 'dd' command?

I think with the newer versions of u-boot (where the created image is "u-boot.imx") you need to omit the "skip",

as it was used in the LTIB documentation for the earlier versions of u-boot, so you would do something like this...

sudo dd if=u-boot.imx of=/dev/sdd bs=512 seek=2 conv=fsync


I guess the other question would be, what version of u-boot are you trying to install?

Ed

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi ,

I was using the same procedure as you just told through 'dd' command with padded u-boot binary without 'skip' and board was not booting up and when i tried the same command with non-padded u-boot , it was booting . I am assuming that sabreSD doesn't have problems with non-padded u-boot but 1- can we use padded  boot loader for sabreSD  and there is another doubt 2- How can we specifically build padded and non-padded u-boot .

Thanks & Regards

0 Kudos

3,100 Views
EdSutter
Senior Contributor II

The older u-boot (from LTIB) created the padding with an assembler file (flash_header.S) and an ORG statement.  That file also contained a hard-coded version of the DCD table.  IHMO, that was a nice simple scheme for creating this boot stuff; however, for better or for worse, it appears that now (more recent versions of u-boot) the initial padding and boot data (as described in the reference manual section 8.6.1: Image Vector Table and Boot Data) is created with the 'mkimage' tool.

EDIT (I brain-farted in my initial post, so this is an update)...

I briefly looked at this.  It seems logical that some padding would always be there because according to table 8-26 (titled: Image Vector Table Offset and Initial Load Region Size) of the reference manual, all boot modes have some offset (padding size).  The file board/freescale/imx/ddr/mx6q_2x_mt41j128.cfg is used as input to mkimage when "-T imximage" is part of the command line.  In this file is a "BOOT_FROM" parameter that appears to establish the offset/padding size; however, the output does not have any padding.  I starting pursuing this, but punted on it and just created a 0x400 byte file of zeros called "padding" so that I can do: "cat padding u-boot.imx > u-boot.padded" for use with my board which boots from SPI-Flash.

Note, this reply is based on my experience with the tools which is not that extensive; however, I have glanced at this code and I think this is correct.  If someone reads this and knows of a better way to inject the padding (there must be), please reply.

HTH

Ed

0 Kudos

3,100 Views
AnsonHuang
NXP Employee
NXP Employee

Hi, Umamahesh

     Maybe you can refer to our v3.10.9 alpha release's DOC, it has detail description of how to boot up a kernel with device tree support.

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi Huang,

Thanks for the reply. I am unable to locate the document. Can you mention the link that you advised to follow.

Please do needful.

0 Kudos

3,100 Views
AnsonHuang
NXP Employee
NXP Employee

Hi, Umamahesh

     The DoC should be available in community: https://community.freescale.com/docs/DOC-97524, please try it.

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi,

But it is restricted. Please check the screen shot.

Access_doc.png

0 Kudos

3,100 Views
AnsonHuang
NXP Employee
NXP Employee

Hi, Umamahesh

     OK, then I will guide you step by step as below, to use device tree, you need two files, one is dtb, the other is uImage or zImage. Take uImage as example, see below:

     1. First you need to set dtbaddr, in uboot, try "set dtbaddr 14000000", this 14000000 is for i.MX6Q SabreSD board, this address will be dtb file's address, tftp will get dtb to this address;

     2. Set loadaddr to 10800000 in uboot, try "set loadaddr 10800000", this address will be uImage's address for tftp getting uImage;

     3. set serverip to your tftp server's IP address;

     4. "dhcp ${dtbaddr} imx6q-sabresd.dtb", here please use your dtb file name accordingly, I take imx6q-sabresd.dtb for example;

     5. "dhcp ${loadaddr} uImage"; This is to load uImage from tftp server.

     6. "boom ${loadaddr} - ${dtbaddr}", this is to bootup kernel.

Below is my full commandline for loading v3.10.9 kernel into i.MX6Q SabreSD board, you can have a reference, you may need to adjust the serverip, nfsroot etc. And please keep in mind that you also need to use a 2013's uboot as Fabio said.

"setenv bootargs console=ttymxc0,115200n8 noinitrd  no_console_suspend root=/dev/nfs nfsroot=${nfsserver}:${nfsroot}, v3, tcp ip=dhcp;set serverip 10.192.242.118; set dtbaddr 14000000; set loadaddr 10800000;dhcp ${dtbaddr} imx6q-sabresd.dtb;dhcp ${load_addr} uImage;bootm ${loadaddr} - ${dtbaddr}"

0 Kudos

3,100 Views
bottleneck
Contributor II

Hi,

I have cross compiled the Openbricks( for Set top box apps), but in the rootfs generated by Openbricks gives scripts as /dev/ttyS0 but freescale roots gives /dev/ttymxc0 so couldn't see the console. Any suggestion to solve this problem

0 Kudos

3,100 Views
AnsonHuang
NXP Employee
NXP Employee

Hi,

     I think you can try adding this ttymxc0 to rootfs, I search my rootfs, below is all the files that containing ttymxc, you can also try searching ttyS0 in your rootfs, then replace them with ttymxc0.

./etc/inittab

./etc/securetty

./etc/init.d/rc_mxc.S

0 Kudos

3,100 Views
sinanakman
Senior Contributor III

Hi Umamahesh, if you are using the 3.11 kernel, you probably need the fdt as well. Make sure you generate the dtb file and provide this while you are booting your kernel.

Your tftp and boot would look something like this :

tftp 0x10800000 uImage.sabre.v3.11; tftp 0x12000000 imx6.ramdisk; tftp 0x13000000 imx6q-sabresd.dtb; bootm 0x10800000 0x12000000 0x13000000

(you might be using different addresses).

Hope this helps

Sinan Akman

0 Kudos