uboot脚本启动

1, uboot脚本一,从virtio磁盘分区加载内核和dtb

load virtio 0:1 0x40400000 Image
load virtio 0:1 0x41800000 qemuv8.dtb
fdt addr 0x41800000
fdt resize 1024
fdt set /chosen \#address-cells <0x2>
fdt set /chosen \#size-cells <0x2>
fdt set /chosen bootargs "console=ttyAMA0 root=/dev/vda2 rw"
setenv fdt_high 0xffffffffffffffff
booti 0x40400000 - 0x41800000

2. uboot脚本二,直接使用semihosting,从host加载镜像

2.1 使能semihosting,添加CONFIG_SEMIHOSTING

2.2 配置uboot启动命令CONFIG_BOOTCOMMAND

smhload boot.scr ${scriptaddr}; source ${scriptaddr}

2.3 uboot脚本

smhload Image  ${kernel_addr_r}
fdt addr ${fdt_addr}
fdt resize 1024
fdt set /chosen \#address-cells <0x2>
fdt set /chosen \#size-cells <0x2>
fdt set /chosen bootargs "console=ttyAMA0 root=/dev/vda rw"
fdt rm /secram
setenv fdt_high 0xffffffffffffffff
booti ${kernel_addr_r} - ${fdt_addr}

3. 加载Xen的uboot脚本

setenv xen_addr_r 0x41600000
smhload xen  ${xen_addr_r}
smhload Image-dom0 ${kernel_addr_r} kernel_addr_end
setexpr kernel_addr_end ${kernel_addr_end} + 1
setexpr kernel_size ${kernel_addr_end} - ${kernel_addr_r}
setenv kernel_size 0x${kernel_size}
fdt addr ${fdt_addr}
fdt resize 1024
fdt set /chosen \#address-cells <0x2>
fdt set /chosen \#size-cells <0x2>
fdt set /chosen xen,xen-bootargs "console=dtuart dom0_mem=512M dom0_max_vcpus=1 bootscrub=0 vwfi=native sched=null"
fdt mknod /chosen dom0
fdt set /chosen/dom0 compatible  "xen,linux-zimage" "xen,multiboot-module" "multiboot,module"
fdt set /chosen/dom0 reg <0x0 ${kernel_addr_r} 0x0 ${kernel_size}>
fdt set /chosen xen,dom0-bootargs "console=hvc0 root=/dev/vda rw"
fdt mknod / mcd
fdt set /mcd compatible  "arm,mcd"
fdt set /mcd interrupts  <0 26 1>
fdt set /mcd interrupt-names  "mcd"
fdt rm /secram
setenv fdt_high 0xffffffffffffffff
booti ${xen_addr_r} - ${fdt_addr}

4. 编译uboot脚本(假设scriptaddr=0x40200000)

u-boot/tools/mkimage -A arm64 -T script -C none -a 0x40200000 -e 0x40200000 -d boot.source boot.scr

你可能感兴趣的:(杂记,linux,运维,服务器)