This part is about making Samba work in WebOS. If you want to know how it began and how to root WebOS, read part 1 and part 2.
If you just want the instructions, read part 4.

——

Now when I finally had complete and unrestricted access to the TVs OS, I started exploring the internals to check what was available and how to get Samba working.
My TV (LG 43UH603V-ZE) appears to be based on a Realtek RTD2999 chipset which has a four core ARM Cortex-53 CPU and PowerVR graphics. For short-term memory, the TV has 1.5 GB of RAM (of which about 1.1 GB are user-accessible) and for long-term storage, there’s a 4 GB eMMC flash module divided into several partitions (with only 635 MB for apps and media). Kernel version is 3.10.19.

Fortunately, the TVs kernel already had CIFS (which is a version of SMB) support built-in. But the helper program required for mounting (mount.cifs) was missing. For testing CIFS and possibly other ARM stuff in the future, I’ve installed an ARM port of Ubuntu 16.04 in a chroot, with an old 16 GB flash drive for storage (since the TV had very little free space).
Now I that I had Ubuntu with mount.cifs (cifs-utils) installed, I could start testing Samba on my TV. As expected, everything worked fine and I was able to mount all of my server’s Samba shares and access them inside Ubuntu.
Next part was to get the shares visible in WebOS built-in media player (or I should say players as there is one for Photos and Videos and one for Music).
The first problem was that I wanted my shares to be mounted at TV startup and outside of Ubuntu chroot and Ubuntu’s mount.cifs would not run outside chroot. I temporarily solved this with ugly LD_LIBRARY_PATH and ld.so hack (I do not recommend using it, I will put a link to a proper mount.cifs binary which would work without Ubuntu in part 4).
Second, I needed a location to mount the shares on so WebOS media player could seen them.
First, I tried to play with WebOS’s screenshot capture function, find the directory where it places the screenshots and mount my Samba shares there. But this did not work.
Then I’ve remembered about that small FAT32 partition which I’ve created on my USB flash drive (mainly so that the TV would not complain about unformatted flash) which was visible in WebOS media player.
I thought: what if I mounted my Samba shares onto folders inside that partition ? And.. IT WORKED ! WebOS media player could see all the files as if they were inside that small FAT32 partition. All my media played just fine, even that 4K BDRip (whooping 65mbps bitrate !) which I’ve mentioned earlier. Samba download speed was about 11.2 MB/s (close to maxing out TVs 100mbps ethernet) which is more that enough for pretty much anything the TV can play.

I now had a working way of using Samba in WebOS.
For persistence, I wrote a small script to automount shares at TV boot so that I could use them without having to manually mount them first. More about this in part 4.

If you also want to get Samba working on your WebOS TV, continue to part 4 where I’ll put a detailed guide on how to get this to work.

P. S.: You don’t need Ubuntu chroot for Samba. But if you also choose to use Ubuntu chroot, you will have the entire Ubuntu software library available on your TV. You could for example, fire up a BitTorrent client, run a Web server, PHP, Python or anything else you want. This is nice if you are a tinkerer, like me. If you need a guide for creating a chroot, let me know.