Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

这种更新方式支持的BSP版本为PD18.1.0及以上版本.

Multiexcerpt
MultiExcerptNameusbotg update nand

barebox设置开发板的usb为外设模式和使能fastboot

Code Block
languagebash
themeMidnight
barebox:/ otg.mode=peripheral
barebox:/ usbgadget -aA /barebox(barebox)c,/kernel(kernel)c,/rootfs(rootfs)c,/oftree(oftree)c

linux主机安装fastboot

Code Block
languagebash
themeMidnight
# sudo apt-get install android-tools-fastboot

windows主机安装google提供的 SDK Platform-Tools ,和USB驱动,然后给设备管理器中的fastboot设备强制安装google debug驱动。

设置完成后, linux主机检查开发板的fastboot功能是否使能

Code Block
languagebash
themeMidnight
# sudo fastboot getvar all
(bootloader) version: 0.4
(bootloader) bootloader-version: barebox-2017.12.0-bsp-yocto-i.mx6-pd18.
(bootloader) partition-size:barebox: 00000000
(bootloader) partition-type:barebox: file
(bootloader) partition-size:kernel: 00000000
(bootloader) partition-type:kernel: file
(bootloader) partition-size:rootfs: 00000000
(bootloader) partition-type:rootfs: file
(bootloader) partition-size:oftree: 00000000
(bootloader) partition-type:oftree: file
all: 
finished. total time: 0.001s

通过fastboot 传输barebox, zImage , oftree, 文件系统镜像到开发板fastboot的分区

Code Block
languagebash
themeMidnight
# sudo fastboot flash barebox barebox.bin
# sudo fastboot flash kernel zImage
# sudo fastboot flash rootfs root.ubifs
# sudo fastboot flash oftree zImage.dtb

更新nand

更新nand时需要用fastboot执行barebox的命令, 格式如下

Usage: fastboot oem exec <barebox command>

Example: fastboot oem exec ubiformat /dev/nand0.root

Code Block
languagebash
themeMidnight
# sudo fastboot oem exec barebox_update -t nand /barebox
# sudo fastboot oem exec erase /dev/nand0.barebox-environment.bb
# sudo fastboot oem exec ubiformat /dev/nand0.root
# sudo fastboot oem exec ubiattach /dev/nand0.root
# sudo fastboot oem exec ubimkvol -t static /dev/nand0.root.ubi kernel 8M
# sudo fastboot oem exec ubimkvol -t static /dev/nand0.root.ubi oftree 1M
# sudo fastboot oem exec ubimkvol -t dynamic /dev/nand0.root.ubi root 0
# sudo fastboot oem exec ubiupdatevol /dev/nand0.root.ubi.kernel /kernel
# sudo fastboot oem exec ubiupdatevol /dev/nand0.root.ubi.oftree /oftree
# sudo fastboot oem exec cp -v /rootfs /dev/nand0.root.ubi.root

重启开发板

Code Block
languagebash
themeMidnight
# sudo fastboot oem exec reset