raspberry-pi-os icon indicating copy to clipboard operation
raspberry-pi-os copied to clipboard

[Lesson04] Raspberry Pi 4 Model B Make error

Open jeremypbrien opened this issue 4 years ago • 4 comments

After changing the PBASE to 0xFE000000 for the raspberry pi 4 model B, I get the following error when running make:

build/boot_s.o: in function 'el1_entry': (.text.boot+0x44): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol 'bss_end' defined in .bss section in build/kernel8.elf make: *** [Makefile:30: kernel8.img] Error 1

Lessons 1-3 work, but all other lessons are getting this error. Is there a workaround to make these lessons work for the raspberry pi 4 model B?

jeremypbrien avatar Nov 29 '20 00:11 jeremypbrien

Try changing this line: https://github.com/s-matyukevich/raspberry-pi-os/blob/master/src/lesson04/src/boot.S#L41 It should be: mov sp, #LOW_MEMORY

Not sure why lesson04 changed it since lesson05 still has it using #LOW_MEMORY

rockytriton avatar Dec 01 '20 23:12 rockytriton

I got the same error, and I don't know what I should do. I already tried to add #LOW_MEMORY, but that doesn't change anything. It could be because #LOW_MEMORY is the same as #(2 * SECTION_SIZE).

maxstreitberger avatar Jul 10 '21 12:07 maxstreitberger

Hi, I got the same error, and found that in my case the line static unsigned short mem_map [ PAGING_PAGES ] = {0,}; in mm.c causes the bss section to be too large, exceeding the pc-relative addressing limit in the line adr x1, bss_end in boot.S. I changed mem_map's type to uint8_t and it compiled successfully. Caution this may not be the exact cause of your compilation error because I have set my LOW_MEMORY and HIGH_MEMORY differently (0x40000000 to 0xFC000000).

rhythm16 avatar Aug 11 '21 07:08 rhythm16

About this problem,we can use size cmd to check build/*.o file .bss section whether size is normal. for my problem, i foundmm_c.o .bss section size is too big , which means uninit var is too big

cuijier avatar Jun 09 '22 07:06 cuijier