::log.2017
[ TOP | Recently ]
uboot on RaspberryPi3
2017-08-09 uboot on RaspberryPi3
夏休みの宿題のためRasPI3にubootを入れてみる。
https://kernelnomicon.org/?p=682 を見ながら…見てもよくわからない。
幸いRasPI3はググれば星の数ほど解説ページが出てくるので、色々なページをつらつらと読んでみた所
・RasPI3のUARTはbluetooth用に使われていて使えない?
・mini-uartという機能でcpu clockからbaud rateを作って通信する機能があってそっちなら使える
・そのためserialのスピードがcpu clock(可変)に引きづられ通信できない環境がある?
ということのようだ。しかし手元の環境だと普通に通信できてるので問題ないのかな。
とりあえずRPI3 uboot SD cardの作り方
・https://www.raspberrypi.org/downloads/raspbian/ からRaspbian Jessie Liteのイメージを落とす
・SD cardにddで書き込む
・SD cardにFATとLinuxのパーティションができる。Linux Partitionは使わないので無視
・FATパーティションをmountして、config.txt に以下の3行を追加
arm_control=0x200 enable_uart=1 kernel=u-boot.bin
・適当なLinux hostにaarch64なcross gccを入れる。apt-cache search aarch64-linux-gnuしてbinutil、gccをapt-get install
・http://git.denx.de/?p=u-boot.git を clone してビルドする
# make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EFI=y rpi_3_defconfig # make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EFI=y
・できた u-boot.bin を、SD cardのFATパーティションにコピー
・できあがり!
RasPI3のGPIO14(=TXD=PIN8)とGPIO15(=RXD=PIN10)にシリアルをつないでBoot!
U-Boot 2017.09-rc1-00133-geaa90e5-dirty (Aug 09 2017 - 02:23:24 +0900) DRAM: 944 MiB RPI 3 Model B (0xa02082) MMC: sdhci@7e300000: 0 reading uboot.env In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. starting USB... USB0: Core Release: 2.80a scanning bus 0 for devices... 3 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found U-Boot> ? ? - alias for 'help' base - print or set address offset bdinfo - print Board Info structure boot - boot default, i.e., run 'bootcmd' bootd - boot default, i.e., run 'bootcmd' bootefi - Boots an EFI payload from memory bootelf - Boot from an ELF image in memory booti - boot arm64 Linux Image image from memory bootm - boot application image from memory bootp - boot image via network using BOOTP/TFTP protocol bootvx - Boot vxWorks from an ELF image cmp - memory compare coninfo - print console devices and information cp - memory copy crc32 - checksum calculation dhcp - boot image via network using DHCP/TFTP protocol dm - Driver model low level access echo - echo args to console editenv - edit environment variable env - environment handling commands exit - exit script ext2load- load binary file from a Ext2 filesystem ext2ls - list files in a directory (default /) ext4load- load binary file from a Ext4 filesystem ext4ls - list files in a directory (default /) ext4size- determine a file's size false - do nothing, unsuccessfully fatinfo - print information about filesystem fatload - load binary file from a dos filesystem fatls - list files in a directory (default /) fatsize - determine a file's size fatwrite- write file into a dos filesystem fdt - flattened device tree utility commands fstype - Look up a filesystem type go - start application at address 'addr' gpio - query and control gpio pins help - print command description/usage iminfo - print header information for application image imxtract- extract a part of a multi-image itest - return true/false on integer compare lcdputs - print string on video framebuffer load - load binary file from a filesystem loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line loadx - load binary file over serial line (xmodem mode) loady - load binary file over serial line (ymodem mode) loop - infinite loop on address range ls - list files in a directory (default /) md - memory display mii - MII utility commands mm - memory modify (auto-incrementing address) mmc - MMC sub system mmcinfo - display MMC info mw - memory write (fill) nfs - boot image via network using NFS protocol nm - memory modify (constant address) part - disk partition related commands ping - send ICMP ECHO_REQUEST to network host printenv- print environment variables pxe - commands to get and boot from pxe files reset - Perform RESET of the CPU run - run commands in an environment variable save - save file to a filesystem saveenv - save environment variables to persistent storage setcurs - set cursor position within screen setenv - set environment variables setexpr - set environment variable as the result of eval expression showvar - print local hushshell variables size - determine a file's size sleep - delay execution for some time source - run script from memory sysboot - command to get and boot from syslinux files test - minimal test like /bin/sh tftpboot- boot image via network using TFTP protocol true - do nothing, successfully usb - USB sub-system usbboot - boot from USB device version - print monitor, compiler and linker version U-Boot> bdinfo arch_number = 0x00000000 boot_params = 0x00000100 DRAM bank = 0x00000000 -> start = 0x00000000 -> size = 0x3B000000 baudrate = 115200 bps TLB addr = 0x3AFF0000 relocaddr = 0x3AF55000 reloc off = 0x3AED5000 irq_sp = 0x3AB4E0F0 sp start = 0x3AB4E0F0 Early malloc usage: 2d8 / 2000 fdt_blob = 000000003ab4e100 U-Boot>
EOF