tornewuff / pycorn

An interpreted operating system written in Python.
GNU General Public License v3.0
66 stars 13 forks source link

Issue when creating u-boot script #8

Open nagos opened 6 years ago

nagos commented 6 years ago

I use mkimage.py to create boot stcipt for arm platform (unrelated to pycorn).

Mkimage from Ubuntu 16.04 mkimage -A arm -O linux -T script -C none -n "bootscript" -d boot.script u-boot.scr

00000000  27 05 19 56 18 76 24 35  5b 89 19 25 00 00 00 48  |'..V.v$5[..%...H|
00000010  00 00 00 00 00 00 00 00  75 42 39 3a 05 02 06 00  |........uB9:....|
00000020  62 6f 6f 74 73 63 72 69  70 74 00 00 00 00 00 00  |bootscript......|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 40 00 00 00 00  31 31 31 31 31 31 31 31  |...@....11111111|
00000050  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000060  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000070  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000080  31 31 31 31 31 31 31 0a                           |1111111.|
00000088

mkimage.py python mkimage.py -A arm -O linux -T script -C none -n "bootscript" -d boot.script u-boot.scr

00000000  27 05 19 56 94 43 04 e9  5b 89 19 0b 00 00 00 40  |'..V.C..[......@|
00000010  00 00 00 00 00 00 00 00  fb fa 04 76 05 02 06 00  |...........v....|
00000020  62 6f 6f 74 73 63 72 69  70 74 00 00 00 00 00 00  |bootscript......|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000050  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000060  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 31  |1111111111111111|
00000070  31 31 31 31 31 31 31 31  31 31 31 31 31 31 31 0a  |111111111111111.|
00000080

Look like mkimage.py skips length and some padding.

I fixed it for my project, but not tested it thoroughly c1f634e6c75ebdac92c7665389b2832c30603afa.