[CustomKernel] The Grinch 21.3.4 for Jetson TK1 / developed

Hello everyone - I’m back for good :) I do not know why, but this release disappeared on the forum. So I decided to restore it.

Jetson TK1 “The Grinch” Custom Kernel 21.3.4 (1 May 2015)

  • Added Overlay filesystem support
  • Added Deadline and CFQ I/O scheduler
  • Fixed screen shifting in Oculus Rift DK2 (See HINT #1)

Jetson TK1 “The Grinch” Custom Kernel 21.3.3 (26 April 2015)

  • Added more DVB digital devices drivers
  • Added Analog TV support
  • Added Docker support: POSIX_MQUEUE, CGROUP_PERF, CFS_BANDWIDTH
  • Added Ext4 Security Labels
  • Added Btrfs filesystem support
  • Added aufs3 filesystem support
  • Added kernel source package (see 9)

Jetson TK1 “The Grinch” Custom Kernel 21.3.2 (6 April 2015)

  • Added RTC i2c drivers
  • Fixed VFP flushing regression on sigreturn path
  • Fixed Nintendo Nunchuck I2c driver

Jetson TK1 “The Grinch” Custom Kernel 21.3.1 (3 April 2015)

  • Added support for Oculus Rift DK2
  • Added support for XBOX One controller
  • Added support for Dualshock 4 controller
  • Added support for Logitech F310 and F710 controller
  • Added support for Nintendo Nunchuck (i2c devices)
  • Added X-Box gamepad driver: rumble & led support
  • Added RAM block device support with XIP filesystems
  • Added Packet writing on CD/DVD media
  • Added Device mapper support for crypt, snapshot, mirror, thin provisioning, zero, multipath, i/o delaying, flakey target targets and more
  • Added support for MISC binaries
  • Added User mode SPI device driver support
  • Added support for TEGRA AES hw engine
  • Added AES cipher algorithms (ARM-asm)
  • Added XTS support
  • Added Cryptoloop support
  • Added Tegra CEC support and enabled
  • Added /dev/hidraw & /dev/hiddev device support
  • Added Battery level reporting for HID devices
  • Added ReiserFS, SquashFS 4.0, UFS, LogFS
  • Added Apple Macintosh & Extended HFS file system support
  • Added native exFat and VFat support
  • Added ISO 9660 CDROM and UDF file system support
  • Added Quota support
  • Added AutoFS support
  • Added CIFS statistics, CIFS extended attributes, DFS feature support. SMB2 network file system support
  • Added Provide swap over NFS support
  • Added NFS Client/Server v4 support
  • Added USB Printers support
  • Added various USB Serial Converter modules
  • Added Parallel port support
  • Added IEEE 1394 (FireWire) support
  • Added IrDA subsystem support
  • Added Kinect and Playstation Eye drivers
  • Adddd high-speed modes for the PS3 Eye camera (QVGA capture at higher frame rates: 187, 150, and 137 FPS)
  • Added ALSA Sequencer support
  • Added Generic loopback driver (PCM)
  • Added support for FireWire sound devices
  • Added more Wireless LAN modules for Atheros, Intel, Ralink, Realtek, Broadcom devices
  • Added 802.1d Ethernet Bridging support
  • Added lots filters for Netfilter
  • Added Ethernet Bridge tables (ebtables) support
  • Added support for IPv6: Netfilter
  • Added QoS fair queueing suppor
  • Support for lxc: namespaces, MAC-VLAN, 802.1Q/802.1ad VLAN, Virtual ethernet pair device
  • Added Device controller for cgroups
  • Added Support multiple instances of devpts
  • Added Memory Resource Controller for Control Groups
  • Digital TV support & Remote Controller support & DVB USB drivers
  • Disabled default USB autosuspend
  • Increase DMA_COHERENT_POOL_SIZE from 256k to 1M
  • Enabled CONFIG_FHANDLE

1) Install L4T 21.3

Note: This steps must be performed on the host computer. If you have already installed L4T 21.3, you can skip this points.

wget http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/Tegra124_Linux_R21.3.0_armhf.tbz2
wget http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/Tegra_Linux_Sample-Root-Filesystem_R21.3.0_armhf.tbz2

Extract files:

tar -xvf Tegra124_Linux_R21.3.0_armhf.tbz2
cd Linux_for_Tegra/rootfs
sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R21.3.0_armhf.tbz2

Apply binaries:

cd ..
sudo ./apply_binaries.sh

Flash Jetson TK1:

sudo ./flash.sh jetson-tk1 mmcblk0p1

2) Login to Jetson TK1

3) Download Grinch Kernel

wget http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/zImage
wget http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/jetson-tk1-grinch-21.3.4-modules.tar.bz2
wget http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/jetson-tk1-grinch-21.3.4-firmware.tar.bz2

4) Check MD5 sums

md5sum zImage 
a4a4ea10f2fe74fbb6b10eb2a3ad5409  zImage
md5sum jetson-tk1-grinch-21.3.4-modules.tar.bz2 
3f84d425a13930af681cc463ad4cf3e6  jetson-tk1-grinch-21.3.4-modules.tar.bz2
md5sum jetson-tk1-grinch-21.3.4-firmware.tar.bz2
f80d37ca6ae31d03e86707ce0943eb7f  jetson-tk1-grinch-21.3.4-firmware.tar.bz2

5) Update kernel

sudo tar -C /lib/modules -vxjf jetson-tk1-grinch-21.3.4-modules.tar.bz2
sudo tar -C /lib -vxjf jetson-tk1-grinch-21.3.4-firmware.tar.bz2
sudo cp zImage /boot/zImage

If you want enable SPI download & replace DTB file:

wget http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/tegra124-jetson_tk1-pm375-000-c00-00.dtb -O /boot/tegra124-jetson_tk1-pm375-000-c00-00.dtb

SPI will be visible on /dev/spidev0.0

6) Reboot

7) Known issues

  • Problem with AR9462

8) ToDo

9) Sources

wget http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/jetson-tk1-grinch-21.3.4-source.tar.bz2
sudo tar -C /usr/src -vxjf jetson-tk1-grinch-21.3.4-source.tar.bz2

or patches:

http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/001-patch-21.3-disable_autosuspend.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/002-patch-21.3-dma_pool_size_1m.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/005-patch-21.3-dvb1.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/006-patch-21.3-fix-uid-gid.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/011-patch-21.3-exfat.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/012-patch-21.3-hid_raw_request_output_report_quirks.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/013-patch-21.3-dualshock4.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/014-patch-21.3-xboxone-logitechfxx.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/015-patch-21.3-wii.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/019.patch-21.3-cec.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/020.patch-21.3-fix-parent-clock.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/021-patch-21.3-ps3eye-qvga.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/022.patch-21.3-vfp-states.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/023-patch-21.3-ds1307.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.3/030-patch-21.3-aufs3.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/031-patch-21.3-use_constrait_workaround.diff
http://www.jarzebski.pl/files/jetsontk1/grinch-21.3.4/032-patch-21.3-overlayfs.diff

If you like my work, you can donate me on paypal: paypal@jarzebski.pl

Thanks to: Peter Bauer, David Cofer, Dustin Franklin, Todd Stellanova, Richard Joyce, Daniel Babcock, Ray Connell, Dale von Ruden

HINT 1 - How to fix screen shifting in Oculus Rift DK2

  1. Add hdmi.use_constrait_workaround=0 to boot/extlinux/extlinux.conf

  2. If you have some screen glitches, you must maximise the clocks (i can’t post e_c_h_o, so remove one “o”)

echoo 852000000 > sys/kernel/debug/clock/override.gbus/rate
echoo 1 > /sys/kernel/debug/clock/override.gbus/state

http://elinux.org/Jetson/Performance / Controlling GPU performance section

Awesome! I was wondering what happened. Thank you very much and best wishes!

my newly installed jetson tk1 has # R21 (release), REVISION: 4.0.
I need to compile the kernel (need to change USB memory size support), I first followed your guide:
https://devtalk.nvidia.com/default/topic/762653/jetson-tk1/-howto-build-own-kernel-for-jetson-tk1/1
but compilation throws several errors…
could you provide me some pointer to how to compile an uptodate kernel?
Would I be ok to dowload the sources in this post and compile following the guide in your previous post¿?
Thanks,
Angel

Did you patch kernel (21.3.4) patches above? I recomended compile kernel with one thread on make -j1.
Can you show an error message when compiling?

Awesome thanks, looks like I know what im doing after work!

Hello,
are there any plans to get kernel 3.10.67 running?

Sorry for taking so long to reply. The errors during compilation were with the kernel downloaded from: https://devtalk.nvidia.com/default/topic/762653/-howto-build-own-kernel-for-jetson-tk1/
I did not save the error logs and I have reflashed my board now, but I was using -j4 so that might have been the issue.
The steps above correctly installed the grinch kernel (although it also erased all my system (e.g. cuda installation, etc)). Also downloading the sources and compiling the kernel works OK. My question now is, once I have recompiled the kernel, how do I install it, do I need to reflash with the new zImage?

Apologies ahead of time for the depth of this…hopefully this can be pointed at in other threads when the kernel install question comes back up. This is intentionally beyond the details requested in order to actually know what install mechanics are for kernels under U-boot. Actual practice is far easier than this will make it look…U-boot simplifies install compared to the older fastboot, but background in the topic adds confusion at times. FYI, fastboot requires custom partitions reserved for booting, while U-boot simply reads files from the root partition.

Installing Grinch should not erase the system, or anything at all. Flashing the system does re-install the whole system, but if u-boot is the boot loader (default for the current R21.x series), then no flash is required for kernel or kernel module install. I’ll assume you compiled directly on Jetson for what follows, and that your JTK1 has something like L4T R21.4 installed (versus the R19.2 JTK1 arrives with).

In the kernel source where you compiled and will install from, what is CONFIG_LOCALVERSION set to?

grep CONFIG_LOCALVERSION .config

Normally the R21.x kernels are base version “3.10.40”. With LOCALVERSION appended, the full version is “3.10.40-gdacac96” (and “uname -r” would respond with this). Thus install of modules would automatically use “/lib/modules/3.10.40-gdacac96” as destination, and this kernel would look there for its modules. “make modules_install” would place any updates there. If the old kernel and new kernel have these versions in common, then they would share and re-use the modules there. Often people building a kernel forget to set LOCALVERSION and it ends up looking instead at “/lib/modules/3.10.40”. Some of the files in the original module directory are supplied in binary form from nVidia, and thus change in full version (which includes LOCALVERSION) could be an issue if original directory is not re-used and “extra” modules are not copied over to the new directory. So normally set CONFIG_LOCALVERSION to the original value, and “make modules_install” is all you need for modules. CONFIG_LOCALVERSION, under make menuconfig, is found in “General setup ----> Local version”. If you forgot to set CONFIG_LOCALVERSION, save your .config by another name, make mrproper, put the saved config back in as .config, set your CONFIG_LOCALVERSION, and build again.

Note that Grinch could be far enough different from the original kernel source that you would actually want to use a completely different CONFIG_LOCALVERSION. Some changes to the base kernel prevent various modules from loading correctly. In this case, install of a new module directory would be required. So you might end up with “/lib/modules/3.10.40-grinch_1” or similar (base version 3.10.40, CONFIG_LOCALVERSION “-grinch_1”). You would want to recursively copy the “extra” directory of the original module tree over to the new module tree (these are the nVidia modules). Example:

# compile and build and make modules_install with "-grinch_1"...
cd /lib/modules/3.10.40-gdacac96
cp -adpR extra ../3.10.40-grinch_1

Under u-boot, the kernel itself could replace the old kernel simply by overwriting the original /boot/zImage with the new zImage. I wouldn’t recommend that. Instead I would recommend leaving the old kernel in place, and adding the new kernel with a good name, such as “/boot/zImage-3.10.40-grinch_1”. The file /boot/extlinux/extlinux.conf is a list of what gets booted, and is human-readable. extlinux.conf arrives with only one kernel listed. This is the statement for loading the default kernel, which can be duplicated and edited:

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/zImage
      FDT /boot/tegra124-jetson_tk1-pm375-000-c00-00.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 mem=2015M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal fbcon=map:1 commchip_id=0 usb_port_owner_info=0 lane_owner_info=6 emc_max_dvfs=0 touch_id=0@0 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt

U-boot reads extlinux.conf directly. U-boot uses the kernel which the “LINUX” tag names ("/boot/zImage"). The serial console, when used for selecting kernels of a multi-kernel option, uses the “MENU LABEL” to describe which kernel is used to the user. The very top of extlinux.conf has label “DEFAULT”, which names the LABEL it will use if no manual selection is requested…“LABEL primary” is for the boot loader to use, “MENU LABEL primary kernel” is for human users at the serial console prompt. Carefully note that the “APPEND” line is one very long line, and even if editors line wrap, this must remain a single line. These values get passed directly to the kernel.

You can copy that entire kernel selection block to a new block, then edit the “LABEL” and “MENU LABEL” to something new…then the serial console prompt would show this new entry. If nothing else changes, this would be exactly the same as the original kernel boot, except for labels. You could edit the original entry to “MENU LABEL Grinch”, and the serial console prompt would then show the default entry as “Grinch”…but it wouldn’t really change anything. You would then edit the “LINUX” line to your new kernel name, e.g., “/boot/zImage-grinch_1”, and now the default boot would be to the changed Grinch kernel. If that Grinch kernel were based on version 3.10.40, and if CONFIG_LOCALVERSION were set to “-grinch_1”, then the module loader would automatically search for modules at “/lib/modules/3.10.40-grinch_1”.

As an example, compiling a Grinch 3.10.40 source tree with CONFIG_LOCALVERSION set to “-grinch_1”, and installed as the new default kernel (while saving the old one) could be done as follows so far as install goes (details are left out on configuration):

# cd to kernel source, do all the build steps (including LOCALVERSION "-grinch_1" setting)...
make zImage
make modules
make modules_install
# Verify that /lib/modules/3.10.40-grinch_1 now exists.
cp arch/arm/boot/zImage /boot/zImage-grinch_1
# Edit /boot/extlinux/extlinux.conf...


### New extlinux.conf looks like (this includes setting USB3 and not USB2...part of APPEND via usb_port_owner_info):
IMEOUT 30
DEFAULT grinch_1

MENU TITLE Jetson-TK1 eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/zImage
      FDT /boot/tegra124-jetson_tk1-pm375-000-c00-00.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 mem=2015M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmubo
ard=0x0177:0x0000:0x02:0x43:0x00 tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40
.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal fbcon=map:1 commchip_id=0 usb_port_owner_info=0 la
ne_owner_info=6 emc_max_dvfs=0 touch_id=0@0 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt

LABEL grinch_1
      MENU LABEL Grinch 1
      LINUX /boot/zImage-grinch_1
      FDT /boot/tegra124-jetson_tk1-pm375-000-c00-00.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 mem=2015M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmubo
ard=0x0177:0x0000:0x02:0x43:0x00 tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40
.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal fbcon=map:1 commchip_id=0 usb_port_owner_info=2 la
ne_owner_info=6 emc_max_dvfs=0 touch_id=0@0 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt

This example would take care of installing Grinch as a default kernel while leaving the original kernel in place for tasks like “rescue”. The serial console would allow selecting either the original as “primary kernel” or Grinch as “Grinch 1”. The new Grinch 1 entry would set USB as USB3. Both would use the same firmware (see the “FDT” entry of extlinux.conf). Grinch would search for modules in “/lib/modules/3.10.40-grinch_1/”; the old kernel, if booted by manual selection at boot time, would look for modules in “/lib/modules/3.10.40-gdacac96/”. Command “uname -r” would respond “3.10.40-grinch_1” for the Grinch kernel, the original kernel would respond to “uname -r” as “3.10.40-gdacac96”.

In some cases firmware needs adjusting, especially where wireless is concerned. The FDT entry does not name firmware…the FDT entry is about arguments being passed to the firmware. It’s very possible (and common) that a firmware file will change, but arguments being passed do not change. The firmware itself is in “/lib/firmware/”, and often this has additions without ever changing FDT entries. Should a new kernel require a new FDT entry, one would examine the extlinux.conf FDT line and place an alternately named FDT file in “/boot”, followed by edit of this FDT entry to the new file name.

@great_humungus: yes, new version is still cooking :) soon will be updated

Thanks a lot @Santyago and @linuxdev for the detailed explanations.
Following linuxdev steps I was able to install a custom kernel, everything worked perfectly.

@Santyago: that are good news, thank you!

Thanks Santyago, not sure if there is any github repo for your source code?

Hello Santyago,

while trying to install L4T 21.3 before installing Grinch, my ethernet connection went off and the download was cancelled. After that I cannot login to my GUI. I don’t know why. I tried everything I read in the blogs i found. It accepts my password screen flashes and then come back on the login screen. I can login without X using the console though by typing Ctl+Alt+F1. I also errors trying some sudo apt-get commands saying that there are no space available. Df -h command shows that my memory is full. I don’t know what to do. Any help would be appreciated much.

Thanks AJ

Hi AJ_Fernando, did you try to reinstall L4T via JetPack? Putting the system in flashing mode should bypass all the issues you’re having.

Hello,

First of all: great work on the kernel and thank you for grinch.
I am experiencing and issue with Intel Wireless 5100 (PCIe). Some users have had similar problems.

The error I receive (also for grinch) is:

pcie bus error severity=uncorrected (non-fatal) type=transaction layer id=0000
unhandled fault: imprecise external abort (0x1406) at 0x0000000

This happens of course if I plug the card and boot.
Is there any way that I could patch this?

What I already tried (none worked):

I would be glad to work through the code myself. Maybe I should include some drivers (this seems to be a driver error). Or perhaps I should debug the kernel? I am new to this but willing to invest and learn.

Could you please point me in a proper direction? Should I start with the grinch sources?

If the patch/fix is not possible, maybe at least recommend a different stable wifi card, that might work.

Any response will be much appreciated.

Best regards
rafak.

If you run the command “lspci”, you’ll see a list of PCIe devices (possibly just the one). The left column will have an ID…for example my desktop has an nVidia video card listed which starts with “01:00.0”. You can list just this one device via something like “lspci -s 01:00.0”. You can then get verbose listing of just this device via (change the 01:00.0 to whatever your WiFi card is):

sudo lspci -s '01:00.0' -vvv

Posting the output to this would give more details on the error.

2 questions.

Is this safe to use on 21.4?

Updating the kernel isn’t going to reformat my jetson and all its files or settings right?

R21.4 uses u-boot for the boot loader, so adding the Grinch kernel is nothing more than copying files (the fastboot boot loader is a different story…this was used in the original R19.2 release…u-boot took over for R21.x). If you have a serial console connected, you can even leave the entire original kernel and pick at boot time which kernel to use.

To illustrate, the default kernel in R21.4 is “3.10.40-gdacac96”. The original kernel in /boot is just file “zImage”, but it probably would have been better to name it “zImage-gdacac96”. To create an alternate entry and leave the original kernel in place while testing, you might copy the Grinch kernel to /boot using a name like “3.10.40-gdacac96_grinch”. Then the /boot/extlinux/extlinux.conf can have an entry from the default duplicated, followed by editing its label and pointing to the alternate kernel zImage name. At boot, using serial console, you could select the alternate entry while the original entry stays in place. No flash required.

Other steps might be required to complete this, e.g., modules are always searched for in “/lib/modules/$(uname -r)/”. If the kernel is built with an alternate versioning, then you need an alternate module directory. Grinch adds lots of WiFi drivers, and so there may also be firmware files to add in “/lib/firmware/”.

Finally, you can always clone your root partition before you do anything serious, and if you want to go back you can completely restore the entire partition. See cloning:
http://elinux.org/Jetson/Cloning

Hello linuxdev,

The problem is that I cannot get to the commandline. I mean I can do this with the default Jetson kernel provided by nVidia, but one I install Grinch and plug in my card to PCIe - the kernel does not boot. It stops on the error I posted. If I unplug the card and reboot - it boots normally.
Some users mentioned this behaviour:

https://devtalk.nvidia.com/default/topic/766303/jetson-tk1/-customkernel-the-grinch-19-3-8-for-jetson-tk1-developed/post/4292012/#4292012
https://devtalk.nvidia.com/default/topic/766303/jetson-tk1/-customkernel-the-grinch-19-3-8-for-jetson-tk1-developed/post/4300553/#4300553
https://devtalk.nvidia.com/default/topic/766303/jetson-tk1/-customkernel-the-grinch-19-3-8-for-jetson-tk1-developed/post/4304898/#4304898

If I run the default kernel then i get a normal output (there is a network card).
But I cannot get it to work.
I will reflash with the default kernel and I shall return to this topic.

Thank you for your time.

Best regards
R.

Once more thing: Once unplugged and replugged it doesn’t show up until reboot (no PCIe hotplug feature)