Please, tutorial about how to compile for RPI3

I have read the wiki at Overview - Development - OSMC , I have cloned the OSMC repository and I have created the toolchain (arm7) on a Raspberry PI 3. I have installed the toolchain on the OS.

What now?. I have been unable to find any documentation about how to compile for RPI. What should I type and where?

Thanks.

What are you trying to compile for the Pi?

Everything. I would like to be able to replicate OSMC, both the installer and the packages.

Mid term, I have handful of patches for Kodi to improve scalability with big databases in low memory systems like Pi3 and I would like to be able to use them in my OSMC Pi3 system. But that is something for the future.

It’s better to get these upstream.

You should try building a package or installer and let us know what issues you encounter.

That would be nice and I will try, after extensive testing. I have quite disruptive ideas that kodi team systematically ignore. I keep trying :slight_smile:

That is the thing. I don’t know how to do it. I have cloned the OSMC repository and i have build the toolchain (arm7) for Raspberry PI 3. What now?. I don’t see any documentation at all about how to build the packages, for instance, beside entering in each directory and doing “make pi2” or “make arm7”, different make target in each case. I got that reading source code and try-error, I don’t see any detail in the wiki.

Would be nice to have something documented like “do this to get the packages build for Pi3”, “do this to get an installer”. Getting the environment right is documented, buiding the toolchain is documented… The final step, getting packages or installer built, is not documented.

OSMC is an entire OS consisting of many packages. You will need to build every package if you want to build the whole OS.

But it sounds like you just want to patch Kodi - so you could just build that single package.

We are getting nowhere :slight_smile: .

Let’s be concrete and small.

There is no documentation in the wiki about how to build a package or how to use the toolchain just compiled&installed. How I am suppose to know that I must do “make rpi2” when I want a pi3 package?. What about Pi4?

The documentation is open source – so can be improved by anyone.
I’m happy to accept contributions for this. There could definitely be more informatiion.

Is there a specific reason you need to build your own toolchain?
What’s wrong with the OSMC supplied one which is installed if you run make on an appropriate package?

The thing is… I don’t know how to do it. Whatever I am doing exploring, trying and reading source code, is not productive and whatever I write would be wrong or unnecessarily complicated.

I first tried to produce RPI3 packages using my ubuntu AMD64 laptop compiling the ARM7 toolchain. After hours of pain because the lack of documentation, I decided to stop wasting my time and ask the people that knows.

I find funny the path this thread is evolving into. How to build the toolchain is documented, but not how to use it. How to download the OSMC repository is documented, but not how to use it to build “OSMC”. Interesting.

I guess (but only guess, I don’t know) that the least resistence path to build a personalized Kodi for OSMC, I should do:

  1. Use a Raspberry PI3 with OSMC already running.
  2. Clone the GIT repository.
  3. go to “package/mediacenter-osmc”.
  4. “make rpi2”.

Would that work? Would I need any additional package in the running OSMC installation?

How to compile for a PI4? Would a Pi4 OSMC installation generate a Pi4 package when doing “make rpi2”?

Of course not, you tell make to make a package optimized for armhf(correct if I’m wrong). You would likely make aarch64. If hardware is the issue, but i also know that there might be a mixed architecture between kernel arch and user land.

So to write “simple how2s” isn’t as easy when you support multiple architectures.

That is why having good documentation is helpful and should be a priority, instead of me bumping against the wall by trial&error.

The docs should be exhaustive. OSMC supports a handful of targets only. Not having detailed explanation of how to rebuild OSMC for PI3/Pi4 is something to solve ASAP.

I don’t understand why I need to fight so hard to learn how to contribute to OSMC and be useful to the project.

Because OSMC is maintained by volunteers who have far more pressing projects/issues than spending their valuable time to create your exhaustive docs. OSMC is based on debian. There are surely at least dozens of tutorials on how to build packages for debian somewhere out there on the web?

1 Like

I don’t have time to manage all of the documentation on my own, and a lot of what has been written has been contributed by other users. One day I hope I get a chance to extend the documentation, but that’s not going to happen in the near term.

Others do (and frequently) compile packages for OSMC and make changes.

Building Kodi for Raspberry Pi 4 is very trivial. On a Pi, clone repository, cd to package/mediacenter-osmc and run make rbp4. Everything you need (toolchains, dependencies and patches) will be handled for you and the Debian packages will be automatically produced. These can then be installed on your target system.

1 Like

I am a quite busy open source maintainer myself.

Usually investing time lowering the entry barrier to allow other to help out is a good investment shortly enough. The busiest you are, the better investment, in fact.

I think the problem here is you don’t understand what OSMC is.
If you want to document the steps and add them to the Wiki, this would be great.

OSMC isn’t a single package – it’s an operating system. There is no one command to build everything. If you want to build the OS, you will likely want to set up a server for yourself to host an APT repository (this is documented extensively online).

You would then:

  • Build every toolchain
  • Build every OSMC package
  • Add every OSMC package to your APT repository
  • Patch the filesystem to use your APT repositories and not OSMC ones
  • Generate a filesystem
  • Copy the filesystem to the target installer directory
  • Compile the installer

This will give you a complete system which you built yourself.
I don’t see why you’d want to do this – but knock yourself out.

Thanks. That was useful.

Possibly. I was under the impression that OSMC was a regular Debian OS with additional packages provided by a private repository.

I was expecting something in the line of “make packages-rpi4” to get all packages build and available to install over a regular Debian, instead of needing a manual compilation of each package, with different targets case by case.

Let’s just move on. We are all busy.

No – and this isn’t the case with Debian either – packages are built individually. You can’t build all of Debian with a single make command.

From what you’ve sad – it sounds like all you really need to build is Kodi, which should be simple enough to achieve.

That is my immediate need, but I like OSMC (quite happy user since 2015) and I was thinking about being helpful to the project.

1 Like

I’ve never tried cross-compilation of OSMC packages, but native compilation generally works ok.

If you go to package/mediacenter-osmc and type make, you’ll see the available targets for that package

osmc@osmc:~/osmc/package/mediacenter-osmc$ make
Specify a target:
make rbp2
make rbp4
make vero3
make pc

So, you’d run make rbp2 for the Pi 2/3 and make rbp4 for the Pi 4. Note that the targets can vary within a package, eg:

osmc@osmc:~/osmc/package/lirc-osmc$ make
Specify a target:
make armv6l
make armv7
make i386

NB. Please be aware that the packages are all built within the relevant OSMC toolchain, which is a separate build environment from the main machine. As such, its installed packages can differ from those on the host machine. Generally, this isn’t such a problem, but I noticed that my armv7 toolchain was failing to find packages on the Debian repo. Long story short, it was having the same update problem that caused Sam to produce the recent APT hotfix, eg

E: Repository 'http://security.debian.org buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

To fix it I ran sudo chroot /opt/osmc-tc/armv7-toolchain-osmc/ apt update (In fact, you can run sudo chroot /opt/osmc-tc/armv7-toolchain-osmc/<command> to run whatever command you want in the toolchain environment.)

1 Like