Op 17 apr. 2013, om 20:19 heeft Lennart Poettering <lenn...@poettering.net> het 
volgende geschreven:

> On Mon, 08.04.13 22:09, Askar Safin (safinas...@mail.ru) wrote:
> 
>> 
>>> I'm not sure what problem the proposal is trying to solve.  Maybe it'd
>>> be clearer if that was provided.
>> I want to know what is the arches of the systems on my computer. I. e. I 
>> want to do the following:
>> 
>> for DISK in /dev/sd*; do
>>  mount "$DISK" /mnt
>>  source /mnt/etc/os-release
>>  echo "Arch of $DISK is $ARCH"
>> done
>> 
>> And I want to use this $ARCH to do "setarch", i. e.:
>>  mount /dev/some-dev /mnt
>>  source /mnt/etc/os-release
>>  setarch "$ARCH" chroot /mnt
>> So, this /mnt system will see "uname -m" output which is meaningful for the 
>> system.
> 
> My suggestion would be to write a little tool that does the equivalent
> to this:
> 
> readelf -h /usr/lib*/libdl*.so | grep Machine | cut -c38- | uniq
> 
> This will list you the architectures for which you have dynamic loaders
> installed. Since the dynamic loaders are hardcoded in all dynamic ELF
> binaries this list will tell you binaries of which archs you can execute
> on your system.

On my i7 laptop:

[koen@rrMBP mplayer2]$ readelf -h /usr/lib*/libdl*.so | grep Machine | cut 
-c38- | uniq
Advanced Micro Devices X86-64
Intel 80386

And on a cortex A8 device:

root@beaglebone:~# readelf -h /usr/lib*/libdl*.so | grep Machine | cut -c38- | 
uniq
ARM

So it returns something that could be considered usefull on my laptop, but the 
output on the beaglebone is useless. On ARM you need to know the following to 
see if you can execute the binary:

1) instruction set revision (armvX, e.g. armv5te, armv6, armv7a)
2) OABI or EABI
3) floating point calling conventions, softp vs hardfp

The first item is like i386, i486 etc. It's compatible only one way. The second 
is academical at this point, only luddites running kernel 2.4 are interested in 
OABI.
And then we get to the clusterfuck, floatingpoint ABI. I need to install 
binutils on my hardfloat system to see if that also says 'ARM', I bet it does.

But it does answer the "can I nspawn into this rootfs?" question for different 
architectures like powerpc vs x86 :)

regards,

Koen
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to