Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Moving Gentoo to another arch.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 170
Location: Ancient Rome

PostPosted: Mon Oct 03, 2022 1:22 pm    Post subject: Moving Gentoo to another arch. Reply with quote

This is a theoretical question. I had a machine that worked as nas+router, I moved router part to separate machine and now I have the machine that works just as nas. Today, I realized that I could use my Raspberry Pi 4 8GB as nas (similar performance, lower power consumption and noise), but since this is different architecture I would need to reinstall whole system. Is there a way to move Gentoo from amd64 to arm64?
I think, I could run Gentoo on the Raspberry Pi, put Gentoo amd64 into /mnt/gentoo, fix CLAGS in make.conf and run something like this:
ROOT=”/mnt/gentoo” emerge -e @world
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Mon Oct 03, 2022 2:36 pm    Post subject: Reply with quote

lekto,

Like this.

Before you build anything copy over bits of /etc/portage and copy over the world file.
The Pi 4 is quite capable of building for itself but cross distcc can move the heavy lifting to a build farm. The helper arches don't matter.

The mainline kernel is supposed to mostly work on the Pi4 but I've not tried it yet.

When you get to using emerge to update things run
Code:
emerge -e world
so that everything in your old world is rebuilt.
Building on the SD card is bad for the SD card life but a real SATA SSD over USB3 works well.
You can even have trim/discard too.

You may find a few packages not keyword for ~arm64. Feel free to join it the keywording fun :)

There is IRC support in #gentoo-arm. Register your nick to speak.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Mon Oct 03, 2022 4:02 pm    Post subject: Reply with quote

I am curious what Gentoo-amd64 binary provide that Gentoo-arm64 cannot do?

I would imagine copy NAS data portion to pi4 with same path and copy your NAS function's configurations to pi4 that will close enough to begin.
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 170
Location: Ancient Rome

PostPosted: Mon Oct 03, 2022 4:07 pm    Post subject: Reply with quote

tI know how to install Gentoo on Raspberry Pi 4, I did it once using Debian live and chroot like in amd64, I even installed UEFI so I can use grub. This question was about how to do specifically this, I don't want to do this*, but I'm curious how to do this.
I'm talking about changing arch in fully working and configured system so I don't have to configure everything (except kernel and bootloader) from scratch.

PS. I think that method from my post would messed up permissions, if system was installed before acct-group and acct-user.

* I tried 3 different USB to SATA adapters for 2.5" SSDs and all of them after a while started throwing errors about current on USB and system froze. I even modded my RP to allow USB to draw more current, but same result. I could power SSDs from separate PSU and add separate 12V PSU for 3.5" HDD, but this would make it over complicated and more error prone and I don't like to risking my data.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Mon Oct 03, 2022 4:25 pm    Post subject: Reply with quote

I suppose it is possible, (I didn't do it myself) you have build a RPI4 like Neddy suggested first. Once you have a it build and working then add QEMU package to your RPI4. Then you can do as your first post copy everything amd64 to /mnt/gentoo (exclude kernel/initrd) then copy your QEMU's x86_64 user binary in to /mnt/gentoo/usr/bin/ that might do what you asking. Please see more detail in Gentoo/Qemu
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Mon Oct 03, 2022 4:33 pm    Post subject: Reply with quote

lekto,

You could cross compile almost eveything.
The target root would be in
Code:
/usr/aarch64-unknown-linux-gnu/


With a aarch64 qemu static-user and host kernel support you can even chroot and run the arm64 code on the build host.
emerge is a tad slow but it works.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1532

PostPosted: Mon Oct 03, 2022 4:53 pm    Post subject: Reply with quote

While you can salvage a lot of your configuration, you can't salvage any of your binaries. In essence this is going to be a new installation. If you're familiar with the process of installation and portage, you're going to be able to figure out almost everything on the go. For example you can grab your existing world file and edit out some arch dependent packages right away. Having both systems side by side is going to be a huge convenience for you. Expect it to take more time than you think it will, should you decide to attempt it.

Regards,
Georgi
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Mon Oct 03, 2022 5:53 pm    Post subject: Reply with quote

logrusx,

Portage should catch the arch dependent binaries as they won't be keyworded.
Some -bins will be fine as they support multiple arches.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1532

PostPosted: Mon Oct 03, 2022 6:37 pm    Post subject: Reply with quote

NeddySeagoon wrote:
logrusx,

Portage should catch the arch dependent binaries as they won't be keyworded.
Some -bins will be fine as they support multiple arches.


When I said binaries, I meant packages built from source. And yes, I know there are exceptions, but in this case they wont't make much of a difference.

The above I said from experience and it wasn't even changing architectures. It was just moving from and old Intel to a new AMD. I believe it would be a bit more complicated when you move from amd64 to arm64...

But in essence that would be a new installation, is that correct?

Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum