Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
chrooting into arm64 from amd64
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 03, 2020 8:41 am    Post subject: chrooting into arm64 from amd64 Reply with quote

Since I read Sakaki's anouncement of EOL for genpi64 two days ago,
well, for noob like me it spelled dissaster.
But NeddySeagoon showed me some links:
turns out there is a way.

So I was up late last night,
following instructions from here: https://wiki.gentoo.org/wiki/Raspberry_Pi_3_64_bit_Install
(linked from following this link: https://wiki.gentoo.org/wiki/Raspberry_Pi4_64_Bit_Install)
and I got stucked chrooting:
Code:
# chroot /mnt/gentoo /bin/bash
chroot: failed to run command ‘/bin/bash’: Exec format error

I searched 'net a bit, turns out error is for different arhitectures,
I am working (over ssh from mu genpi64, tmuxed) on my amd box machine, which is amd64, and I am trying to chroot into arm64, as I gathered.
There were some mentioning of working from "outside",
so how can I do that?

Thank you.
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
lperkins2
n00b
n00b


Joined: 18 Apr 2014
Posts: 14

PostPosted: Tue Nov 03, 2020 8:59 am    Post subject: Reply with quote

You need something that provides "instruction set translation". The only way to do that (of which I am aware) for arm to x86 is qemu-user-mode.

You need to emerge app-emulation/qemu with QEMU_USER_TARGETS="arm aarch64" (or whatever instruction set you want to support).

Then you need to register the instruction set translator with binfmt (which can probably be done via `/etc/init.d/binfmt start`), or by echoing the right magic value into `/proc/sys/fs/binfmt_misc/register`

Then chroot should work as desired. Note that there is a substantial speed penalty for instruction set translation, especially in JITted code, but still worth doing.

Also, since you're here due to Sakaki's announcement, be sure to check out my reply to that topic.
Back to top
View user's profile Send private message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 03, 2020 12:08 pm    Post subject: Reply with quote

Hello lperkins2!

ah, i see, i have app-emulation/qemu installed on my amd64,
but the thing is, i was wondering where could i get arm64 bit machine,
and it dawned on me that i am stupid, since i have one under my nose.

so i ripped micro sd card from pc and pluged it into genpi64, mounted card and system folders, and chrooted with no problem.
unfortunately i was hoping the genpi64 will send builds over to pc, since i have cross thingy for helping compileing, but alas, i hit enter and now, for over 3 hours now, updating....

So i guess later in the evening i can proceed,
but for now, do I need grub part of install (amd64 handbook)?
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Nov 03, 2020 12:20 pm    Post subject: Reply with quote

while true,

Grub is not used us the Pi.

The Pi4 has firmware that reads all the files needed to boot from the /boot partition.
genup is no more, at least, for a while.
_________________
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
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 03, 2020 12:25 pm    Post subject: Reply with quote

got it, no grub.
i knock on the wood, so far so good, but still far from booting.
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
lperkins2
n00b
n00b


Joined: 18 Apr 2014
Posts: 14

PostPosted: Tue Nov 03, 2020 5:28 pm    Post subject: Reply with quote

while true wrote:
Hello lperkins2!

ah, i see, i have app-emulation/qemu installed on my amd64,
but the thing is, i was wondering where could i get arm64 bit machine,
and it dawned on me that i am stupid, since i have one under my nose.

so i ripped micro sd card from pc and pluged it into genpi64, mounted card and system folders, and chrooted with no problem.
unfortunately i was hoping the genpi64 will send builds over to pc, since i have cross thingy for helping compileing, but alas, i hit enter and now, for over 3 hours now, updating....

So i guess later in the evening i can proceed,
but for now, do I need grub part of install (amd64 handbook)?


You will need to tell the Pi *how* to ask the amd64 machine for help. If you have a cross compiler set up on the amd64 machine, you can make it available via distcc, and then enable distcc on the Pi (or if you have multiple Pis, you can set them up to help each other). I've never had good experiences with cross-distcc, so I've taken to using distcc inside a qemu-user chroot.

I'm afraid I don't quite know what you're trying to do... my advice for a new install would be slightly different than my advice for maintaining an install.

As for grub, you don't need it; the Pi firmware has its own bootloader, which is quite esoteric. The instructions on the GenPi64 github page still work for building a custom kernel, if that is one of your goals.
Back to top
View user's profile Send private message
while true
Guru
Guru


Joined: 07 Apr 2010
Posts: 532
Location: Ljubljana, Slovenia

PostPosted: Tue Nov 03, 2020 7:57 pm    Post subject: Reply with quote

Quote:
I'm afraid I don't quite know what you're trying to do...

like i know where i am going or stepping on,
i have general aim: gentoo on rpi,
well i guess it is qute specific.

I am using my existing genpi64 to chroot into micro cd card, since they both have the same arhitecture.
but it is still updating... looks like it it will do so until tommorow.

from there, i will follow adm64 handbook,
I am at installing the base system,
so ahead kernel, system and tools,
and i will skip grub.

than i'll try to boot from micro sd card plugged into usb adapter, plugged into rpi,
I will cry or jump of joy.

if cry /then goto 10 /else try to move from micro sd card to ssd.

how does that sound?

EDIT:
ah, if you assume i know more than copy and paste you would be wrong my friend, i am eternal noob.
_________________
Kind regards, Goran Mitic

alive
while true
kick ass
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Nov 03, 2020 10:32 pm    Post subject: Reply with quote

while true,

USB booting on the Pi4 is fairly newish.
Check that your Pi4 firmware is up to date.
_________________
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
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM 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