1

I saw this question How to cross compile from Mac OS X to Linux x86? but my target looks like this

$ uname -a
Linux MyDevice 4.9.127-svn20747 #1 SMP Thu Jan 17 05:46:18 UTC 2019 x86_64 GNU/Linux

Some output from less /proc/cpuinfo

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 54
model name  : Intel(R) Atom(TM) CPU D2701   @ 2.13GHz
stepping    : 1
microcode   : 0x10d
cpu MHz     : 2127.900
cache size  : 512 KB

so I doubt there are any readymade solutions.

How do I compile from a Mac to embedded Linux running on an Atom CPU?

d-b
  • 695
  • 3
  • 14
  • 43
  • What build system do you use? It might be not that hard depending on the quality of code and other constraints. – Arkadiusz Drabczyk Oct 13 '20 at 20:39
  • Mainly Apple's own, Xcode, clang and so on. I also have GNU make from MacPorts. I am trying to compile bonnie https://doc.coker.com.au/projects/bonnie/ or fio https://git.kernel.dk/cgit/fio/ – d-b Oct 13 '20 at 20:44
  • Be advised that your Mac is, by design, probably more 'obscure' than any Linux distribution you can find. –  Oct 17 '20 at 17:50
  • @Roadowl Well, is BSD so according to Linux standards it is by definition "obscure". But looking at market shares it is probably more common on the desktop than all Linux distributions combined with Android the only real competitor (but Android in itself is very odd for being Linux so...) – d-b Oct 17 '20 at 17:53

2 Answers2

1

your target is a 64bit x86 platform, which is certainly not obscure. the SO question you linked is the best starting point, spin up a VM of the linux distribution you're targeting on your embedded board, compile in that and scp the executable to the board (or just compile on the board itself, your target is not exactly underpowered)

shirleyquirk
  • 1,527
  • 5
  • 21
  • How do I install Seagate's NAS OS on a VM? And if I manage that, next problem is that it doesn't include gcc by default so I guess I have to cross compile that to start with, mustn't I? – d-b Oct 13 '20 at 20:53
  • that is indeed an obscure os. do update your question including that relevant info. have you had a look at https://www.seagate.com/nasos/SDK/0.7/third-party/index.html#packaging-a-3rd-party-app ? – shirleyquirk Oct 13 '20 at 21:05
  • I want to compile bonnie++ or fio so I don't think that tutorial applies. – d-b Oct 13 '20 at 21:25
  • 1
    The ISA is common, but if you want to link the right builds of libraries and so on then that's harder. @d-b: at worst you can build a static executable using (or cross-compiling for) any GNU/Linux distro; that should work on any kernel because system-call ABIs are stable. Also, `libc.so.6` has a pretty stable ABI so if you don't have any other library dependencies then you can usually just build a normal executable on an Ubuntu, Debian, Arch or whatever install, and dynamic linking will find the right symbols when you run it on the embedded machine. (At least if it's glibc, IDK about MUSL) – Peter Cordes Oct 14 '20 at 04:29
  • @PeterCordes Is there a reason to NOT build it with static links? How do I do that? – d-b Oct 14 '20 at 07:44
  • https://www.seagate.com/nasos/SDK/0.7/containers/index.html download links for linux containers, you can build inside one of those. also https://www.seagate.com/nasos/SDK/0.7/multi-arch/index.html#cross-compiling for a guide on how to cross compile – shirleyquirk Oct 14 '20 at 12:34
  • Hmm, I need some help here. I have downloaded NASOS_SDK-0.7.ova, which opened fine in Virtual Box so it is up and running. I have created a project (bpp) in the SDK_UITOOL. I have, sort of, copied the C++ source into the bpp/source. Now what? Do I need any of the rbw-containers listed here https://www.seagate.com/nasos/SDK/0.7/downloads/index.html ? – d-b Oct 17 '20 at 16:23
  • I have managed to compile something now, does this look right: – d-b Oct 17 '20 at 16:47
  • `rainbow@rainbow-VirtualBox:~/bpp/source/bonnie++-1.98$ file bonnie++` – d-b Oct 17 '20 at 16:47
  • `bonnie++: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=d31f1526157a1f89fa4f153cb0124977c954ae56, not stripped` – d-b Oct 17 '20 at 16:48
0

This is what I did to compile (Crosscompile? I am not really sure what I did.) bonnie++ on a Mac running VirtualBox with a NAS OS-VM. I think this should apply to most software that one can compile using a simple ./configure; make process.

  1. Download NAS OS SDK VM (NASOS_SDK-0.7.ova) from here https://www.seagate.com/nasos/SDK/0.7/downloads/index.html

  2. Begun following these instructions https://www.seagate.com/nasos/SDK/0.7/multi-arch/index.html¹ until I reached the section Cross Compiling where I was redirected to https://www.seagate.com/nasos/SDK/0.7/cross/index.html.

  3. Skip down to the paragraph that begins with In order to cross-compile our hello program and perform the three exports described there. The TOOLCHAIN_PREFIX can be found in the appropriate directory in /opt: e.g., in the x86_64-seagate-nasos-sdk there is a directory x86_64-seagate-linux-gnu - use that name as the TOOLCHAIN_PREFIX (Why oh why isn't this information included in the guide???).

  4. Perform configure and make as described.

Done.

If someone knows how to perform static linking, please add a comment.

¹ I don't think this is necessary if you try to compile something where ./configure; make already works.

https://www.seagate.com/nasos/SDK/0.7/cross/index.html

NAS OS SDK VM

d-b
  • 695
  • 3
  • 14
  • 43