How to re-compile linux

  • Hello,
    I setup a virtual ubuntu server, cloned the git repo, etc. etc. and after running
    PROJECT=RPi2 ARCH=arm make image

    I got a working version of LibreELEC. Great!
    Now I changed one of the linux driver files (lnbp22.c) according to a previously submitted patch ( more on why I need a modified driver etc. here: LibreELEC )
    So now I need "JUST" to recompile linux, BUT I don't know how
    rerunning
    PROJECT=RPi2 ARCH=arm make image
    is not enough, since it uses the "old" one ...
    Can you give me a quick tipp how to best do that?
    Do I have to make a patch file and put it somewhere?
    Please help
    Ognian

  • Create a diff patch of your changes from the root folder of build.LibreELEC-RPi2.arm*/linux-4.9 and place in projects/RPi2/patches/linux/linux-002-mystuff.patch or in packages/linux/patches/ with a suitable sequence number (patches are applied in order) then re-run the build command. The linux package will be cleaned and rebuilt with the patch applied. If this fixes something that others would benefit we'd also encourage you to PR the patch to our git repo so it can be included until it works its way into mainline kernel.

  • OK
    putting the patch into packages/linux/patches/ did not work
    instead I had to put into
    packages/linux/patches/default

    but now I somehow have the driver broken...
    will investigate and report...

  • OK
    first 7.90.010 is broken for me:

    [ 215.578355] usb 1-1.5: new high-speed USB device number 5 using dwc_otg
    [ 216.112432] usb 1-1.5: New USB device found, idVendor=0b48, idProduct=300a
    [ 216.112447] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 216.112455] usb 1-1.5: Product: TT-USB2.0
    [ 216.112462] usb 1-1.5: Manufacturer: TechnoTrend
    [ 216.112469] usb 1-1.5: SerialNumber: LHJMHM
    [ 216.171015] dvb-usb: found a 'Technotrend TT Connect S2-3650-CI' in warm state.
    [ 216.171033] pctv452e: pctv452e_power_ctrl: 1
    [ 216.171033]
    [ 216.171728] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [ 216.171745] pgd = a973c000
    [ 216.171751] [00000000] *pgd=00000000
    [ 216.171764] Internal error: Oops: 805 [#1] SMP ARM
    [ 216.171793] Modules linked in: dvb_usb_pctv452e(+) ttpci_eeprom dvb_usb dvb_core rc_core hci_uart btbcm bluetooth brcmfmac brcmutil cfg80211 bcm2835_gpiomem
    [ 216.171871] CPU: 3 PID: 698 Comm: systemd-udevd Not tainted 4.9.0 #1
    [ 216.171888] Hardware name: BCM2835
    [ 216.171902] task: a96faf80 task.stack: a97c2000
    [ 216.171928] PC is at __mutex_lock_slowpath+0x78/0x15c
    [ 216.171945] LR is at __mutex_lock_slowpath+0x4c/0x15c
    [ 216.171966] pc : [<806ae54c>] lr : [<806ae520>] psr: a00b0013
    [ 216.171966] sp : a97c3b70 ip : a97c3b70 fp : a97c3ba4
    [ 216.171992] r10: 00000002 r9 : ad0249f4 r8 : 00000002
    [ 216.172009] r7 : ad0249f0 r6 : a96faf80 r5 : ffffffff r4 : ad0249ec
    [ 216.172027] r3 : 00000000 r2 : a97c3b74 r1 : 00000000 r0 : ad0249f0
    [ 216.172046] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 216.172066] Control: 10c5383d Table: 2973c06a DAC: 00000055
    [ 216.172083] Process systemd-udevd (pid: 698, stack limit = 0xa97c2210)
    [ 216.172102] Stack: (0xa97c3b70 to 0xa97c4000)
    [ 216.172125] 3b60: a97c3b94 ad0249f4 00000000 024000c0
    [ 216.172151] 3b80: ad0249ec ad0249c0 ac964000 a97f5600 ad0249ec 00000002 a97c3bbc a97c3ba8
    [ 216.172177] 3ba0: 806ae688 806ae4e0 00000000 ad0249c0 a97c3bfc a97c3bc0 7f1b8a24 806ae63c
    [ 216.172203] 3bc0: a97c3be4 a97c3bd0 ad801cc0 024080c0 a97c3c0c ac965000 acc2fc00 ac964000
    [ 216.172228] 3be0: acc2fdda 7f1bad98 00000002 00000002 a97c3c0c a97c3c00 7f1ac46c 7f1b89ac
    [ 216.172253] 3c00: a97c3c6c a97c3c10 7f1ac6cc 7f1ac428 80259b28 7f1bad1c adbfe410 ffffffed
    [ 216.172305] 3c20: adbfe410 a959e690 a97c3c4c 00000000 7f1bb380 ada68800 00000000 7f1bad1c
    [ 216.172355] 3c40: ada68800 7f1baaa8 ada68800 acc2fc00 00000000 7f1bb2ac ada68800 7f1bb324
    [ 216.172404] 3c60: a97c3c8c a97c3c70 7f1b8f9c 7f1ac47c 7f1baaa8 7f1bb2ac ada68820 acc2fc70
    [ 216.172454] 3c80: a97c3cc4 a97c3c90 804e4340 7f1b8f48 8025c1d0 ffffffed a97c3cc4 80c6c404
    [ 216.172503] 3ca0: ada68820 00000000 7f1bb2ac 00000010 a97f5464 7f1bb380 a97c3cec a97c3cc8
    [ 216.172553] 3cc0: 8046e050 804e4240 ada68820 7f1bb2ac ada68854 00000000 7f1bb380 a97f5464
    [ 216.172603] 3ce0: a97c3d0c a97c3cf0 8046e1bc 8046de50 00000000 7f1bb2ac 8046e0fc 00000000
    [ 216.172652] 3d00: a97c3d34 a97c3d10 8046c20c 8046e108 ad98095c adbfd6b4 ad980970 7f1bb2ac
    [ 216.172701] 3d20: ace68200 80c25c34 a97c3d44 a97c3d38 8046d8c8 8046c1a8 a97c3d6c a97c3d48
    [ 216.172751] 3d40: 8046d40c 8046d8b0 7f1ba1c8 a97c3d58 7f1bb2ac 80c25c34 7f1bb2ac 7f1ba1b4
    [ 216.172800] 3d60: a97c3d84 a97c3d70 8046e71c 8046d308 7f1bb278 80c25c34 a97c3dac a97c3d88
    [ 216.172850] 3d80: 804e2edc 8046e6a8 7f1bd000 ffffe000 a97f5440 a97f5500 00000000 a97f5464
    [ 216.172899] 3da0: a97c3dbc a97c3db0 7f1bd024 804e2e70 a97c3e34 a97c3dc0 8010179c 7f1bd00c
    [ 216.172948] 3dc0: a97f5464 7f1bb380 a97c3dec a97c3dd8 806acfa4 806ac824 00000001 024000c0
    [ 216.172998] 3de0: a97c3e04 a97c3df0 806acff8 806acf90 ad801e40 024000c0 a97c3e34 a97c3e08
    [ 216.173047] 3e00: 801e3b74 806acfc0 80c60468 7f1bb380 00000001 7f1bb380 00000001 a97f5440
    [ 216.173097] 3e20: a97f5500 00000003 a97c3e5c a97c3e38 80199f5c 8010175c a97c3e5c a97c3e48
    [ 216.173146] 3e40: a97c3f44 00000001 a97f5440 00000001 a97c3f1c a97c3e60 80185358 80199f00
    [ 216.173195] 3e60: 7f1bb38c 00007fff 7f1bb380 80182b2c 807b6b5c 807b6b34 807b6b8c 807b6b28
    [ 216.173245] 3e80: 80703c94 7f1bb38c 00000000 b1a8c7d8 a97c3f44 80182678 7f1bb3c8 024000c0
    [ 216.173294] 3ea0: a97c3eec a97c3eb0 801fa120 801f9f9c b1a87000 00000000 00000000 00000000
    [ 216.173342] 3ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    [ 216.173390] 3ee0: 00000000 00000000 00000000 00000000 7fffffff 00000000 00000012 76e95787
    [ 216.173440] 3f00: 0000017b 80107b44 a97c2000 00000000 a97c3fa4 a97c3f20 80185a9c 80183804
    [ 216.173489] 3f20: 7fffffff 00000000 00000003 a97c3f38 801b7edc b1a87000 00005828 00000000
    [ 216.173539] 3f40: 00000000 b1a87000 00005828 b1a8c440 b1a8c364 b1a8b368 00003504 00003824
    [ 216.173587] 3f60: 00000000 00000000 00000000 000013c8 00000017 00000018 00000010 00000000
    [ 216.173636] 3f80: 0000000a 00000000 00000000 76d8c388 00000000 00000000 00000000 a97c3fa8
    [ 216.173685] 3fa0: 801079a0 801859f8 76d8c388 00000000 00000012 76e95787 00000000 7ea019b4
    [ 216.173740] 3fc0: 76d8c388 00000000 00000000 0000017b 00000000 54e6b9b8 00000000 00020000
    [ 216.173789] 3fe0: 7ea01950 7ea01940 76e8e4cc 76db17f0 60010010 00000012 00000000 00000000
    [ 216.173829] Backtrace:
    [ 216.173864] [<806ae4d4>] (__mutex_lock_slowpath) from [<806ae688>] (mutex_lock+0x58/0x5c)
    [ 216.173916] r9:00000002 r8:ad0249ec r7:a97f5600 r6:ac964000 r5:ad0249c0 r4:ad0249ec
    [ 216.173979] [<806ae630>] (mutex_lock) from [<7f1b8a24>] (pctv452e_power_ctrl+0x84/0x17c [dvb_usb_pctv452e])
    [ 216.174026] r5:ad0249c0 r4:00000000
    [ 216.174072] [<7f1b89a0>] (pctv452e_power_ctrl [dvb_usb_pctv452e]) from [<7f1ac46c>] (dvb_usb_device_power_ctrl+0x50/0x54 [dvb_usb])
    [ 216.174128] r10:00000002 r9:00000002 r8:7f1bad98 r7:acc2fdda r6:ac964000 r5:acc2fc00
    [ 216.174171] r4:ac965000
    [ 216.174208] [<7f1ac41c>] (dvb_usb_device_power_ctrl [dvb_usb]) from [<7f1ac6cc>] (dvb_usb_device_init+0x25c/0x668 [dvb_usb])
    [ 216.174275] [<7f1ac470>] (dvb_usb_device_init [dvb_usb]) from [<7f1b8f9c>] (pctv452e_usb_probe+0x60/0x78 [dvb_usb_pctv452e])
    [ 216.174329] r10:7f1bb324 r9:ada68800 r8:7f1bb2ac r7:00000000 r6:acc2fc00 r5:ada68800
    [ 216.174371] r4:7f1baaa8
    [ 216.174417] [<7f1b8f3c>] (pctv452e_usb_probe [dvb_usb_pctv452e]) from [<804e4340>] (usb_probe_interface+0x10c/0x264)
    [ 216.174465] r5:acc2fc70 r4:ada68820
    [ 216.174500] [<804e4234>] (usb_probe_interface) from [<8046e050>] (driver_probe_device+0x20c/0x2b8)
    [ 216.174552] r10:7f1bb380 r9:a97f5464 r8:00000010 r7:7f1bb2ac r6:00000000 r5:ada68820
    [ 216.174594] r4:80c6c404
    [ 216.174624] [<8046de44>] (driver_probe_device) from [<8046e1bc>] (__driver_attach+0xc0/0xc4)
    [ 216.174675] r9:a97f5464 r8:7f1bb380 r7:00000000 r6:ada68854 r5:7f1bb2ac r4:ada68820
    [ 216.174726] [<8046e0fc>] (__driver_attach) from [<8046c20c>] (bus_for_each_dev+0x70/0xa4)
    [ 216.174774] r7:00000000 r6:8046e0fc r5:7f1bb2ac r4:00000000
    [ 216.174813] [<8046c19c>] (bus_for_each_dev) from [<8046d8c8>] (driver_attach+0x24/0x28)
    [ 216.174858] r6:80c25c34 r5:ace68200 r4:7f1bb2ac
    [ 216.174895] [<8046d8a4>] (driver_attach) from [<8046d40c>] (bus_add_driver+0x110/0x21c)
    [ 216.174947] [<8046d2fc>] (bus_add_driver) from [<8046e71c>] (driver_register+0x80/0xfc)
    [ 216.174995] r7:7f1ba1b4 r6:7f1bb2ac r5:80c25c34 r4:7f1bb2ac
    [ 216.175031] [<8046e69c>] (driver_register) from [<804e2edc>] (usb_register_driver+0x78/0x13c)
    [ 216.175076] r5:80c25c34 r4:7f1bb278
    [ 216.175119] [<804e2e64>] (usb_register_driver) from [<7f1bd024>] (pctv452e_usb_driver_init+0x24/0x2c [dvb_usb_pctv452e])
    [ 216.175173] r9:a97f5464 r8:00000000 r7:a97f5500 r6:a97f5440 r5:ffffe000 r4:7f1bd000
    [ 216.175238] [<7f1bd000>] (pctv452e_usb_driver_init [dvb_usb_pctv452e]) from [<8010179c>] (do_one_initcall+0x4c/0x174)
    [ 216.175295] [<80101750>] (do_one_initcall) from [<80199f5c>] (do_init_module+0x68/0x3ac)
    [ 216.175344] r8:00000003 r7:a97f5500 r6:a97f5440 r5:00000001 r4:7f1bb380
    [ 216.175383] [<80199ef4>] (do_init_module) from [<80185358>] (load_module+0x1b60/0x209c)
    [ 216.175430] r7:00000001 r6:a97f5440 r5:00000001 r4:a97c3f44
    [ 216.175465] [<801837f8>] (load_module) from [<80185a9c>] (SyS_finit_module+0xb0/0xc0)
    [ 216.175516] r10:00000000 r9:a97c2000 r8:80107b44 r7:0000017b r6:76e95787 r5:00000012
    [ 216.175558] r4:00000000
    [ 216.175594] [<801859ec>] (SyS_finit_module) from [<801079a0>] (ret_fast_syscall+0x0/0x34)
    [ 216.175639] r6:00000000 r5:00000000 r4:76d8c388
    [ 216.175671] Code: e50b9030 e3e05000 e50b302c e3a08002 (e5832000)
    [ 216.175765] ---[ end trace 9dbe9db30f383890 ]---
    LibreELEC:~ # C

    will try to patch 7.90.009 since this works for me...

    Edited once, last by Ognian (December 30, 2016 at 6:19 PM).

  • Please don't post logs to the forum - use a pastebin site and post the link.

    7.90.009 is based on the 4.8.12 kernel while 7.90.010 is based on the 4.9.0 kernel - make sure your patch is compatible with the kernel you are building.

  • OK,
    I have an rpi3 and a TT S-3650-CI with a HH90 Rotor.
    Without the rotor everything woks, but as soon as the rotor is between the receiver and the dish, everything stops working.
    This is a well known problem of the TT S-3650-CI and the original driver author provided a patch in an email (Fwd: various patches for TT S2-3650 CI — Linux media)
    His patch provided additional improvements too, but somehow this patch did not find the way into current driver sources.

    I was now able to apply the patch manually on top of 7.90.009, and it really WORKS. I still have to check a lot of things, like if I can configure tvheadend to really use the rotor etc. (I need some more time for this) but basically it works and should work with 7.90.010 since source (at least for lnbp22.c) has not changed.

    I first tried with 7.90.010 but it has a problem with my HW. I did not digg deeper into this for now, I only saw the above demesg dump.

    As soon as I finish testing, I will provide the patch via PR, so that it can be included in the next release...
    This will take some time since my build environment is a little bit slow...

  • Ok did a clean rebuild of the latest (yesterday) master, but I always get the above error:
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    this is without my patch. So the current master is broken for the pctv452e driver.
    Any idea what may have caused this?
    Where exactly is the linux repo on github? Maybe I can see what changes happened between 4.8.12 and 4.9 on pctv452e and find the cause...
    [hr]
    In Linux 4.8.12 we have the following:
    [C] static int pctv452e_rc_query(struct dvb_usb_device *d) { struct pctv452e_stat - Pastebin.com
    in 4.9:
    [C] static int pctv452e_rc_query(struct dvb_usb_device *d) { struct pctv452e_stat - Pastebin.com
    I'm not sure if it is a good idea to use state->data also instead of rx ;
    maybe it shall be alocated too like in the previous function...

    Any ideas?

    Edited once, last by Ognian (January 3, 2017 at 6:04 PM).

  • I debugged the 4.9 pctv452e.c driver via debug printf's
    It fails in the following function:static int pctv452e_power_ctrl(struct dvb_usb_device *d, int i)
    {

    at the following statement:
    mutex_lock(&state->ca_mutex);
    Could it be that something with mutex_lock is different on rpi?
    I have now no more Ideas how to continue...