User Tools

Site Tools


software:switch:l4t-kernel-compile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
software:switch:l4t-kernel-compile [2019/06/09 10:15]
chris created
software:switch:l4t-kernel-compile [2019/07/03 14:02] (current)
chris
Line 2: Line 2:
 I can compile and run the kernel with the patches from June 2018 on the Fedora30 userland, but it has many issues: compiling with '​-j5'​ leads to resets, just '​-j1'​ works. Also no sound output. So here I try to recompile L4T kernels. I can compile and run the kernel with the patches from June 2018 on the Fedora30 userland, but it has many issues: compiling with '​-j5'​ leads to resets, just '​-j1'​ works. Also no sound output. So here I try to recompile L4T kernels.
  
-This is based on [[https://​gbatemp.net/​threads/​l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/​page-68#​post-8652447|this post]]. Recompiling ​the L4T kernel from running L4T 1.3.1. ​ Also install updatesthe gcc updates are required - attempts ​to recompile with the plain gcc fail+**Note:** With the steps below I get compiled kernel and dtsbut I can not boot these, and did not succeed ​to debug further what fails, as I do not get any output on the internal or HDMI connected screen when booting the self compiled kernel.
  
-<​code>​ +This is based on [[https://gbatemp.net/threads/​l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/​page-68#​post-8652447|this post]]. Recompiling the L4T kernel ​from a running L4T 1.3.1. ​ Also install updates, the gcc updates are required ​attempts to recompile with the plain gcc from the L4T image fails.
-mkdir -p ~/kernel +
-cd ~/kernel/kernel-4.9+
  
 +<​code>​
 +mkdir -p ~/​buildkernel
 +cd ~/​buildkernel
  
 #Download Nvidia Bits #Download Nvidia Bits
Line 30: Line 31:
 KERNEL_DIR="​./​kernel/​kernel-4.9"​ KERNEL_DIR="​./​kernel/​kernel-4.9"​
  
-#Handle Standard Kernel Bits +# Handle Standard Kernel Bits
-echo "​Extracting L4T-Switch 4.9"+
 mkdir -p $KERNEL_DIR mkdir -p $KERNEL_DIR
 mv ./​l4t-kernel-4.9/​* $KERNEL_DIR mv ./​l4t-kernel-4.9/​* $KERNEL_DIR
-rm -./​l4t-kernel-4.9 +rm -rf ./​l4t-kernel-4.9
-echo "​Done"​+
  
-#Handle Nvidia Kernel bits +# Handle Nvidia Kernel bits
-echo "​Extracting Nvidia Kernel Stuff"+
 mkdir -p ./​kernel/​nvidia mkdir -p ./​kernel/​nvidia
 mv ./​l4t-kernel-nvidia*/​* ./​kernel/​nvidia mv ./​l4t-kernel-nvidia*/​* ./​kernel/​nvidia
-rm -./​l4t-kernel-nvidia* +rm -rf ./​l4t-kernel-nvidia*
-echo "​Done"​+
  
-#Handle Switchroot DTS files +# Handle Switchroot DTS files
-echo "​Extracting DTS stuff"+
 mkdir -p ./​kernel/​hardware/​nvidia/​platform/​t210/​switch mkdir -p ./​kernel/​hardware/​nvidia/​platform/​t210/​switch
 mv ./​l4t-platform-t210-switch*/​* ./​kernel/​hardware/​nvidia/​platform/​t210/​switch/​ mv ./​l4t-platform-t210-switch*/​* ./​kernel/​hardware/​nvidia/​platform/​t210/​switch/​
-rm -./​l4t-platform-t210-switch* +rm -rf ./​l4t-platform-t210-switch*
-echo "​Done"​+
  
-#Extract and place nvidia bits +# Extract and place nvidia bits
-echo "​Extracting Nvidia GPU Kernel Bits"+
 mkdir -p ./​kernel/​nvgpu mkdir -p ./​kernel/​nvgpu
 mkdir linux-nvgpu mkdir linux-nvgpu
 tar -xf "​./​linux-nvgpu-r32.1.tar.gz"​ -C linux-nvgpu --strip 1 tar -xf "​./​linux-nvgpu-r32.1.tar.gz"​ -C linux-nvgpu --strip 1
-rm "​./​linux-nvgpu-r32.1.tar.gz"​ 
 mv ./​linux-nvgpu/​* ./​kernel/​nvgpu mv ./​linux-nvgpu/​* ./​kernel/​nvgpu
-rm -r linux-nvgpu +rm -r linux-nvgpu ​./​linux-nvgpu-r32.1.tar.gz
-echo "​Done"​+
  
-echo "Extracting Tegra SOC Data" +Extracting Tegra SOC Data 
-mkdir -p ./​kernel/​hardware/​nvidia/​soc/​tegra/​ +mkdir -p ./​kernel/​hardware/​nvidia/​soc/​tegra/​ soc-tegra
-mkdir soc-tegra+
 tar -xf "​./​soc-tegra-rel-30-r2.tar.gz"​ -C soc-tegra --strip 1 tar -xf "​./​soc-tegra-rel-30-r2.tar.gz"​ -C soc-tegra --strip 1
-rm "​./​soc-tegra-rel-30-r2.tar.gz"​ 
 mv ./​soc-tegra/​* ./​kernel/​hardware/​nvidia/​soc/​tegra/​ mv ./​soc-tegra/​* ./​kernel/​hardware/​nvidia/​soc/​tegra/​
-rm -r soc-tegra +rm -r soc-tegra ​soc-tegra-rel-30-r2.tar.gz
-echo "​Done"​+
  
-echo "Extracting T210 SOC Data" +Extracting T210 SOC Data 
-mkdir -p ./​kernel/​hardware/​nvidia/​soc/​t210/​ +mkdir -p ./​kernel/​hardware/​nvidia/​soc/​t210/​ soc-tegra-t210
-mkdir soc-tegra-t210+
 tar -xf "​soc-tegra-t210-rel-30-r2.tar.gz"​ -C soc-tegra-t210 --strip 1 tar -xf "​soc-tegra-t210-rel-30-r2.tar.gz"​ -C soc-tegra-t210 --strip 1
-rm "​soc-tegra-t210-rel-30-r2.tar.gz"​ 
 mv ./​soc-tegra-t210/​* ./​kernel/​hardware/​nvidia/​soc/​t210/​ mv ./​soc-tegra-t210/​* ./​kernel/​hardware/​nvidia/​soc/​t210/​
-rm -r soc-tegra-t210 +rm -r soc-tegra-t210 ​soc-tegra-t210-rel-30-r2.tar.gz
-echo "​Done"​+
  
-echo "Extracting Tegra Common Platform Data" +Extracting Tegra Common Platform Data 
-mkdir -p ./​kernel/​hardware/​nvidia/​platform/​tegra/​common/​ +mkdir -p ./​kernel/​hardware/​nvidia/​platform/​tegra/​common/​ platform-tegra-common
-mkdir platform-tegra-common+
 tar -xf "​platform-tegra-common-rel-30-r2.tar.gz"​ -C platform-tegra-common --strip 1 tar -xf "​platform-tegra-common-rel-30-r2.tar.gz"​ -C platform-tegra-common --strip 1
-rm "​platform-tegra-common-rel-30-r2.tar.gz"​ 
 mv ./​platform-tegra-common/​* ./​kernel/​hardware/​nvidia/​platform/​tegra/​common/​ mv ./​platform-tegra-common/​* ./​kernel/​hardware/​nvidia/​platform/​tegra/​common/​
-rm -r platform-tegra-common +rm -r platform-tegra-common ​platform-tegra-common-rel-30-r2.tar.gz
-echo "​Done"​+
  
-echo "Extracting T210 Common Platform Data" +Extracting T210 Common Platform Data 
-mkdir -p ./​kernel/​hardware/​nvidia/​platform/​t210/​common/​ +mkdir -p ./​kernel/​hardware/​nvidia/​platform/​t210/​common/​ common-t210
-mkdir common-t210+
 tar -xf "​platform-tegra-t210-common-rel-30-r2.tar.gz"​ -C common-t210 --strip 1 tar -xf "​platform-tegra-t210-common-rel-30-r2.tar.gz"​ -C common-t210 --strip 1
-rm "​platform-tegra-t210-common-rel-30-r2.tar.gz"​ 
 mv ./​common-t210/​* ./​kernel/​hardware/​nvidia/​platform/​t210/​common/​ mv ./​common-t210/​* ./​kernel/​hardware/​nvidia/​platform/​t210/​common/​
-rm -r common-t210 +rm -r common-t210 ​platform-tegra-t210-common-rel-30-r2.tar.gz
-echo "​Done"​+
  
-echo "Preparing Source and Creating Defconfig"+Preparing Source and Creating Defconfig
 cd ./​kernel/​kernel-4.9 cd ./​kernel/​kernel-4.9
 # This command fails, because it is missing .config, but is # This command fails, because it is missing .config, but is
Line 106: Line 86:
 make modules_prepare make modules_prepare
  
-compiling the kernel +To change settings: ​ 
-cd kernel/​kernel-4.9+make menuconfig
  
-To change settings, type: make menuconfig +compile ​kernel
-# build kernel+
 make -j5 tegra-dtstree="​../​hardware/​nvidia/"​ make -j5 tegra-dtstree="​../​hardware/​nvidia/"​
 # install modules type # install modules type
Line 132: Line 111:
     * You could also extract them from the switch using https://​github.com/​perillamint/​nx-fwextract     * You could also extract them from the switch using https://​github.com/​perillamint/​nx-fwextract
     * Or rely on these: https://​gist.github.com/​kiding/​34916dd163d700098980ec0b8901a033     * Or rely on these: https://​gist.github.com/​kiding/​34916dd163d700098980ec0b8901a033
-  * The normal L4T kernel can via usb be booted as follows, ​but self compiled ones do not boot (and I have no idea why not, as there is no console ​output ​visible):+ 
 +===== booting kernels via usb ===== 
 +The normal L4T kernel can via usb be booted as follows. The partition which the initrd should jump into is set in file switch.scr .  After changing the file'​mkimage'​ from coreboot has to be used to compile a new switch.scr.img which is then used for booting. This output ​is from the x86_64 system which is supplying the kernel to the switch. 
 <​code>​ <​code>​
 [root@電脳 usb_loader_l4tkernel]#​ cat imx_usb.conf [root@電脳 usb_loader_l4tkernel]#​ cat imx_usb.conf
 #vid:pid, config_file #vid:pid, config_file
 0x0955:​0x701a,​ switch.conf 0x0955:​0x701a,​ switch.conf
 +[root@電脳 usb_loader_l4tkernel]# ​
 +
 [root@電脳 usb_loader_l4tkernel]#​ cat switch.conf ​ [root@電脳 usb_loader_l4tkernel]#​ cat switch.conf ​
 switch switch
Line 144: Line 128:
 initramfs:​load 0x92000000 initramfs:​load 0x92000000
 switch.scr.img:​load 0x8e000000,​jump_direct 0x8e000000 switch.scr.img:​load 0x8e000000,​jump_direct 0x8e000000
 +[root@電脳 usb_loader_l4tkernel]# ​
 +
 [root@電脳 usb_loader_l4tkernel]#​ cat switch.scr [root@電脳 usb_loader_l4tkernel]#​ cat switch.scr
 # mkimage -A arm64 -T script -C none -n "​boot.scr"​ -d switch.scr switch.scr.img # mkimage -A arm64 -T script -C none -n "​boot.scr"​ -d switch.scr switch.scr.img
Line 152: Line 138:
 usb reset usb reset
 booti 0x83000000 0x92000000 0x8d000000 booti 0x83000000 0x92000000 0x8d000000
 +[root@電脳 usb_loader_l4tkernel]# ​
 +
 +# this is my shellscript which will
 +# - supply coreboot to the switch
 +# - copy a raw switch.scr.3 file (same as above, but instructing
 +#   to boot /​dev/​mmcblk0p3
 +# - run '​mkimage'​ from coreboot to compile switch.scr.img
 +# - and then supply kernel, initrd, dtb-file and switch.scr.img
 +#   as specified in switch.conf
 [root@電脳 usb_loader_l4tkernel]# ​ [root@電脳 usb_loader_l4tkernel]# ​
 </​code>​ </​code>​
software/switch/l4t-kernel-compile.1560068157.txt · Last modified: 2019/06/09 10:15 by chris