- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个“闪烁”脚本正在通过 sdp 从主机 PC 加载到 iMX6 上的 Uboot。脚本已运行完毕mkimage
,所以它有一个图像标题。这是 mkimage 命令:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "U-Boot script" -d $files_dir$flash_txt $files_dir$flash_scr
我可以用
binwalk
解析标题:
$ binwalk -B flash.scr
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 uImage header, header size: 64 bytes, header CRC: 0x315E128A, created: 2021-09-13 14:52:46, image size: 2406 bytes, Data Address: 0x0, Entry Point: 0x0, data CRC: 0x7B909BAE, OS: Linux, CPU: ARM, image type: Script file, compression type: none, image name: "U-Boot script"
它无法执行,uboot 显示“Bad Header CRC”。因此,我试图至少在设备上通过使用内置的 crc32 工具在现场更正 CRC 来强制它工作。它仍然行不通。
0x10100000
之后):
# display the script bytes
md 0x10100000
# reset the crc
mw 0x10100004 0x0 1
# verify the change
md 0x10100000
# recalc the crc
crc32 0x10100000 64
# write the crc
#mw 0x10100004 <VALUE> 1
# example:
mw 0x10100004 0x3a833d99 1
# run the script
source 0x10100000
当我这样做时,我仍然收到可怕的“Bad Header CRC”错误!
...
Bad header crc
CTRL+C - Operation aborted.
SDP ended
uboot# md 0x10100000
10100000: 56190527 229a2e76 f4f64161 66090000 '..Vv.."aA.....f
10100010: 00000000 00000000 0533a380 00060205 ..........3.....
10100020: 6f422d55 7320746f 70697263 00000074 U-Boot script...
10100030: 00000000 00000000 00000000 00000000 ................
10100040: 5e090000 00000000 20766e65 61666564 ...^....env defa
10100050: 20746c75 2d20662d 65730a61 766e6574 ult -f -a.setenv
10100060: 7a697320 79625f65 685f6574 725f7865 size_byte_hex_r
10100070: 66746f6f 33352073 35453937 65730a41 ootfs 5379E5A.se
10100080: 766e6574 7a697320 6c625f65 5f6b636f tenv size_block_
10100090: 5f786568 746f6f72 32207366 30444239 hex_rootfs 29BD0
101000a0: 7465730a 20766e65 657a6973 7479625f .setenv size_byt
101000b0: 65685f65 62755f78 20746f6f 30433337 e_hex_uboot 73C0
101000c0: 65730a30 766e6574 7a697320 6c625f65 0.setenv size_bl
101000d0: 5f6b636f 5f786568 6f6f6275 39332074 ock_hex_uboot 39
101000e0: 730a0a45 6e657465 6f722076 7366746f E..setenv rootfs
101000f0: 6c5f615f 6c656261 6f722220 7366746f _a_label "rootfs
uboot# mw 0x10100004 0x0 1
uboot# crc32 0x10100000 0x40 0x10100004
crc32 for 10100000 ... 1010003f ==> 94926f83
uboot# md 0x10100000
10100000: 56190527 836f9294 f4f64161 66090000 '..V..o.aA.....f
10100010: 00000000 00000000 0533a380 00060205 ..........3.....
10100020: 6f422d55 7320746f 70697263 00000074 U-Boot script...
10100030: 00000000 00000000 00000000 00000000 ................
10100040: 5e090000 00000000 20766e65 61666564 ...^....env defa
10100050: 20746c75 2d20662d 65730a61 766e6574 ult -f -a.setenv
10100060: 7a697320 79625f65 685f6574 725f7865 size_byte_hex_r
10100070: 66746f6f 33352073 35453937 65730a41 ootfs 5379E5A.se
10100080: 766e6574 7a697320 6c625f65 5f6b636f tenv size_block_
10100090: 5f786568 746f6f72 32207366 30444239 hex_rootfs 29BD0
101000a0: 7465730a 20766e65 657a6973 7479625f .setenv size_byt
101000b0: 65685f65 62755f78 20746f6f 30433337 e_hex_uboot 73C0
101000c0: 65730a30 766e6574 7a697320 6c625f65 0.setenv size_bl
101000d0: 5f6b636f 5f786568 6f6f6275 39332074 ock_hex_uboot 39
101000e0: 730a0a45 6e657465 6f722076 7366746f E..setenv rootfs
101000f0: 6c5f615f 6c656261 6f722220 7366746f _a_label "rootfs
uboot# source 0x10100000
## Executing script at 10100000
... SUCCESS!!!!!
预上传 PC 补丁
# The mkimage "header CRC" is invalid for some reason, so it needs to be corrected!
$files_dir=files/
$flash_scr=flash.scr
$flash_hdr=flash.hdr
chmod 644 $files_dir$flash_scr
# zero the current crc, and copy the 64 byte header to a separate file
printf '\x00\x00\x00\x00' | dd of=$files_dir$flash_scr bs=1 seek=4 count=4 conv=notrunc
head -c 64 $files_dir$flash_scr > $files_dir$flash_hdr
# calculate the correct crc
crc=$(crc32 $files_dir$flash_hdr)
b1=$(echo $crc | cut -c 1,2)
b2=$(echo $crc | cut -c 3,4)
b3=$(echo $crc | cut -c 5,6)
b4=$(echo $crc | cut -c 7,8)
# update the script, with the correct value
printf "\x${b1}\x${b2}\x${b3}\x${b4}" | dd of=$files_dir$flash_scr bs=1 seek=4 count=4 conv=notrunc
# clean up
rm $files_dir$flash_hdr
mkimage 的根本缺陷
最佳答案
What am I doing wrong?
0x...
前缀实际上是多余的。 AFAIK 无法输入十进制值。
# recalc the crc
crc32 0x10100000 64
crc32
中指定标题的长度时命令为
64
,您指定了不正确的( header )长度 0x64 或十进制 100。
=> crc32 0x10100000 64
CRC32 for 10100000 ... 10100063 ==> 9988c6ca
0x10100000 到 0x10100063 的地址范围是 100 字节的跨度。
# write the crc
#mw 0x10100004 <VALUE> 1
mw
中以反向字节顺序指定(假设 i.MX6 为小端模式)。命令。
d8bc0e3a
3a0ebcd8
在第二个字中(以小端顺序):
=> md 20000000
20000000: 56190527 3a0ebcd8 a0284161 1f000000 '..V...:aA(.....
20000010: ...
=> imi 20000000
## Checking Image at 20000000 ...
Legacy image found
Image Name: U-Boot script
Image Type: PowerPC Linux Script (uncompressed)
Data Size: ...
将第二个字归零后,CRC32 命令产生(相同)值(如预期)(但作为 4 字节字符串而不是整数):
=> crc32 20000000 40
crc32 for 20000000 ... 2000003f ==> d8bc0e3a
如果您使用
mw
从字面上安装此值命令,则字节顺序不是 32 位字值所需的顺序。
=> mw 20000004 d8bc0e3a
=> md 20000000
20000000: 56190527 d8bc0e3a a0284161 1f000000 '..V:...aA(.....
20000010: ...
=> imi 20000000
## Checking Image at 20000000 ...
Legacy image found
Bad Header Checksum
=>
mw
命令将要写入的值视为
byte string
而不是整数值整数值,因此不执行字节重新排序(即使这是一个小端 CPU),需要对 CRC32 值进行字节重新排序。
md
假设存储的值处于小端模式,命令正在显示字值。
md.b
命令。
=> md 20000000 4
20000000: 56190527 3a0ebcd8 a0284161 1f000000 '..V...:aA(.....
=> md.b 20000000 10
20000000: 27 05 19 56 d8 bc 0e 3a 61 41 28 a0 00 00 00 1f '..V...:aA(.....
=>
3a0ebcd8
在第二个字中(以小端顺序)。
mw
命令知道这是一个小端 CPU,并且确实将要写入的值视为整数值。
byte string
(而不是整数值),这些字节必须使用
mw
重新排序以供输入命令。
crc32
命令,并且计算出的值将以正确的顺序为您存储,例如
crc32 0x10100000 0x40 0x10100004
关于U-boot 脚本坏头 CRC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69169297/
我制作了一个简单的 Chrome 扩展程序,可以自动将我带到我正在观看的系列节目的下一集。只是要清楚:代码有效! :p 但是,由于对 Chrome API 的调用大部分是异步的,我不得不将函数分成 3
在发布此问题之前,我尝试了在 Android 部分找到的所有答案,但均未成功... 由于某种原因,设备中的图像质量很差,而 Eclipse 和虚拟设备中的图像质量非常好 查看屏幕截图示例: examp
我想在一个小型机器集群(尽可能小)上支持大约 10,000 个并发 HTTP 客户端。我想在用户使用应用程序时与每个客户端保持连接,以允许服务器推送更新。 我相信异步 IO 通常被推荐用于这些类型的长
基本上,当我在 Eclipse 上自动完成(按 CTRL+Space)时,程序会滞后大约 5 秒。这真的很烦人,因为我经常使用自动完成功能。我该如何解决这个问题? 我正在处理的工作区位于具有 1Gbi
在我的模式中,我已经规范化了我的数据库并且到处都有 FK,因为社交网络中有如此多的链接关系,尤其是将用户链接到所有内容。 现在很明显,在社交网络中,性能会成败。这意味着“读取”时间比“写入”时间更重要
我有一个名为 globals.swift 的文件 代码很简单,看起来像这样。 import Foundation import CoreData import UIKit var g_workOrde
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
偶然发现了一个计算数字平方根的(糟糕的)算法。陷入了关于时间复杂度的小争论。我断言时间复杂度是 O(n^2) 因为对于 n 个输入,它将被乘以 n 次。我的 friend 断言时间复杂度实际上是 O(
这是一个一般性的问题,但为了解释它,我将使用一个具体的例子。 我有一个加载文档的函数。如果该文档不存在,它将创建它,如果它存在,它将把它转换为一个 JSON 数组。我总是希望此函数返回某种数组,无论
我要找 坏 使用继承的例子。我不是很有创意,所以这是我能想到的最好的: class Car : public Engine {} 汽车有发动机,但它不是发动机。 这可能有助于解释这个概念,但我相信还有
我很好奇......在内存缓存中使用压缩有什么优点/缺点吗? 最佳答案 许多客户端进行压缩,但服务器本身没有进行压缩。 客户端压缩意味着通过网络发送的数据更少,但更重要的是,单个对象更小。较小的物体可
我正在尝试将 OpenGL 渲染封装在渲染器类中。 我很确定我的窗口类工作正常(我检查了错误),但我认为错误在我的 Sprite 类中,但我不知道它是什么。 这是我的 Sprite 类: sprite
max(M,N,M):-M >= N,!. max(M,N,N). 我正在读一本教科书,说陈述性和程序性含义不同...我不知道该怎么做。 有人可以指出我正确的方向吗? 最佳答案 tl; dr:这不是关
我在线性回归模型上使用留一交叉验证。拥有 8869 个观察结果,原因如下: reg = LinearRegression() list_Rs = cross_val_score(reg, X_34_c
我在想....我有一个网站,其中正在进行大量搜索/排序。如果我将每次搜索的结果项 ID 缓存到 MEMORY 表中,然后简单地执行 WHERE item_id IN ("1", "5", "44",
我有一个 adopted为 Silverlight 实现一个简单的(无升级或超时)ReaderWriterLock,我想知道任何具有适当专业知识的人都可以验证它的设计是好是坏。对我来说它看起来很不错,
这是我在单击按钮时删除所选项目的代码,我在此代码中添加了警报对话框,添加此警报框后,发生 fatal error 异常。 public class MycustomAdapter extends B
我正在从 MySQL 数据库中获取数据。结果在对象中返回。 然后我可以像这样访问数据: $db_data->row 在 foreach 循环中,我通过添加一个数组来更改 $db_data,例如: fo
在我完成的几个 .NET C# web 服务项目中,我已经在单例模式的帮助下访问了静态数据库。然后前几天我的 friend 告诉我这是一件坏事,因为如果对同一个数据库实体发出大量请求,那么数据库将因为
在类的构造函数中进行数据库查询以便在创建类的新实例时加载它是否是一种不好的做法? class Home { private $home_id = null; private $home
我是一名优秀的程序员,十分优秀!