操作系统:win10 64位

虚拟机:VMware® Workstation 14 Pro

虚拟机操作系统:ubuntu 18.04 64位  ubuntu-18.04.2-desktop-amd64.iso

开发板:迅为 iMX6Q

本次目标:编译【迅为】提供的移植好的uboot-imx并下载到开发板运行

(1)如何找到【迅为】提供的uboot呢?其实【迅为】提供的光盘文件里,有android的源代码,android是一套代码,包括uboot,kernel,android上层代码。因此,去android源码里找即可。

iTOP-iMX6_android4.4.2/bootable/bootloader/uboot-imx

这里的uboot-imx,版本为:U-Boot 2009.08,算是较老版本了,如果想使用新的,可以在:

iTOP-iMX6_android6.0.1/bootable/bootloader/uboot-imx  找到较新的uboot版本。

(2)如何编译呢?【迅为】提供了一个脚本,直接运行即可。

./build_uboot.sh

#!/bin/bash

export ARCH=arm
#export CROSS_COMPILE=/media/work/iTOP-iMAX6/iTOP-iMX6_android4.4.2/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
export CROSS_COMPILE=$(pwd)/../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
make distclean
make mx6q_topeet_android_config
#make mx6solo_topeet_android_config

make
~

(3)如何烧写:

这时使用:【迅为】开发光盘里的下载工具:

Mfgtools-Rel-1.1.0_180706_MX6Q_UPDATER,

修改:cfg.ini文件

[profiles]
chip = MX6Q Linux Update

[platform]
board = SabreSD

[LIST]
name =Linux-MX6QGo-eMMC

修改:Mfgtools-Rel-1.1.0_180706_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware\ucl2.xml

这里是新增加了一个烧写的选项。只烧写uboot与内核的,为了下载快速与调试。

<LIST name="Linux-MX6QGo-eMMC" desc="Choose eMMC android as media">
<CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot-mx6q-sabresd_2G.bin" >Loading U-boot_Linux</CMD>
<CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</CMD>
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD>
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>

<CMD state="Updater" type="push" body="$ ls /dev/*"/>
<CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=1536 count=16">clean up u-boot parameter</CMD>
<CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=512 conv=fsync count=4000">clean up u-boot parameter</CMD>

<CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk0boot0/force_ro">access boot partition 1</CMD>
<CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=4000">clear u-boot arg</CMD>
<CMD state="Updater" type="push" body="send" file="files/linux/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0boot0 bs=512 seek=2 skip=2">write U-Boot to sd card</CMD>
<CMD state="Updater" type="push" body="$ echo 1 > /sys/block/mmcblk0boot0/force_ro"> re-enable read-only access </CMD>
<CMD state="Updater" type="push" body="$ echo 8 > /sys/block/mmcblk0/device/boot_config">enable boot partion 1 to boot</CMD>

<CMD state="Updater" type="push" body="send" file="mksdcard.sh.tar">Sending partition shell</CMD>
<CMD state="Updater" type="push" body="$ tar xf $FILE "> Partitioning...</CMD>
<CMD state="Updater" type="push" body="$ sh mksdcard.sh /dev/mmcblk0"> Partitioning...</CMD>

<CMD state="Updater" type="push" body="send" file="files/linux/uImage">Sending kernel uImage</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=1M seek=1 conv=fsync">write kernel image to sd card</CMD>

<CMD state="Updater" type="push" body="$ mkfs.ext3 -j /dev/mmcblk0p1">Formatting rootfs partition</CMD>
<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk0p1 /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>

 

 

【迅为iMX6Q】开发板:迅为官方提供好的uboot的编译_android

把已经编译好的uboot.bin放在工具下的烧写目录进行烧写。

 

运行的信息如下:

 

U-Boot 2009.08 (11月 06 2019 - 09:54:12)

CPU: Freescale i.MX6 family TO1.5 at 792 MHz
Thermal sensor with ratio = 188
Temperature: 44 C, calibration data 0x5a852169
mx6q pll1: 792MHz
mx6q pll2: 528MHz
mx6q pll3: 480MHz
mx6q pll8: 50MHz
ipg clock : 66000000Hz
ipg per clock : 66000000Hz
uart clock : 80000000Hz
cspi clock : 60000000Hz
ahb clock : 132000000Hz
axi clock : 264000000Hz
emi_slow clock: 132000000Hz
ddr clock : 528000000Hz
usdhc1 clock : 198000000Hz
usdhc2 clock : 198000000Hz
usdhc3 clock : 198000000Hz
usdhc4 clock : 198000000Hz
nfc clock : 24000000Hz
Board: i.MX6Q-SABRESD: unknown-board Board: 0x63015 [POR ]
Boot Device: MMC
I2C: ready
DRAM: 2 GB
MMC: FSL_USDHC: 0,FSL_USDHC: 1,FSL_USDHC: 2,FSL_USDHC: 3
Boot system :android
LCD type:9.7
In: serial
Out: serial
Err: serial
Net: FEC0 [PRIME]
Hit any key to stop autoboot: 0
booti: bad boot image magic
fastboot is in init......flash target is MMC:3
Bad partition index:2 for partition:recovery
Bad partition index:5 for partition:system
wait usb cable into the connector!

 

这里的uboot,是为了启动android的,如果只想跑uboot kernel与根文件系统,还需要进一步的研究与配置。