OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:24 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Tue Jun 01, 2021 11:14 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
kzinti wrote:
ssjcoder wrote:
I have no idea what "lib gcc" even is.

Remove "-lgcc", that's telling gcc to link libgcc in your binrary.

It's actually telling it to link in used functions from the library - very different from linking in the whole library.


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Tue Jun 01, 2021 6:07 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
Octocontrabass wrote:
It's required for code compiled by GCC.

Yes that's the theory. In practice I would suggest removing it here and see what happens. libgcc is rarely if ever needed in a baremetal environment. The only one I've hit so far is for 64 bits divisions on ia32 (which can easily be avoided if such is one's desire).

Octocontrabass wrote:
Probably not. The linker is smart enough to discard the unused parts of libgcc, which should be most of it.

iansjack wrote:
It's actually telling it to link in used functions from the library - very different from linking in the whole library.

Indeed. And removing libgcc from the picture could show us unresolved dependencies and move us further along with solving the problem. Right now we do not know if any parts of libgcc is used.

In my experience libgcc is simply not needed here and removing it could help narrow down the problem space. If it isn't the culprit and is indeed needed here, it can always be added back.

What's more, linking libgcc without a cross-compiler is simply wrong and strictly worst than not linking with it. But I see the OP just moved to a cross-compiler.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Wed Jun 02, 2021 9:58 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
Thanks guys I will try more tinkering this week if I have time, also, I started topic here: https://www.raspberrypi.org/forums/view ... 2&t=313020

Someone said I might have bad checksum.

IDK how to go from here if I can't boot any images tbh, will try a few things including removing "-lgcc" and post back here.

--thanks for all the help


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu Jun 03, 2021 6:18 pm 
Offline
Member
Member

Joined: Sun Aug 23, 2020 4:35 pm
Posts: 148
Alright, one more thing.
ssjcoder (raspberrypi.org) wrote:
However, I can't seem to be able to boot into images, like example, from here: https://github.com/PeterLemon/RaspberryPi
Example, I tried copying kernel8.img from here: https://github.com/PeterLemon/Raspberry ... rot/Double
and it just doesn't go past rainbow screen.
What am I doing wrong?

Have you tried copying ALL the kernel files: kernel.img, kernel7.img, kernel8.img? I realize kernel8.img is the one that the Pi 3 should load, but just in case, try all of them.
Did you make sure you had bootcode.bin and start*.elf files? These files are necessary for the Pi to boot as well.

I don't know what they are talking about with checksums (other than perhaps ELF, but that would be a bug in your code). Maybe it is something with the new Raspberry Pi 4 EEPROM firmware, but I don't think the RPi3 is affected.

_________________
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu Jun 03, 2021 10:12 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
foliagecanine wrote:
Alright, one more thing.
Have you tried copying ALL the kernel files: kernel.img, kernel7.img, kernel8.img? I realize kernel8.img is the one that the Pi 3 should load, but just in case, try all of them.
Did you make sure you had bootcode.bin and start*.elf files? These files are necessary for the Pi to boot as well.

I don't know what they are talking about with checksums (other than perhaps ELF, but that would be a bug in your code). Maybe it is something with the new Raspberry Pi 4 EEPROM firmware, but I don't think the RPi3 is affected.


Thanks, I managed to make it boot from kernel7.img, but this time I made sure to have all the firmware files from https://github.com/raspberrypi/firmware except ".img" files.

Also I made sure to have the "config.txt" properly configured with:
Code:
kernel_old=1
disable_commandline_tags=1
disable_overscan=1
framebuffer_swap=0


I tried messing around with my compiler and it just isn't booting at all (still stuck at rainbow screen).

So, one problem fixed, I can boot into custom kernel7.img, but now I gotta fix my own kernel7.img.

I might just end up using FASMARM once I get my main (Windows 7) machine back if there's no fix on this GCC issue.

--I am open to trying GCC alternatives as long as you know how to configure them for my specific Raspberry PI 3B + device, and you know the exact steps to install required stuff without any fuss, any dependencies/etc (also no building should be required), preferably just one command as I am *not* a linux veteran. (using linux only out of necessity right now)


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sun Jun 06, 2021 5:38 pm 
Offline
Member
Member
User avatar

Joined: Sun Apr 30, 2017 12:16 pm
Posts: 68
Location: Poland
kzinti wrote:
Yes that's the theory. In practice I would suggest removing it here and see what happens. libgcc is rarely if ever needed in a baremetal environment. The only one I've hit so far is for 64 bits divisions on ia32 (which can easily be avoided if such is one's desire).


Since GCC 10, on aarch64, you need libgcc for basically all __atomic builtins. Using the builtins generates calls to new functions that either implement the atomic op with LDXR/STXR or with new the LSE instructions if they're supported. I'm not entirely sure how it's detected, and if it always involves a branch, but as far as I can tell, you can't tell it to emit LDXR/STXR directly, not without some more involved GCC patching than adding "t-lse t-slibgcc-libgcc" (the latter being needed for libstdc++ to link properly against libgcc.a) to libgcc's configure.host's tmake_file list in your target.

EDIT: actually, you can disable LSE support and make GCC use LDXR/STXR unconditionally with "-mno-outline-atomics", my bad.

_________________
Working on managarm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 6 hours


Who is online

Users browsing this forum: Octocontrabass and 81 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group