Hi, On 1/5/26 17:47, Sascha Hauer wrote: > On Mon, Jan 05, 2026 at 03:08:03PM +0100, Ahmad Fatoum wrote: >> Hi, >> >> On 1/5/26 12:26 PM, Sascha Hauer wrote: >>> Until now we linked the raw barebox proper binary into the PBL which >>> comes with a number of disadvantages. We rely on self-modifying code >>> to in barebox proper (relocate_to_current_adr()) and have no initialized >>> bss segment (setup_c()). Also we can only mark the .text and .rodata as >>> readonly during runtime of barebox proper. >>> >>> This series overcomes this by linking a ELF image into the PBL. This >>> image is properly layed out, linked and initialized in the PBL. With >>> this barebox proper has a proper C environment and text/rodata >>> protection from the start. >>> >>> As a bonus this series also adds initial MMU support for RISCV, also >>> based on loading the ELF image and configuring the MMU from the PBL. >>> >>> This series also marks my start into AI assisted programming as you can >>> see in the Co-Authored-By: Claude Sonnet 4.5 <[email protected]> >>> and 🤖 Generated with [Claude Code](https://claude.com/claude-code) >>> tags. Without it I wouldn't have started this series during my xmas >>> break, but with it it was actually quite fun to do; it felt like having >>> a programming team which I just had to delegate new tasks to while >>> having fun with my family myself ;) >> >> Did you do size comparisons to determine how much this series affects >> binary size? I found that compressing every segment separately resulted >> in a smaller binary size even after addition of ELF parsing to PBL, but >> I used a purpose-built ELF loader unlike to what you did here. > > I did now. > > ARM64 barebox-dt-2nd.img raw: 1246506 > ARM64 barebox-dt-2nd.img ELF: 1248892 (+ 2386 bytes) > ARM32 barebox-dt-2nd.img raw: 1217036 > ARM32 barebox-dt-2nd.img ELF: 1219159 (+ 2123 bytes) > > With --strip-section-headers instead of --strip-debug --strip-unneeded > the last image goes down to 1217940 bytes, so only 904 bytes size > increase.
Is the raw image from before the series was applied, so we can judge the total size increase? I redid tests for my series, but this time in the same build directory and got values similar to yours: ARM64 barebox-dt-2nd.img before: 992276 ARM64 barebox-dt-2nd.img after: 993029 (+ 753 bytes) Previous measurement of ELF compression being smaller must have been a mistake it seems. Cheers, Ahmad > > Sascha > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
