OK6410A 开发板 (八) 5 linux-5.11 OK6410A kernel 所有镜像的执行效果

  • 结论
objcopy 得到的镜像是可以被 u-boot 加载执行的
	arch/arm/boot/Image
	arch/arm/boot/zImage
	arch/arm/boot/uImage // 相较于 zImage 多了一个uImage头
	
在  https://blog.csdn.net/u011011827/article/details/115380889 中 说明了 
u-boot 镜像可以怎么用 

linux 和 u-boot 是一样的 ,请参考 链接中 的 "文件数据的解析"  

bin-linux 的 00000000 位置 的 32bit 数据 是 b reset 的 二进制码
但是 elf-linux 的 00000 位置 是 elf 格式的格式相关码

当然 如果 u-boot 有加载 并执行 elf 文件的能力的话,应该也可以加载 elf-linux
当然 如果 spl 有加载 elf/xxx 格式 的可执行文件, 应该也可以加载 elf-u-boot xxx-u-boot
linux-5.11 镜像 的生成过程
vmlinux               				-objcopy->   		    			             arch/arm/boot/Image
arch/arm/boot/Image         		-gzip & add arch/arm/boot/compressed/head.S->  	 arch/arm/boot/compressed/vmlinux
arch/arm/boot/compressed/vmlinux  	-objcopy->    				   	                 arch/arm/boot/zImage
arch/arm/boot/zImage        		-mkuboot->     						             arch/arm/boot/uImage
// 大小
7.4M vmlinux							// 参考 镜像vmlinux的执行
8.6M arch/arm/boot/Image				// 参考 镜像Image的执行
2.9M arch/arm/boot/compressed/vmlinux  	// 参考 镜像arch/arm/boot/compressed/vmlinux的执行
2.8M arch/arm/boot/zImage  				// 参考 镜像uImage的执行
2.8M arch/arm/boot/uImage 				// 参考 镜像uImage的执行
镜像uImage的执行
  • 镜像制作
arch/arm/boot/uImage 是 make uImage 过程中 自动生成的
bash ./scripts/mkuboot.sh -A arm -O linux -C none  -T kernel -a 0x50008000 -e 0x50008000 -n 'Linux-5.11.0-00004-g2b88cbadf5c-dirty' -d arch/arm/boot/zImage arch/arm/boot/uImage
  • 镜像加载执行
// 加载 arch/arm/boot/uImage , 并 bootm
bootcmd=tftp 0x50008000 uImage;bootm 0x50008000

// 打印信息
=> tftp 0x50008000 uImage
dm9000 i/o: 0x18000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: e2:7c:ef:97:da:b4
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.10.11.59; our IP address is 10.10.11.120
Filename 'uImage'.
Load address: 0x50008000
Loading: #################################################################
         #################################################################
         #################################################################
         ####
         1 MiB/s
done
Bytes transferred = 2913360 (2c7450 hex)



=> bootm 0x50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00004-g2b88cbadf5c-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2913296 Bytes = 2.8 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 5.11.0-00004-g2b88cbadf5c-dirty (suws@ubuntu) (arm-linux-gnueabi-gcc (Linaro GCC 7.4-2019.02) 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4], GNU ld (Linaro_Binutils-2019.02) 2.28.2.20170706) #44 Fri Apr 16 14:06:43 CST 2021
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d

镜像Image的执行
  • 镜像制作
将 arch/arm/boot/Image 直接 加个 uImage头,生成 arch/arm/boot/uImage2
bash ./scripts/mkuboot.sh -A arm -O linux -C none  -T kernel -a 0x50008000 -e 0x50008000 -n 'Linux-5.11.0-00004-g2b88cbadf5c-dirty' -d arch/arm/boot/Image arch/arm/boot/uImage2
  • 镜像加载执行
// 问题及 问题的解决
=> bootm 0x50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00004-g2b88cbadf5c-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8938664 Bytes = 8.5 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image
Image too large: increase CONFIG_SYS_BOOTM_LEN
Must RESET board to recover
resetting ...
reset... 

// 解决方案
diff --git a/include/configs/ok6410a.h b/include/configs/ok6410a.h
index 2808281..66d1c41 100755
--- a/include/configs/ok6410a.h
+++ b/include/configs/ok6410a.h
@@ -213,5 +213,6 @@
 #undef CONFIG_DEBUG_UART_CLOCK
 #define CONFIG_DEBUG_UART_CLOCK   get_uart_clk(0)
 
+#define CONFIG_SYS_BOOTM_LEN              SZ_64M
 
 #endif /* __CONFIG_H */
=> tftp 0x50008000 uImage2                 
dm9000 i/o: 0x18000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: e2:7c:ef:97:da:b4
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.10.11.59; our IP address is 10.10.11.120
Filename 'uImage2'.
Load address: 0x50008000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########################
         1.2 MiB/s
done
Bytes transferred = 8938728 (8864e8 hex)



=> bootm 0x50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00004-g2b88cbadf5c-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8938664 Bytes = 8.5 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 5.11.0-00004-g2b88cbadf5c-dirty (suws@ubuntu) (arm-linux-gnueabi-gcc (Linaro GCC 7.4-2019.02) 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4], GNU ld (Linaro_Binutils-2019.02) 2.28.2.20170706) #44 Fri Apr 16 14:06:43 CST 2021
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d

不能直接执行的镜像

镜像arch/arm/boot/compressed/vmlinux的执行
bash ./scripts/mkuboot.sh -A arm -O linux -C none  -T kernel -a 0x50008000 -e 0x50008000 -n 'Linux-5.11.0-00004-g2b88cbadf5c-dirty' -d arch/arm/boot/compressed/vmlinux arch/arm/boot/uImage3

=> tftp 0x50008000 uImage3
dm9000 i/o: 0x18000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: e2:7c:ef:97:da:b4
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.10.11.59; our IP address is 10.10.11.120
Filename 'uImage3'.
Load address: 0x50008000
Loading: #################################################################
         #################################################################
         #################################################################
         #########
         1.2 MiB/s
done
Bytes transferred = 2985716 (2d8ef4 hex)
=> bootm 0x50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00004-g2b88cbadf5c-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2985652 Bytes = 2.8 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

data abort
pc : [<50008024>]          lr : [<5ff30e5c>]
reloc pc : [<4fbd8024>]    lr : [<5fb00e5c>]
sp : 5fe2eca0  ip : 00000024     fp : 00000001
r10: 00000001  r9 : 5fe2fee0     r8 : 5fe2eca0
r7 : 00000000  r6 : 50008000     r5 : 5ff6a4e4  r4 : 00000000
r3 : 5fe2ffb0  r2 : 50000100     r1 : 0000065a  r0 : 00000000
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Code: 00000001 00000000 00000034 002d8c5c (05000200) 
Resetting CPU ...

resetting ...
reset... 
镜像vmlinux的执行
bash ./scripts/mkuboot.sh -A arm -O linux -C none  -T kernel -a 0x50008000 -e 0x50008000 -n 'Linux-5.11.0-00004-g2b88cbadf5c-dirty' -d vmlinux arch/arm/boot/uImage4

=> tftp 0x50008000 uImage4
dm9000 i/o: 0x18000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: e2:7c:ef:97:da:b4
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 10.10.11.59; our IP address is 10.10.11.120
Filename 'uImage4'.
Load address: 0x50008000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########
         1.2 MiB/s
done
Bytes transferred = 7743116 (76268c hex)
=> bootm 0x50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00004-g2b88cbadf5c-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    7743052 Bytes = 7.4 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

undefined instruction
pc : [<5000809c>]          lr : [<5ff30e5c>]
reloc pc : [<4fbd809c>]    lr : [<5fb00e5c>]
sp : 5fe2eca0  ip : 00000024     fp : 00000001
r10: 00000001  r9 : 5fe2fee0     r8 : 00000400
r7 : 00000000  r6 : 50008000     r5 : 5ff6a4e4  r4 : 00000000
r3 : 5fe2ffb0  r2 : afff8000     r1 : 0000065a  r0 : 00000000
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
Code: 00000006 00010000 00000001 00530000 (ffff0000) 
Resetting CPU ...

resetting ...
reset... 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值