[HowTo] Build own kernel for Jetson TK1

unfortunately not :( i don’t have any CSI cameras yet. I bought while at the various mini-pcie card and other accessories have to wait. Sorry - i cannot help you for now :(

Hi extend_chen, I have the encountered a similar issue. In the end I found out that I used a wrong kernel source branch(I git clone the source from git://nv-tegra.nvidia.com/linux-3.10.git, but checkouted a wrong branch), the daily-2014.06.30.0_l4t/l4t-r19.3 branch works for me. Hope this can help.^ ^

For further speedup, you can add -j4 when compiling modules. So step 1d) looks like this:

make -j4
make modules <b><i>-j4</i></b>
make modules_install

Hey Santyago - I grabbed the patches but I’m running the following kernel.

Linux tegra-02.mpi.home.lan 3.10.24-grinch-19.3.6 #5 SMP PREEMPT Sun Aug 31 17:56:59 UTC 2014 armv7l armv7l armv7l GNU/Linux

I downloaded the source as mentioned above, applied patches, and zcat > .config the kernel config. It seems to get a fatal compile error:

arch/arm/kernel/corenpdrq.c: In function ‘read_dbgprcr’:
arch/arm/kernel/corenpdrq.c:35: error: expected string literal before ‘)’ token
make[1]: *** [arch/arm/kernel/corenpdrq.o] Error 1
make[1]: *** Waiting for unfinished jobs....
  CC      mm/filemap.o
make: *** [arch/arm/kernel] Error 2
make: *** Waiting for unfinished jobs....
  CC      mm/mempool.o
  CC      mm/oom_kill.o
  CHK     kernel/config_data.h
  CC      mm/fadvise.o
  CC      mm/maccess.o
  CC      mm/page_alloc.o
  CC      mm/page-writeback.o
  CC      mm/readahead.o
  CC      mm/swap.o
  CC      mm/truncate.o
  CC      mm/vmscan.o
  CC      mm/shmem.o
  CC      mm/util.o
mm/vmscan.c: In function ‘debug_shrinker_show’:
mm/vmscan.c:171: warning: unused variable ‘name’
  CC      mm/mmzone.o
  CC      mm/vmstat.o
  CC      mm/backing-dev.o
  CC      mm/mm_init.o
  CC      mm/mmu_context.o
  CC      mm/percpu.o
  CC      mm/slab_common.o
  CC      mm/compaction.o
  CC      mm/balloon_compaction.o
  CC      mm/interval_tree.o
  CC      mm/fremap.o
  CC      mm/highmem.o
  CC      mm/madvise.o
  CC      mm/memory.o
  CC      mm/mincore.o
  CC      mm/mlock.o
  CC      mm/mmap.o
  CC      mm/mprotect.o
  CC      mm/mremap.o
  CC      mm/msync.o
  CC      mm/rmap.o
  CC      mm/vmalloc.o
  CC      mm/pagewalk.o
  CC      mm/pgtable-generic.o
  CC      mm/process_vm_access.o
  CC      mm/init-mm.o
  CC      mm/bootmem.o
  CC      mm/memblock.o
  CC      mm/bounce.o
  CC      mm/page_io.o
  CC      mm/swap_state.o
  CC      mm/swapfile.o
  CC      mm/dmapool.o
  CC      mm/slab.o
  CC      mm/failslab.o
  CC      mm/migrate.o
  CC      mm/page_isolation.o
  LD      mm/built-in.o

Sigkill try compile without jobs -j4. I noticed that compiling multithreaded does not always end successfully

Here comes the question that when i try to flash the Jetson TK1 board as you done above ,at final it shows that the boot.img cannot be found ,so fail to download the partition.can you please give me some suggestions?

*** Updating 6:LNX with boot.img ***
./nvflash --download 6 boot.img --bl fastboot.bin --go
Nvflash 4.13.0000 started
BR_CID: 0x3400100174099247180000000f040080
rcm version 0X400001
System Information:
chip name: unknown
chip id: 0x40 major: 1 minor: 1
chip sku: 0x0
chip uid: 0x0000000174099247180000000f040080
macrovision: disabled
hdcp: disabled
jtag: disabled
sbk burned: false
board id: 0
warranty fuse: 0
dk burned: false
boot device: emmc
operating mode: 3
device config strap: 0
device config fuse: 0
sdram config strap: 0

RCM communication completed
downloading bootloader – load address: 0x83d88000 entry point: 0x83d88000
sending file: fastboot.bin

  • 594363/594363 bytes sent
    fastboot.bin sent successfully
    waiting for bootloader to initialize
    bootloader downloaded successfully
    file not found: boot.img
    failed executing command 2147483647 NvError 0x4
    partition download failed
    Failed to flash ardbeg.

Which L4T version are you attempting to flash? I’m guessing either R19.3 or R21.1.

What is the exact command line you are using to flash, and are you doing EVERYTHING as root (this is mandatory) or sudo?

Last, is your host running on a native linux file system (mandatory to preserve permissions and create device special files)?

sure it’s R21.1,and i comfire use the root like “sudo su”,the mechine i use is ubuntu 14.04 and during the process here hadn’t other question

What command line did you use for flash.sh? This is probably the most important question.

Also, do you have at least 15 GB free space (preferably more) on your host that you run flash.sh from (e.g., “df -H -T .” from the flash.sh directory to see space and verify type ext3 or ext4)?

To make sure you’re always root, type sudo sh and enter password when you first open terminal. After that, you don’t need sudo in front of any command unless you close that terminal window. Keep in mind that this will make root the owner of all files and folders you create in this window.

Though i cannot explain why it successed finally,but thanks your kind all above!
Now another problem occured,when i use the conmand line such as "sudo apt-get install "after “sudo apt-get update” and “sudo apt-get upgrade”,it always shows that “unable to locate the package” or “package…has no installation candidate”,while in my pc with the same source.list it works ok!So what can i do for this problem?

Keep in mind that most linux distributions come with a certain number of basic or required package management repositories (where packages are stored) already configured. You will have to activate more if you want more. There are commands you can issue straight from apt command line, but I’m not as familiar with apt as I am with other distributions…so I just go to /etc/apt/sources.list and uncomment the commented out repositories (the hash mark ‘#’ deactivates a line…you might have to apt-get update before it sees them).

Once you have your repositories available, keep in mind that programs (or their interpreters) have to be compiled for a specific CPU architecture. Your desktop is some variation of x86, but Jetson is ARMv7. If the ARMv7 version was not yet ported to the new architecture, it won’t be in a repository. Programs which do not depend on specific CPU features tend to be available everywhere…others which are using unique features tend to not be ported or tend to be ported much later. Try “apt search ” to find packages.

Are these instructions still valid? I went through them and only enabled a couple of additional flags in the config file (ALSA sequencer and loopback), but the compile is failing with this error:

kernel/sched/core.c: In function ‘cpu_cgroup_allow_attach’: 
kernel/sched/core.c:7757:18: error: invalid operands to binary != (have ‘kuid_t’ and ‘kuid_t’) 
       cred->euid != tcred->uid && cred->euid != tcred->suid) 
                  ^ 
kernel/sched/core.c:7757:46: error: invalid operands to binary != (have ‘kuid_t’ and ‘kuid_t’)
       cred->euid != tcred->uid && cred->euid != tcred->suid) 
                  ^
make[2]: *** [kernel/sched/core.o] Error 1
make[1]: *** [kernel/sched] Error 2
make: *** [kernel] Error 2

One other thing that might be worth nothing is that if I do this:

zcat /proc/config.gz > .config
zcat /proc/config.gz > .config.BACKUP

And then I “make menuconfig” and just immediately exit with a save, there is a diff between .config and .config.BACKUP. As if some of the config options that are currently in /proc/config.gz are not recognized and don’t get written back out by menuconfig.

Specifically:

root@tegra-ubuntu:/usr/src/kernel# diff .config .config.BACKUP
4175a4176,4178
> CONFIG_R8188EU=m
> CONFIG_88EU_AP_MODE=y
> CONFIG_88EU_P2P=y
4492a4496
> CONFIG_PWM_SYSFS=y
4566a4571,4577
> CONFIG_EXFAT_FS=y
> CONFIG_EXFAT_DISCARD=y
> # CONFIG_EXFAT_DELAYED_SYNC is not set
> # CONFIG_EXFAT_KERNEL_DEBUG is not set
> # CONFIG_EXFAT_DEBUG_MSG is not set
> CONFIG_EXFAT_DEFAULT_CODEPAGE=437
> CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"

Including some of the options may cause errors and need to improve.

OK… so it turns out that the error is directly related to trying to enable ALSA midi sequencer in the kernel. Meaning, it’s absolutely related to what I changed. :)

or use my patch for uid/gid fix: http://www.jarzebski.pl/files/jetsontk1/patch/patch-19.3-giduid_fix.diff

Well, that defintiely looks like what I need.

Thanks again, Santyago!

So, I just ran into the same problem reported by cedar_luo in this earlier comment. His issues mysteriously went away, but I’m trying to debug the problem.

At first glance it looks like there are bugs in the version of the “flash.sh” script that I have. that script works fine for full flashes (maybe that’s what got cedar_luo going again), but it chokes on an attempt to just flash the kernel.

Still poking around, but I need to do my real job, too. :)

There may be some changes in issues depending on R19.x or R21.x. Default boot loader in R19 is fastboot, whereas it changes to u-boot by default in R21. Technically you do not flash kernels under u-boot, you simply copy them to /boot and edit the extlinux.conf. Under fastboot the -k 6 option puts the kernel in the right place. So what version are you using, R19 or R21? Which boot loader?

I’m on R21.1 (currently with Grinch kernel).

Looking at the output when I execute a full flash command, I see this:

copying bootloader(/home/chad/JETSON/R21.1_Grinch/Linux_for_Tegra/bootloader/ardbeg/u-boot.bin)... done.

SO, if I understand you correctly, I don’t need to be messing around with flashing anything here?