How to boot from SD/MMC on the LS1043ARDB

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

How to boot from SD/MMC on the LS1043ARDB

Jump to solution
8,034 Views
donberkowitz
Contributor II

I have been asking several questions related to the proper procedure for preparing an SD Chip to be bootable on the LS1043ARDB.  I see now that the sdk 0.5 PDF is really not clear nor accurate on how to go about this in a routine fashion.  I would like to put the X-11 image on an SD chip.  I also plan to go through the process of making other devices such as a USB-mountable disk, and a SATA mountable disk both bootable.  To make our lives simpler, could you please cook us such a procedure? 

Thanks!

Don

0 Kudos
Reply
1 Solution
5,361 Views
ufedor
NXP Employee
NXP Employee

I agree with your findings.

Could you please create a technical case which will be more convenient way to handle the issue:

How I could create a Service Request?

View solution in original post

0 Kudos
Reply
16 Replies
5,361 Views
ufedor
NXP Employee
NXP Employee

Please refer to the Freescale Linux LS1043A SDK v0.5 Documentation, 3.4.8.4 SD Deployment.

The SDK is available at:

LS1043A SDK v0.5 SOURCE

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Lets start with item 2 on Page 68.  It says run FDISK but it does not specify ANYTHING about how the disk should be partitioned or configured.

Now Item 2 on page 69.

dd if=u-boot-with-spl-pbl.bin of=/dev/sdb seek=8 bs=512

The file "u-boot-with-spl-pbl.bin" does not exist or if it needs to be created, it must be created by some unspecified but required build.

Now how about this item at the bottom of page 69:

setenv bootcmd "ext2load mmc 0 a0000000 kernel.itb && bootm a0000000"

"Kernel.itb" also does not exist.

Some clear, explicit instructions would be greatly appreciated.

Thank you.

Don

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

Hi Don,

All images build using Yocto are available in \build_ls1043aqds_release\tmp\deploy\images\ls1043aqds\. So, u-boot image for sd_card and kernel.itb should be there after bitbake fsl-image-core.

After that the next steps should be followed:

1. fdisk the sdcard. You can create two partition (one vfat - for uboot + uboot env and one ext2 - for linux file system) or only one (the one for linux). If you choose to create only linux partition, make sure you let enough space for partition table + uboot + uboot env (you can create the linux partion starting with sector 3000)

2. format the partition as ext2

3. load the uboot into the sd card starting with sector 8 (up to this sector it is partition table). You can load uboot into sd using linuz, uboot or CodeWarrior for ARMv8

     - in linux: dd if=u-boot-sd-ls1043ardb_sdcard.bin of=/dev/sdb seek=8 bs=512

     - in uboot: tftp <address> u-boot-sd-ls1043ardb_sdcard.bin; mmc write <address> 8 0x400

     - in CodeWarrior you have to use Flash Programmer

4. in ext2 partition you ahve to untar the linux rootfs and copy the kernel.itb under /boot

Adrian

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Sorry for being honest but you have not read the question carefully, nor the correspondence nor tried your own instructions.

For example, no such file kernel.itb is produced.  Also, I am trying to build the x-11 image and the files produced by that build do not include any itb.

I would love to have some help with this.

Thanks,

Don

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

Did you bitbake fsl-image-x11? I did this and the images are available in the deploy folder.

Adrian

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Yes of course.  After FDisk'ing a 16 GB SD card creating two partitions, the first one being bootable and being about 14.5 GB in size, I ran the following commands:


sudo dd if=u-boot-sd-ls1043ardb_sdcard.bin of=/dev/mmcblk0 seek=8 bs=512
sudo mkfs.ext2 /dev/mmcblk0p1
sudo mkdir temp
sudo mount /dev/mmcblk0p1 temp
sudo cp fsl-image-x11-ls1043ardb-20160203181747.rootfs.ext2.gz temp/
sudo gzip -d temp/fsl-image-x11-ls1043ardb-20160203181747.rootfs.ext2.gz
sudo mkdir /mnt/targetfs
sudo mount -t ext2 temp/fsl-image-x11-ls1043ardb-20160203181747.rootfs.ext2  /mnt/targetfs
sudo cp -a kernel-fsl-ls1043a-rdb.dtb-ls1043ardb-20160201195223.itb  /mnt/targetfs/boot

All were successful except the last one which claimed that I had run out of space on the disk.

I think I am getting closer despite the documentation, but still not there.

Thanks for the help.


Don

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

Don, on first partition will be placed only uboot + uboot env, witch is around 2MB in size. So, having first partition 14.5GB in size is a waste. Try make second partition starting with sector 3000, this way you will have enough space for linux image.

Adrian

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Perhaps there is something I am missing, but as I understand it, U-Boot goes in the special boot area in the first few sectors of the SD chip, which FDISK does not allocate to Partion 1 or 2.  The write to MMCBLK0 rather than MMCBLK0P1 writes to this special area.  See the bottom of Page 69 in the SDK 0.5 PDF (U-Boot image deployment from SD card).  In the example they refer to sdb but for the SD chip in this configuration its MMCBLK0 as I understand it.

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

First 8 sectors from sd card are allocated for partition table. Uboot is placed starting sector 8 (seek=8 from dd command means skip first 8 sector and write starting from there).

So, is better to create a partition starting from sector 3000  (to have enough space for uboot + uboot env) and have enough space for linux.

Adrian

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Yes, sector 8 or sector 0, u-boot goes in the low part of the SD chip BEFORE the first partion.  FDisk creates the first partition at sector 2048 which leaves plenty of space for U-boot to reside in the low memory of the chip.  None of your explanation seems to explain why the Kernel could not be placed under boot on the rootfs.  Please get a real 1043ARDB board, the 0.5 SDK and attempt to follow the instructions. I think you will quickly see the problem.

Best regards,

Don

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

Don,

Here is the steps I do on my side. Woks fine on my real ls1043ardb.

Edit fsl-image-x11.bb by adding IMAGE_FSTYPES = "ext2.gz.u-boot tar.gz"

b11883@fsr-ub1264-120:/$ sudo fdisk /dev/sdd

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x1de026b0.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdd: 8001 MB, 8001683456 bytes

247 heads, 62 sectors/track, 1020 cylinders, total 15628288 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x1de026b0

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-15628287, default 2048): 2400

Last sector, +sectors or +size{K,M,G} (2400-15628287, default 15628287):

Using default value 15628287

Command (m for help): p

Disk /dev/sdd: 8001 MB, 8001683456 bytes

247 heads, 62 sectors/track, 1020 cylinders, total 15628288 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x1de026b0

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1            2400    15628287     7812944   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

b11883@fsr-ub1264-120:/$ sudo dd if=/sdk/tftpboot/ls1043ardb/sdk0.5/u-boot-sd-ls1043ardb_sdcard-2015.01+git-r0.bin of=/dev/sdd seek=8

1205+1 records in

1205+1 records out

617176 bytes (617 kB) copied, 0.147856 s, 4.2 MB/s

b11883@fsr-ub1264-120:/$ sudo mkfs.ext2 /dev/sdd1

mke2fs 1.42 (29-Nov-2011)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

488640 inodes, 1953236 blocks

97661 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2000683008

60 block groups

32768 blocks per group, 32768 fragments per group

8144 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

b11883@fsr-ub1264-120:/$ sudo mount /dev/sdd1 /mnt

b11883@fsr-ub1264-120:/$ cd /mnt

b11883@fsr-ub1264-120:/mnt$ sudo cp /sdk/tftpboot/ls1043ardb/sdk0.5/fsl-image-x11-ls1043ardb-20160211102431.rootfs.tar.gz .

b11883@fsr-ub1264-120:/mnt$ sudo tar -xvf fsl-image-x11-ls1043ardb-20160211102431.rootfs.tar.gz

b11883@fsr-ub1264-120:/mnt$ sudo cp /sdk/tftpboot/ls1043ardb/sdk0.5/kernel-fsl-ls1043a-rdb.dtb-ls1043ardb.itb boot/

b11883@fsr-ub1264-120:/$ sudo umount /mnt/

=> run sdboot

Device: FSL_SDHC

Manufacturer ID: 74

OEM: 4a45

Name: SDC

Tran Speed: 50000000

Rd Block Len: 512

SD version 3.0

High Capacity: Yes

Capacity: 7.5 GiB

Bus Width: 4-bit

35002919 bytes read in 3788 ms (8.8 MiB/s)

## Loading kernel from FIT Image at a0000000 ...

   Trying 'kernel@1' kernel subimage

     Description:  ARM64 Linux kernel

     Type:         Kernel Image

     Compression:  gzip compressed

     Data Start:   0xa00000dc

     Data Size:    4408293 Bytes = 4.2 MiB

     Architecture: AArch64

     OS:           Linux

     Load Address: 0x80080000

     Entry Point:  0x80080000

   Verifying Hash Integrity ... OK

## Loading fdt from FIT Image at a0000000 ...

   Trying 'fdt@1' fdt subimage

     Description:  Flattened Device Tree blob

     Type:         Flat Device Tree

     Compression:  uncompressed

     Data Start:   0xa0434578

     Data Size:    28481 Bytes = 27.8 KiB

     Architecture: AArch64

   Verifying Hash Integrity ... OK

   Loading fdt from 0xa0434578 to 0x90000000

   Booting using the fdt blob at 0x90000000

   Uncompressing Kernel Image ... OK

   reserving fdt memory region: addr=80000000 size=10000

   Using Device Tree in place at 0000000090000000, end 0000000090019f40

Starting kernel ...

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Hi Adrian,  could you please display your U-boot configuration?  I am still getting "Wrong image format" and am suspicious of the U-Boot configuration. 

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

My U-boot config:

baudrate=115200

bootargs=console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,0x21c0500,115200

bootcmd=cp.b $kernel_start $kernel_load $kernel_size && bootm $kernel_load

bootdelay=10

console=ttyAMA0,38400n8

eth1addr=00:04:9F:03:D3:37

eth2addr=00:04:9F:03:D3:38

eth3addr=00:04:9F:03:D3:39

eth4addr=00:04:9F:03:D3:3A

eth5addr=00:04:9F:03:D3:3B

eth6addr=00:04:9F:03:D3:3C

ethact=FM1@DTSEC3

ethaddr=00:04:9F:03:D3:36

ethprime=FM1@DTSEC3

fdt_high=0xffffffffffffffff

fman_ucode=60300000

hwconfig=fsl_ddr:bank_intlv=auto

initrd_high=0xffffffffffffffff

kernel_addr=0x100000

kernel_load=0x807f0000

kernel_size=0x1000000

kernel_start=0x61200000

loadaddr=0x80100000

ramdisk_addr=0x800000

ramdisk_size=0x2000000

sdboot=setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=ttyS0,115200 earlycon=uart8250,0x21c0500,115200;mmcinfo;ext2load mmc 0:1 a0000000 /boot/kernel-fsl-ls1043a-rdb.dtb-ls1043ardb.itb;bootm a0000000

stderr=serial

stdin=serial

stdout=serial

Adrian

0 Kudos
Reply
5,361 Views
donberkowitz
Contributor II

Looks to me as though you are copying the kernel from NOR (CP.B) - I am trying to boot entirely from a SD chip.

0 Kudos
Reply
5,361 Views
addiyi
NXP Employee
NXP Employee

Ignore bootcmd. I used only

sdboot=setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=ttyS0,115200 earlycon=uart8250,0x21c0500,115200;mmcinfo;ext2load mmc 0:1 a0000000 /boot/kernel-fsl-ls1043a-rdb.dtb-ls1043ardb.itb;bootm a0000000

In this case kernel is copied from mmc to ram, then executed.

Adrian

0 Kudos
Reply
5,362 Views
ufedor
NXP Employee
NXP Employee

I agree with your findings.

Could you please create a technical case which will be more convenient way to handle the issue:

How I could create a Service Request?

0 Kudos
Reply