configuring swap

Hi,

Currently I’m trying to set up swap space on the Jetson TX-1, but I’ve run into problems that indicate the the kernel that comes installed does not have swap functionality set up (i.e., the kernel needs to be built with CONFIG_SWAP=y). I guess I’m just posting to find out–has the community come up with a good solution to this? Do I need to figure out how to recompile the kernel for ARM?

Thanks

(P.S. It looks like this was discussed some months ago here: https://devtalk.nvidia.com/default/topic/894945/jetson-tx1/jetson-tx1/8)

Indeed, swap feature is not available as a module. Therefore the whole kernel requires recompile. Cross-compile complicates things since there are both 32-bit and 64-bit compilers involved, but it isn’t too bad. If your package manager on your desktop does not have appropriate cross tool chains, or if it gets complicated, I’d recommend grabbing the latest version 5.2 Linaro compilers here:
[url]https://releases.linaro.org/components/toolchain/binaries/[/url]

The 64-bit compiler there is aarch64-linux-gnu. The 32-bit compiler is arm-linux-gnueabihf (those are the ones I use…I wonder if armv8l-linux-gnueabihf works…never tried it).

Thanks so much for the help!

Yes I have currently accepted that I will need to cross compile the kernel. Sorry if I sound like an idiot, but there are a few things I’m not clear on…

When I type uname -a, I get:
tegra-ubuntu 3.10.67-gcdddc52

If I want to compile a kernel myself, can I just download the regular Linux kernel version 3.10.67, or are there special sources I have to get from NVIDIA? I found this page:

It refers to the “Tegra Linux Driver Package”–is this something I need?

Basically the goal here is to have the exact same kernel I have currently with all the same build settings, except with swap enabled instead of disabled.

Thanks so much!

The “-gcdddc52” would be a git repository checksum. This is applied to 3.10.67. What the difference is between that git version and the downloadable L4T version I do not know. You would be safest downloading from the link you mentioned above. Search for “Kernel sources”.

The driver package is the flash program and everything you need for basic flash, except for the sample rootfs. Kernel changes when u-boot is the boot loader (and in JTX1 it is) do not require flash to update.

The JTX1 ships with the same configuration as kernel target “make tegra21_defconfig”. This also matches the running default kernel output in /proc/config.gz. With CONFIG_LOCALVERSION set to “-gcdddc52” to match the suffix of “uname -r”, this becomes an exact match. Alter swap to be enabled, and you’re ready to go. Because swap is built integrated into the kernel, and is not available as a module, I’d advise altering the CONFIG_LOCALVERSION suffix to something like “-gcdddc52_1” and populating a new module directory.

My advice summary on this: Build the kernel with “-gcdddc52_1”, copy the completed Image (and if you want, zImage) to JTX1 /boot/ as “Image-3.10.67-gcdddc52_1”; create “/lib/modules/3.10.67-gcdddc52_1”; recursively copy “/lib/modules/3.10.67-gcdddc52/extra/” to “/lib/modules/3.10.67-gcdddc52_1/extra/”; install all of the new modules to “/lib/modules/3.10.-gcdddc52_1/”, and then add or edit an entry in /boot/extlinux/extlinux.conf while leaving the old “/boot/Image” entry as a rescue entry. Serial console will let you select which entry to boot, so you don’t have to hard code while testing.

Thanks again for the reply!

“You would be safest downloading from the link you mentioned above. Search for “Kernel sources”.”

The page I linked above doesn’t indicate any kernel sources. Confusingly, if you search “Linux Tegra Driver Package” that page comes up, but then it lists “Linux Tegra Driver Package providing a kernel image” as a prerequisite. The best I could find on the internet was this .pdf file from 2014:
http://developer.download.nvidia.com/mobile/tegra/l4t/r21.1.0/Tegra_Linux_Driver_Package_UBoot_R21.1.pdf
Maybe this is the right track, not sure…

“The JTX1 ships with the same configuration as kernel target “make tegra21_defconfig””
So I was curious about this–where is this target? Are there kernel makefiles that NVidia uses somewhere out there to download? What I’m imagining is that I can find the sources along with the build options somewhere, then it would just be a matter of changing the swap setting and initiating the build (of course, possibly after having to install a cross compiler toolchain)

Probably at some point I can spend more time sleuthing through these documents but if someone wants to reply with the fast/easy answer, it would be super appreciated!

Thanks!

The TX1 kernel is in the L4T R23.1 release. See this for R23.1:
[url]https://developer.nvidia.com/embedded/linux-tegra[/url]

On that page is a subsection for “Source Packages”. Within that subsection is “Kernel sources”. You might need to be logged in for a download, but here is the direct link for the kernel source:
[url]http://developer.download.nvidia.com/embedded/L4T/r23_Release_v1.0/source/kernel_src.tbz2[/url]

The Makefile is embedded within the kernel source for all kernels, regardless of which distribution or packager. Running “make tegra21_defconfig” produces a “.config” (assuming the kernel source is tegra21-aware). Whatever you use as an option to “make” is the target…“make mrproper” has mrproper as the target…which just cleans it up to pristine…“make modules” has all configured modules as target…so on. The target from “make menuconfig” executes a GUI for further configuration…thus mrproper target to clean up, tegra21_defconfig to get an initial .config, then menuconfig as the target to run a GUI editor (some other editor options also exist). To run “make menuconfig” you’ll need to be sure package “libncurses5-dev” is installed (this provides dependencies for the menu GUI, e.g., via “apt-get install libncurses5-dev”).

Oh okay, thanks so much for the info!