qemu arm start u-boot from flash(2) u-boot source
The qemu_arm_defconfig
CONFIG_TEXT_BASE=0x00000000 and CONFIG_POSITION_INDEPENDENT is not set
So our u-boot always run in the flash.
The arm virt machine have the ram map "memory[0] [0x40000000-0x7fffffff], 0x40000000 bytes flags: 0" This can get by u-boot:bdinfo
ok we modify qemu_arm_defconfig CONFIG_TEXT_BASE=0x40000000 and CONFIG_POSITION_INDEPENDENT=y
re compile u-boot and our u-boot run in ram now.
Get qemu default gtb for machine virt.
qemu-system-arm -m 1024 -smp 2 -cpu cortex-a15 -M virt,dumpdtb=qemu_arm_virt.dtb
dtc -I dtb -O dts -o qemu_arm_virt.dts qemu_arm_virt.dtb
network:
qemu-system-arm -m 1024 -smp 2 -cpu cortex-a15 -M virt -nographic -drive if=pflash,file=pflash.bin,format=raw -netdev tap,id=mynet0,ifname=mytap0,script=no,downscript=no -device e1000,netdev=mynet0
setup the tftp server: linux little tftp server.
git clone https://github.com/troglobit/uftpd.git
./autogen.sh
./configure
make
src/uftpd -o ftp=0,tftp=10069,pasv_addr=192.168.55.1,writable ../u-boot/
u-boot setup:
setenv ipaddr 192.168.55.2
setenv serverip 192.168.55.1
setenv tftpdstp 10069
saveenv
tftpboot $loadaddr u-uboot.bin
protect off 0 +400000 ==>4M space
erase 0 +400000
cp $loadaddr 0 $filesize
protect on 0 +400000
reset
senenv update_uboot 'tftpboot ${loadaddr} ${serverip}:${tftpfile} && protect off 0 +400000 && erase 0 +400000 && cp $loadaddr 0 ${filesize} && protect on 0 +400000'
saveenv
run update_uboot
mtdparts:
set mtdids and mtdparts:
setenv mtdids 'nor0=nor0'
setenv mtdparts 'mtdparts=nor0:1M(uboot),512K(ubootenv),512K(nvram),1M(uboot2),1M(uboot3),12M(kernel),16M(rootfs)'
saveenv
=> mtdparts
- device nor0
, # parts = 7 - name size offset mask_flags
0: uboot 0x00100000 0x00000000 0
1: ubootenv 0x00080000 0x00100000 0
2: nvram 0x00080000 0x00180000 0
3: uboot2 0x00100000 0x00200000 0
4: uboot3 0x00100000 0x00300000 0
5: kernel 0x00c00000 0x00400000 0
6: rootfs 0x01000000 0x01000000 0
active partition: nor0,0 - (uboot) 0x00100000 @ 0x00000000
defaults:
mtdids :
mtdparts:
浙公网安备 33010602011771号