湖南企业建站系统信息,如何给网站配色,网站怎么做关键词,汽车网页设计图片官方文档 在前面 文章目录 uboot常见命令学习环境变量网络控制台uboot标准启动其他 升级uboot或内核bin和uimg以及booti和bootm的区别制作uImage更换内核更换uboot后续计划 uboot常见命令学习
环境变量
Environment Variables环境变量 autostart 如果值为yes#xff0c;则会…官方文档 在前面 文章目录 uboot常见命令学习环境变量网络控制台uboot标准启动其他 升级uboot或内核bin和uimg以及booti和bootm的区别制作uImage更换内核更换uboot后续计划 uboot常见命令学习
环境变量
Environment Variables环境变量 autostart 如果值为yes则会在以下命令后自动执行bootm加载镜像
bootelf - Boot from an ELF image in memory
bootp - boot image via network using BOOTP/TFTP protocol
dhcp - boot image via network using DHCP/TFTP protocol
diskboot - boot from ide device
nboot - boot from NAND device
nfs - boot image via network using NFS protocol
rarpboot - boot image via network using RARP/TFTP protocol
scsiboot - boot from SCSI device
tftpboot - boot image via network using TFTP protocol
usbboot - boot from USB devicebootcmd 用户不进bootshell自动执行的命令 bootargs 传递给操作系统或镜像的参数 bootfile tftp时的镜像名 ipaddr tftpboot用到的ip地址 serverip tftpboot用到的tftp服务器地址
网络控制台
Network console uboot启用network console 需要设置CONFIG_NETCONSOLEy以启用特性。 使用方法: 使用ncip设置目的地址和端口号(默认6666)比如你的服务器ip是192.168.1.1: setenv nc setenv stdout nc;setenv stdin ncsetenv ncip 192.168.1.1saveenvrun nc在主机侧使用脚本来访问控制台:
tools/netconsole ip [port]主机侧也可以使用主机名 参考《【调试】netconsole的使用》 linux启用network console 如果想开启这个功能需要内核编译支持我这里的选项默认是:
CONFIG_NETCONSOLEm
CONFIG_NETCONSOLE_DYNAMICn如果将netconsole编译进内核自动加载还需要在内核启动参数中传递进去。格式如下:
netconsole[src-port][src-ip]/[dev],[tgt-port]tgt-ip/[tgt-macaddr]例子
netconsole444410.0.0.1/eth1,935310.0.0.2/12:34:56:78:9a:bc
netconsole/,192.168.3.1/然后查看linux控制台输出:
nc -u -l -p 6666uboot标准启动
U-Boot Standard Boot bootdev 可保存或访问发行版的设备 bootmeth 扫描bootdev发现bootflow的方法 bootflow 描述启动方法(发行版提供)
其他
bootmenu 生成一个选单
升级uboot或内核
bin和uimg以及booti和bootm的区别
参考文章《编译生成uImage过程——mips平台》 uboot.bin是U-boot bootloader的二进制文件。 uImage是一个小内核映像带有Uboot的修改头使U-boot能够加载此内核映像uboot.bin是U-boot bootloader的二进制文件。 uImage是一个小内核映像带有Uboot的修改头使U-boot能够加载此内核映像 booti和bootm命令的区别 bootz是启动zImage而bootm是启动uImage其中booti专门用来启动ARM64的kernel image。 制作uImage
使用uboot的tools目录下的mkimage命令可以创建用于uboot的镜像即uImage。 先加下这个命令:
$ sudo update-alternatives --install /usr/bin/mkimage mkimage /home/wsl/project/raspberry_pi/u-boot/tools/mkimage 10常见参数
Usage: ./mkimage [-T type] -l image-l list image header information-T parse image file as type-q quiet./mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image-A set architecture to arch-O set operating system to os-T set image type to type-C set compression type comp-a set load address to addr (hex)-e set entry point to ep (hex)-n set image name to name-R set second image name to name-d use image data from datafile-x set XIP (execute in place)-s create an image with no data-v verbose./mkimage [-D dtc_options] [-f fit-image.its|-f auto|-f auto-conf|-F] [-b dtb [-b dtb]] [-E] [-B size] [-i ramdisk.cpio.gz] fit-imagedtb file is used with -f auto, it may occur multiple times.-D set all options for device tree compiler-f input filename for FIT source-i input filename for ramdisk file-E place data outside of the FIT structure-B align size in hex for FIT structure and header-b append the device tree binary to the FIT-t update the timestamp in the FIT
Signing / verified boot options: [-k keydir] [-K dtb] [ -c comment] [-p addr] [-r] [-N engine]-k set directory containing private keys-K write public keys to this .dtb file-g set key name hint-G use this signing key (in lieu of -k)-c add comment in signature node-F re-sign existing FIT image-p place external data at a static position-r mark keys used as required in dtb-N openssl engine to use for signing-o algorithm to use for signing./mkimage -V print version information and exit
Use -T list to see a list of available image types
Long options are available; read the man page for details参考《uboot-tool工具命令mkimage详解uboot-tool工具命令mkimage详解》一个典型的生成命令如下:
mkimage -A arm64 -O linux -T kernel -a 0x00080000 -e 0x00080040 -C none -n kernel-myconfig -d arch/arm64/boot/Image kernel.uImage比较关键的是-e参数-e 指定映象运行的入口点地址这个地址就是-a参数指定的值加上0x40因为前面有个mkimage添加的0x40个字节的头关于参数这里还有一份更全的文档可以参考。 使用上述命令后内核无法启动报错:
Working FDT set to 0Loading Kernel Image
FDT and ATAGS support not compiled inresetting ...后面再看
更换内核
暂时搞了这么几个env可以用来运行
booti_kernelbooti ${kernel_addr_r} - ${fdt_addr}
dhcp_get_kerneldhcp ${kernel_addr_r} kernel-myconfig.img
dhcpbootrun dhcp_get_kernel;run booti_kernel
fat_get_kernelfatload mmc 0:1 ${kernel_addr_r} kernel-myconfig.img
fatbootrun fat_get_kernel;run booti_kernel更换uboot
暂时用了个笨办法先用dhcp把u-boot.bin取过来然后用fatwrite写到boot分区然后reset重新启动
后续计划
看是否能较方便的一次性更换内核设备树模块等。 一个自定义的uboot环境变量
HWIDTS-SG5036FX:02:04:01:0E:101:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
ID000000000000000000
appauto1
baudrate115200
boardmodelRTL9311_6x8214QF_1x8218E_4XGE_24GF_8GE_4XF
boot_flag0
bootargsmem512M consolettyS0,115200 rd_start0x82000000 rd_size0xd00000 root/dev/ram0 rw init/linuxrc
bootcmdboota
bootdelay1
bootflag0
datftp 0x81000000 boot.bin.img; flwrite
dh_keyboard0
drtftp 0x81000000 krootfs.bin.img; flwrite
drbtftp 0x81000000 krootfs_backup.bin.img; flwrite
ethactrtl9310#0
ethaddr20:23:04:19:13:38
fileaddr81000000
filesizeD74F38
gatewayip172.14.48.1
ipaddr172.14.49.120
ledModeInitSkip0
netmask255.255.255.0
serverip10.33.7.176
stderrserial
stdinserial
stdoutserial
tktftp 0x81000000 krootfs.bin.img; bootm 0x81000000
uptftp 0x81000000 update.img; flwrite