Quantcast
Channel: Linux Device Hacking - uBoot
Viewing all articles
Browse latest Browse all 923

Boot vmlinuz / zImage (no replies)

$
0
0
Hi.
This year I cleaned up my old stuff and tried to sell my Dockstars, NSA320 and Zyxel NAS LSGL, but before doing so I wanted to get the to Debian 12/13. And it's great you guys are keeping these systems alive. I did try using the debian installer with serial console and I managed it.

But for the NSA320 I had to select a kernel manually and it didn't install the mkimage stuff, so I tought why not boot the regular stuff via uboot. But it seems while vmlinuz is supported, zImage is not. The only difference between zImage und uImage is a 64 byte header, which is just some crcs and flags and stuff, so I thought why not do it in uboot?! I did manage to do so, it's not very versatile, working on fixed addresses (because of little / big endian conversion), but hey, maybe one of you finds it helpful!

bootcmd_raw=if run load_dtb; then if run load_vmlinuz; then if run load_zimage; then bootz $load_uimage_addr $load_initrd_addr:$filesize $load_dtb_addr; fi; fi; fi
dtb_file=/boot/dts/kirkwood-nsa320.dtb
load_dtb_addr=0x2c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_vmlinuz=echo loading vmlinuz ...; load $bootdev $device $load_uimage_addr /boot/vmlinuz
load_zimage=echo loading initrd.img ...; if load $bootdev $device 0x1100040 /boot/initrd.img; then run zimage_make; md.b 0x1100000; fi
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
# create mkimage 64 byte header on the fly:
# magic, crc header, time, size, load addr, entry point, crc image, flags, name
# note: header crc is calculated over header w/ header crc set to 0
# https://hackmd.io/@TomasZheng/SkLpND6CL
zimage_make=mw.b  0x1100000 0 0x40; run zimage_size; run zimage_icrc; run zimage_head; run zimage_hcrc; run zimage_head; setexpr filesize $filesize + 0x40
zimage_size=mw.l  0x1100000 $filesize; cp.b 0x1100003 0x110000c 1; cp.b 0x1100002 0x110000d 1; cp.b 0x1100001 0x110000e 1; cp.b 0x1100000 0x110000f 1
zimage_head=mw.l  0x1100000 0x56190527; mw.l 0x110001c 0x1030205; mw.l 0x1100020 0x756e694c; mw.b 0x1100024 0x78
zimage_icrc=crc32 0x1100040 $filesize 0x1100000; cp.b 0x1100003 0x1100018 1; cp.b 0x1100002 0x1100019 1; cp.b 0x1100001 0x110001a 1; cp.b 0x1100000 0x110001b 1
zimage_hcrc=crc32 0x1100000 0x40 0x1100000; cp.b 0x1100003 0x1100004 1; cp.b 0x1100002 0x1100005 1; cp.b 0x1100001 0x1100006 1; cp.b 0x1100000 0x1100007 1

This code basically creates the CRC for the initrd, then sets the flags (for linux / gzip) / fixed strings, creates the CRC for the completed header and that's it.

I still have the dockstars left where this would work as well, but as I said I am kinda done with them, I am out, so that's just a small parting gift.

Viewing all articles
Browse latest Browse all 923

Latest Images

Trending Articles



Latest Images