AnsweredAssumed Answered

Booting mainline kernel with mainline u-boot from SD on RIoTboard

Question asked by Michael Oberle on Apr 8, 2015
Latest reply on Apr 9, 2015 by Michael Oberle

I am trying to boot an SD card image with a mainline u-boot (10.2014), mainline kernel (3.19) and debian rootfs all of which I have cross-compiled in a debian VM.

Since I am not a linux guru I am trying to give you as much information as I can for the process of creating the image, u-boot and the kernel.

 

This is the output I am receiving from u-boot now:

CPU:   Freescale i.MX6SOLO rev1.1 at 792 MHz
Reset cause: POR
Board: RIoTboard
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
*** Warning - bad CRC, using default environment

No panel detected: default to HDMI
Display: HDMI (1024x768)
In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
Error: FEC address not set.

Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Booting from net ...
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
*** ERROR: `ethaddr' not set
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
*** ERROR: `ethaddr' not set
FEC Waiting for PHY auto negotiation to complete......... TIMEOUT !
Bad Linux ARM zImage magic!
=> Bad Linux ARM zImage magic!
Unknown command 'Bad' - try 'help'
=>

 

And this is the output of printenv:

baudrate=115200
boot_fdt=try
bootargs=console=ttymxc1,115200 root=/dev/nfs ip=dhcp nfsroot=:,v3,tcp
bootcmd=mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootdelay=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc1
ethact=FEC
ethprime=FEC
fdt_addr=0x18000000
fdt_file=imx6dl-riotboard.dtb
fdt_high=0xffffffff
get_cmd=dhcp
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x12000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=2
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmware_filename}; then setexpr fw_sz ${filesize} / 0x200; setexpr fw_sz ${fw_sz} + 1; mmc write ${loadaddr} 0x2 ${fw_sz}; fi; fi
update_spi_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if ${get_cmd} ${update_spi_firmware_filename}; then if sf probe; then sf erase 0 0xc0000; sf write ${loadaddr} 0x400 ${filesize}; fi; fi

Environment size: 2228/8188 bytes

 

I guess that u-boot does not look for the kernel on the SD card but since I am new to u-boot I don't know what I need to change.

 

This is how I build the component which is a mixutre of (http://www.element14.com/community/community/designcenter/single-board-computers/riotboard/blog/2014/09/18/linux-on-the-…) and risc-a-day: Mainline Linux for RIoTBoard

U-boot

export ARCH=arm  
export CROSS_COMPILE=arm-linux-gnueabihf-  
export OUTPUT=/home/riotboard/linux/output  
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2014.10.tar.bz2
tar xf u-boot-2014.10.tar.bz2 && cd u-boot-2014.10
make distclean && make riotboard_defconfig && make u-boot.imx -j4

 

Kernel:

export ARCH=arm  
export OUTPUT=/home/riotboard/linux/output  
mkdir ~/riotboard
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.17.tar.xz
tar xf linux-3.17.tar.xz && cd linux-3.17
make distclean && make imx_v6_v7_defconfig && make LOADADDR=0x10008000 uImage -j4
cp arch/arm/boot/uImage ~/riotboard/
cp arch/arm/boot/dts/imx6dl-riotboard.dtb ~/riotboard/
make modules_install INSTALL_MOD_PATH=~/riotboard


Side question: what does the LOADADDR argument to in the make command?

 

I will skip the rootfs here becuase these IMHO is not the problem here yet.

I have created the SD card image in the following way  (http://www.element14.com/community/community/designcenter/single-board-computers/riotboard/blog/2014/09/19/linux-on-the-…)

 

apt-get install qemu-utils kpartx 
cd /home/riotboard/linux/output
qemu-img create sdcard.img 3600M  
sfdisk --force -uM sdcard.img << EOF  
10,,83  
EOF
kpartx -av sdcard.img
mkfs.ext2 -j /dev/mapper/loop0p1  
mkdir -p /mnt/sdcard  
mount -t ext2 /dev/mapper/loop0p1 /mnt/sdcard 
tar --numeric-owner -C /mnt/sdcard -zxvf oneiric.tgz  
tar --numeric-owner -C /mnt/sdcard -zxvf linux-kernel-3.19.tgz
umount /mnt/sdcard  
kpartx -dv sdcard.img
dd if=u-boot.imx of=sdcard.img bs=512 seek=2 conv=notrunc  

 

I hope someone can point me in the right direction!

 

Thank you!

Michael

Outcomes