How to modify Saturn 7 firmware

From Openlgtv
Jump to: navigation, search

Introduction

In this article we assume that you are familiar with the process of modifying Saturn 6 firmware, so we'll speak for the most part about differences between Saturn 6 and Saturn 7.

The list of Saturn 7 TVs

LCD TV

26LD32**, 32LD32** (except LD320)

26LD33**, 32LD33**

19LD34**, 22LD34**, 26LD34**, 32LD34**

19LD35**, 22LD35**, 26LD35**, 32LD35**

32LD4***, 37LD4***, 42LD4***, 47LD4***

32LD5***, 42LD5***, 46LD5***, 52LD5*** , 60LD5***

22LK33**, 26LK33**, 32LK33**

32LK43**, 37LK43**, 42LK43**

32LK45**, 37LK45**, 42LK45**

32LK53**, 42LK53**, 47LK53**

32LK55**, 42LK55**

42LK95**, 47LK95**

19LV23**, 22LV23**

19LV25**, 22LV25**, 26LV25**, 32LV25**

32LV34**, 42LV34**

32LV35**, 37LV35**, 40LV35**, 42LV35**, 47LV35**

32LV45**, 37LV45**, 42LV45**, 47LV45**

22LV55**, 26LV55**

32LW45**, 42LW45**, 47LW45**, 55LW45**

42LW54**, 47LW54**

LED TV

1932LE3***, 2232LE3***, 2632LE3***, 32LE3***

32LE4***, 37LE4***, 42LE4***

22LE5***, 26LE5***


Plasma TV

42PT25**, 50PT25**

42PT350*, 50PT350*

42PT351*, 50PT351*

42PT352*, 50PT352*

42PT353*, 50PT353*

42PT45**, 50PT45**

50PV25**, 60PV25**

50PV35**

42PW45**, 50PW45**

50PZ25**, 60PZ25**

50PZ55**, 60PZ55**

The list above is not full. If you find that your TV model has the license value GP2_M******* in the list there: http://openlgtv.org.ru/wiki/index.php/Opensource_packages_list then your TV is supported even if TV is not European.

Firmware

The debug mode and the u-boot command prompt have been disabled by default in the latest firmware versions, beginning from 03.02.x (roughly the year 2010 models and later.) You can check your current firmware version by going to the main menu and pressing the red button on your remote. (The red button is the “customer support” option.)

If you can’t seem to get into the debug mode or in the u-boot command prompt via the usual means, they are probably disabled by default in your model. But these features can be easily re-enabled in the IN-START service menu. Try the instructions outlined in the Debug mode connection article.

Alternatively, you could downgrade to an older firmware version compatible with your model. 03.01.08 is a good pick, you can find one here.

Preparations

Also, there is no production-ready solution like .epk-packed lgmod yet. You have to do the stuff with a good-old RS-232 cable.

Backup

When you finish to build your workspace environment, do not forget to backup your firmware! The backup process for Saturn 6 is described in the article How to backup TV firmware, but numbers of your mtd devices and numbers in the article are not going to match. So you shall pick the right numbers. You can find them in an output of the command 'mtd' in debug menu (not in the shell).

Diving in

One of the most notable differences is the initialization process. In Saturn 6, bootstrap process looks like this: U-Boot calls linux kernel, kernel calls /sbin/init (init is a part of the busybox tool). /sbin/init reads usual (for linux) configuration files and executes usual startup scripts, such as /etc/init.d/rcS. So it goes. In Saturn7, /sbin/init is substituted by custom LG init, which is called lginit and is stored in mtd 'lginit'. No usual linux startup script is executed during that process. One of the ways to fix the situation is to use /sbin/init instead of lginit. This will require some changes. The second way is to substitute RELEASE app in the 'lgapp' mtd by your own script which will serve as a proxy (do what you want and start RELEASE then). But the second way is not tested, so we will speak about the first one.

Images

If you are not willing to spend your time with all these details and just want to see it working, you can get images built on top of 03.01.08 with enabled CIFS and NFS. They aren't guaranteed to work, however. You are not seeking short paths, are you? Welcome then to the world of bad english and free firmware.

Lginit

Lginit mtd is a squashfs with one file. Unpack this squashfs and rename or remove this file. Pack new lginit image with squashfs (use 3.1-3.4 version of squash-tools, later versions won't work). Now kernel can not find lginit during bootstrap and starts /sbin/init - the next in kernel's list of inits. Flash the new lginit image. You can also recompile the kernel with the string about lginit in init/main.c commented out and then flash the kernel to mtd kernel.

Rootfs

Mostly all of the instructions below are related to the modification of rootfs image. Unpack it, modify, pack it again and flash it via RS-232.

Fstab

With /sbin/init on charge, all of standard linux configs start working. But they are wrong, that is the problem. Remember your list of mtd devices with numbers and fix those numbers in /etc/fstab, file which is responsible for mounting file system on the start. Be care, there are two kinds of mtds in the list - one for the main partition and one for reserved partition. The main one is the first one. For example, if you have lgres on 17 and on 22, then 17 is desired number. For your convenience, there is an example of /etc/fstab. It may not work on your system and is here for example purposes only.

Rc.local

Startup scripts are all called from /etc/init.d/rcS. Some things, like mounting all file systems from /etc/fstab, are called from /etc/rc.d/rc.sysinit, and almost all other things, like environment variables setup, are done in /etc/rc.d/rc.local. Add some additional variables here for RELEASE app, comment out non-needed things, explicitly allow AUTORUN and do other minor things. You also can enable any of your custom commands and scripts here. An example of /etc/rc.d/rc.local: link.

Kernel modules

Add all the modules you need to the rootfs. For example, for the CIFS support use cifs.ko, NFS support is provided by sunrpc.ko, lockd.ko, nfs.ko. Load NFS modules in the listed order. You can also compile a new kernel with all the options you need and flash it in kernel's mtd. Compiled modules for NFSv3 and CIFS support are here.

To compile custom modules you need: a) Saturn 7 toolchain, b) Sources of Saturn 7 kernel, c) Linux (or any other unix) system, native or virtualized.

Link to the archive with the broken kernel but working toolchain is on Opensource packages list page. Pick up a working kernel for your model at that page. Export path to toolchain's /bin directory to your PATH environment. Use config-flash as a basis for your .config file. 'make' will compile it, mkclean.sh will clean the results of previous builds. If you encounter strange errors like non-presence of 'ccdv', find those utils somewhere (in u-boot tools directory, for example) and copy it to the desired place.

That's all, add your script to tie the things together or add other modification you want and you are done. An example of the shell-script for auto-mounting: link.

Other differences

  • Binaries in Saturn 7 original firmware are linked dynamically, not statically. There is a whole bunch of .so files in /lib.
  • The new thing in Saturn 7 is DirectFB system. It is a powerful thing and can serve as a basis for many interesting modifications.

How to compile kernel for Saturn 7 TVs and additional usb2net modules in Ubuntu

Note: All paths will be related to the /root folder. We will build all stuff there. Also you need:

apt-get install gcc ncurses-dev squashfs-tools

1. Download LG toolchain for Saturn 7 via Firefox (for example) GP2_MSTAR_2.tar.gz and move it to the /root folder.

2. Download kernel sources for Saturn 7 via Firefox (for example) GP2_M_CO_FI_2010.tar.gz and move it to the /root folder.

3. Run Terminal(shell) as root and setup toolchain:

cd /root
tar -xvzf GP2_MSTAR_2.tar.gz
cd GP2_MSTAR_2
tar -xvzf toolchian-bin.tgz
export PATH=$PATH:`pwd`/gp2-s7-mipsel-lg-gcc-4.3.2-glibc-2.9-nptl/bin

4. Compile kernel:

cd /root
unzip GP2_M_CO_FI_2010.tar.gz -d GP2_M_CO_FI_2010
mkdir src
mkdir ./src/utils
cd GP2_M_CO_FI_2010
cp ./u-boot/tools/ccdv /root/src/utils
chmod 777 /root/src/utils/ccdv
tar -xvzf kernel.tgz
cd ../kernel_src/kernel
tar -xvzf linux-2.6.26-saturn7.tgz
cd linux-2.6.26-saturn7
cat config-flash>.config
make

5. To change kernel compilation options or to add usb2net kernel modules do:

make menuconfig 

Go to: Device Drivers, press Space on Network device support and press Enter. Go to: USB Network Adapters and select by Space every line there. External modules *.ko require (M) option, internal (*). Exit and save. To compile modules only:

make modules

6. After compilation, you can find the modules in drivers/net and drivers/net/usb folders. To save some space in the flash partition do:

cd drivers/net/usb
mipsel-lg-linux-gnu-strip --strip-unneeded *.ko

To recompile modules (after changing sources or config):

make clean ; make modules