Forum Discussion
Altera_Forum
Honored Contributor
20 years agoU-BOOT !!!!!!!!!!!!
Hi http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wacko.gif , that u-boot is really driving me crazy. This is what I've done: 1- Compiled u-boot (got the .bin and the .srec)...
Altera_Forum
Honored Contributor
20 years agoHi MFM,
Ok, so I finally had a chance to review the buildroot scripts, etc. Here's what I believe is going on: 1. First, there are two elf files created. This is not unusual -- one is the kernel elf vmlinux. The other is the compressed kernel elf (zImage). The zImage is in the boot/compressed tree. 2. **Important** -- the zImage head.S is _not_, repeat _not_ coded to relocate itself. So you __MUST__ use the exact load address for this -- or add the relocation code. 3. The .text VMA of the zImage defaults to 0080_0000 above the .text VMA for the vmlinux. You can change this with the BOOT_LINK_OFFSET configuration option. So, here's what you have to do: 1. Use the zImage (the elf from the boot/compressed tree) and create a binary. The binary should be passed to mkimage with compression 'none' and the load and entry point addresses 0080_0000 above your ram base. In your case this should be 0180_0000. mkimage would look like: $ mkimage -C none -e 0x01800000 -a 0x01800000 -d zImage.bin <<other parameters>> 2. Use the vmlinux (not from the boot/compressed tree) and create a binary. Compress the binary (e.g. vmlinux.bin.gz). Pass the compressed binary to mkimage with compression 'gzip'. Set the load and entry point addresses to some valid address in ram (the kernel can relocate itself). But since u-boot will be decompressing, you might as well set the load/entry addresses to the actual VMA: 0x0100_0000: $ mkimage -C gzip -e 0x01000000 -a 0x01000000 -d vmlinux.bin.gz <<other parameters>> ================================================================ Just to review, so everyone knows where the problem is: The zImage does _not_ relocate itself. Setting the load/entry address to anything other than the correct VMA will cause the zImage to jump into the weeds. And, there's no need to compress a zImage -- it's already compressed -- so don't tell u-boot that it is. You can satisfy yourself that this is the case: use nios2-console, but load the binary to address 0x018000000 and it should work. Regards, --Scott