1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
![Kodi Logo](resources/banner_slim.png)
# webOS build guide
This guide has been tested with an adapted buildroot configuration where the Linux Kernel was changed to 5.4.96 and glibc was set to 2.31, this was done so to match the same configuration found on webOS 7 devices. Instructions for doing so is included in this guide. The host OS used for compilation was Ubuntu 22.10 (64-bit). Other combinations may work but we provide no assurances that other combinations will build correctly and run identically to Team Kodi releases. Kodi will build and run on webOS 5+ (LG 2020 models) using **[Kodi's unified depends build system](../tools/depends/README.md)**. Please read it in full before you proceed to familiarize yourself with the build procedure. Note that you do not need to "root" your TV to install Kodi.
## Table of Contents
1. **[Document conventions](#1-document-conventions)**
2. **[Prerequisites](#2-prerequisites)**
3. **[Configure the tool chain](#3-Configure-the-tool-chain)**
4. **[Configure ares-cli tools](#4-Configure-ares-cli-tools)**
5. **[Get the source code](#5-get-the-source-code)**
5.1. **[5.1. Downgrade flatc binary](#51-Downgrade-flatc-binary)**
6. **[Configure and build tools and dependencies](#6-configure-and-build-tools-and-dependencies)**
6.1. **[Advanced Configure Options](#61-Advanced-Configure-Options)**
7. **[Generate Kodi Build files](#7-Generate-Kodi-Build-files)**
7.1. **[Generate Project Files](#71-Generate-Project-Files)**
7.2. **[Add Binary Addons to Project](#72-Add-Binary-Addons-to-Project)**
8. **[Build](#8-build)**
8.1. **[Build kodi binary](#81-Build-kodi-binary)**
9. **[Packaging kodi to distribute as an IPK](#9-Packaging-kodi-to-distribute-as-an-IPK)**
9.1. **[Create the IPK](#91-Create-the-IPK)**
10. **[Install](#10-Install)**
10.1. **[Using make install](#101-Using-make-install)**
10.2. **[Using ares-cli to install](#102-Using-ares-cli-to-install)**
11. **[Debugging ](#11-Debugging)**
12. **[Uninstall](#12-Uninstall)**
12.1. **[Using make to uninstall](#121-Using-make-to-uninstall)**
12.1. **[Using ares-cli to uninstall](#122-Using-ares-cli-to-uninstall)**
## 1. Document conventions
This guide assumes you are using `terminal`, also known as `console`, `command-line` or simply `cli`. Commands need to be run at the terminal, one at a time and in the provided order.
This is a comment that provides context:
```
this is a command
this is another command
and yet another one
```
**Example:** Clone Kodi's current master branch:
```
git clone https://github.com/xbmc/xbmc kodi
```
Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs.
```
git clone -b <branch-name> https://github.com/xbmc/xbmc kodi
```
**Example:** Clone Kodi's current Krypton branch:
```
git clone -b Krypton https://github.com/xbmc/xbmc kodi
```
Several different strategies are used to draw your attention to certain pieces of information. In order of how critical the information is, these items are marked as a note, tip, or warning. For example:
**NOTE:** Linux is user friendly... It's just very particular about who its friends are.
**TIP:** Algorithm is what developers call code they do not want to explain.
**WARNING:** Developers don't change light bulbs. It's a hardware problem.
**[back to top](#table-of-contents)** | **[back to section top](#1-document-conventions)**
## 2. Prerequisites
* **[LG developer account](https://webostv.developer.lge.com/develop/getting-started/preparing-lg-account)**. This is required to access developer mode on the webOS device.
* **[Actvate developer mode on your webOS device]**. Follow the instructions as per **[Installing Developer Mode app page](https://webostv.developer.lge.com/develop/getting-started/developer-mode-app#installing-developer-mode-app)**.
* **[Download ares CLI tools](https://webostv.developer.lge.com/develop/tools/cli-installation)**. These are required to package the kodi binary into a IPK format that webOS understands.
* **[Download and setup a compatible toolchain to compile kodi]**. The toolchain which was used in this guide is **[buildroot-nc4](https://github.com/openlgtv/buildroot-nc4)**, it is an up to date buildroot configuration and comes with newer tools such as GCC 12.2.0. Other toolchains exist, such as those found on the LG OpenSource website: **https://opensource.lge.com/**. You will need to enter the model number of your TV to find the applicable toolchain.
* Device with **webOS 5.0 or newer**.
Team Kodi CI infrastructure is limited, and therefore we only have the single combination tested. Newer webOS versions may work, however the team does not actively test/use these versions, so use with caution. Earlier versions may work, however we dont actively support them, so use with caution.
**[back to top](#table-of-contents)**
## 3. Configure the tool chain
```
mkdir $HOME/kodi-dev
tar xzvf arm-webos-linux-gnueabi_sdk-buildroot.tar.gz -C $HOME/kodi-dev
```
## 4. Configure ares-cli tools
You need to add your webOS device so that it can be used later on in this guide. This step is only required once:
```
ares-setup-device -s
```
Note that the username is prisoner and the password is blank.
You will need to note the name of your device for later e.g. [LG]_webOS_TV_OLED65C24LA
## 5. Get the source code
Change to your `home` directory:
```
cd $HOME
```
Clone Kodi's current master branch:
```
git clone https://github.com/xbmc/xbmc kodi
```
### 5.1. Downgrade flatc binary
The version of FlatBuffers in Kodi is currently locked to v2.0.0, the flatc binary installed onto your Linux system is likely
to be much newer and therefore incompatible. You can get a version compatible here:
```
https://github.com/google/flatbuffers/releases/download/v2.0.0/Linux.flatc.binary.clang++-9.zip
```
Place flatc somewhere in your path, for example `/usr/local/bin`
Alternatively, you may run `make -C native/flatc` when in $HOME/kodi/tools/depends which will compile it for you.
**[back to top](#table-of-contents)**
## 6. Configure and build tools and dependencies
Kodi should be built as a 32bit program for webOS. The dependencies are built in `$HOME/kodi/tools/depends` and installed into `/media/developer/apps/usr/palm/applications/org.xbmc.kodi/xbmc-deps`.
**NOTE:** `--with-platform` is mandatory for all webOS platforms
--prefix should be set to where xbmc-deps are going to be built
--with-toolchain=/path/to/buildroot, --host=arm-linux or whatever your compiler is
Configure build:
```
cd $HOME/kodi/tools/depends
./bootstrap
./configure --prefix=$HOME/kodi-deps --host=arm-webos-linux-gnueabi \
--with-toolchain=$HOME/kodi-dev/arm-webos-linux-gnueabi_sdk-buildroot \
--enable-debug=no \
```
Build tools and dependencies:
```
make -j$(getconf _NPROCESSORS_ONLN)
```
**TIP:** By adding `-j<number>` to the make command, you can choose how many concurrent jobs will be used and expedite the build process. It is recommended to use `-j$(getconf _NPROCESSORS_ONLN)` to compile on all available processor cores. The build machine can also be configured to do this automatically by adding `export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"` to your shell config (e.g. `~/.bashrc`).
**WARNING:** Look for the `Dependencies built successfully.` success message. If in doubt run a single threaded `make` command until the message appears. If the single make fails, clean the specific library by issuing `make -C target/<name_of_failed_lib> distclean` and run `make`again.
**NOTE:** You may want to modify arch, float-abi or fpu to obtain the best performance out of the target CPU, however the defaults are recommended for now until you have a working build:
```
./configure --with-target-cflags='-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
```
### 6.1. Advanced Configure Options
**All platforms:**
```
--prefix=<path>
```
specify path on target device. By default we will likely be packaging as org.xbmc.kodi and it will installed to $HOME/kodi/build/{org.xbmc.kodi}. All developer apps will get installed to this base path plus {your-app-name}
```
--enable-debug=<yes:no>
```
enable debugging information (default is yes)
```
--disable-ccache
```
disable ccache
```
--with-tarballs=<path>
```
path where tarballs will be saved [prefix/xbmc-tarballs]
```
--with-cpu=<cpu>
```
optional. specify target cpu. guessed if not specified
```
--with-linker=<linker>
```
specify linker to use. (default is ld)
```
--with-platform=<platform>
```
target platform
```
--enable-gplv3=<yes:no>
```
enable gplv3 components. (default is yes)
```
--with-target-cflags=<cflags>
```
C compiler flags (target)
```
--with-target-cxxflags=<cxxflags>
```
C++ compiler flags (target)
```
--with-target-ldflags=<ldflags>
```
linker flags. Use e.g. for -l<lib> (target)
```
--with-ffmpeg-options
```
FFmpeg configure options, e.g. --enable-vaapi (not relevant however to webOS)
**[back to top](#table-of-contents)**
## 7. Generate Kodi Build files
Before you can build Kodi, the build files have to be generated with CMake. CMake is built as part of the dependencies and doesn't have to be installed separately. A toolchain file is also generated and is used to configure CMake.
Default behaviour will not build binary addons. To add addons to your build go to **[Add Binary Addons to Project](#52-(Optional)-Add-Binary-Addons-to-Project)**
## 7.1. Generate Project Files
Before you can build Kodi, the project has to be generated with CMake. CMake is built as part of the dependencies and doesn't have to be installed separately. A toolchain file is also generated and is used to configure CMake.
Generate project for webOS:
```
make -C tools/depends/target/cmakebuildsys
```
**TIP:** BUILD_DIR can be omitted, and project will be created in $HOME/kodi/build
Change all relevant paths onwards if omitted.
Additional cmake arguments can be supplied via the CMAKE_EXTRA_ARGUMENTS command line variable
An example of extra arguments to remove dependencies dbus, CEC and pipewire from the build:
````
make -C tools/depends/target/cmakebuildsys BUILD_DIR=/media/developer/apps/usr/palm/applications/org.xbmc.kodi \
CMAKE_EXTRA_ARGUMENTS="-DCORE_PLATFORM_NAME=webos -DENABLE_DBUS=OFF -DENABLE_CEC=OFF -DENABLE_PIPEWIRE=OFF -DHAVE_LINUX_UDMABUF=OFF"
````
## 7.2. Add Binary Addons to Project
You can find a complete list of available binary add-ons **[here](https://github.com/xbmc/repo-binary-addons)**.
Binary addons are optional.
To build all add-ons:
```
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=$HOME/kodi/build/tools/webOS/packaging
```
Build specific add-ons:
```
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=$HOME/kodi/build/tools/webOS/packaging ADDONS="audioencoder.flac pvr.vdr.vnsi audiodecoder.snesapu"
```
Build a specific group of add-ons:
```
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=$HOME/kodi/build/tools/webOS/packaging ADDONS="pvr.*"
```
To build specific addons or help with regular expression usage for ADDONS_TO_BUILD, view ADDONS_TO_BUILD section located at [Kodi add-ons CMake based buildsystem](../cmake/addons/README.md)
**TIP:** Binary add-ons added to the generated project can be built independently of the Kodi app by selecting the scheme/target `binary-addons` in the project.
**[back to top](#table-of-contents)** | **[back to section top](#5-Generate-Kodi-Build-files)**
## 8. Build
### 8.1. Build kodi binary
In '$HOME/kodi/build`
```
make -j$(getconf _NPROCESSORS_ONLN)
```
**WARNING:** Building for simulator is NOT supported.
**[back to top](#table-of-contents)** | **[back to section top](#6-Build)**
## 9 Packaging kodi to distribute as an IPK
## 9.1 Create the IPK
CMake generates a target called `ipk` which will package Kodi ready for distribution.
Create package:
```
make ipk
```
Generated `ipk` file will be inside the build dir. The filename may differ from this guide which is due to the version of Kodi which at time of writing will create a `ipk` called org.xbmc.kodi_20.90.101_all.ipk.
## 10 Using ares-cli to install
Alternatively, you can use ares-cli to give you more control of which device to install to.
```
ares-install ./org.xbmc.kodi_20.90.101_arm.ipk --d <your tv>
e.g. [LG]_webOS_TV_OLED65C24LA
```
## 11. Debugging
You can connect over ssh directly to your webOS device to debug any issues:
```
ssh -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa -i ~/.ssh/\<your tv>-p 9922 prisoner@<ip of tv> bash -i
```
You will be put into /media/developer by default.
cd `/media/developer/apps/usr/palm/applications/org.xbmc.kodi/.kodi/temp` to find kodi.log
You can also edit `kodi.sh` and place strace just before launching kodi to debug any missing libraries:
```
strace -t -o /media/developer/apps/usr/palm/applications/org.xbmc.kodi/trace.temp ./kodi-webos --debug
```
## 12. Uninstall
We use the same make command or ares-cli tools to uninstall.
## 12.1. Using make to uninstall
```
cd $HOME/kodi/tools/webOS/packaging
make uninstall
```
## 12.2. Using ares-cli to uninstall
```
ares-install --remove org.xbmc.kodi --d <your tv>
e.g. [LG]_webOS_TV_OLED65C24LA
```
**[back to top](#table-of-contents)**
|