L4T Ubuntu - A fully featured linux on your switch

Discussion in 'Switch - Exploits, Custom Firmwares & Soft Mods' started by bylaws, Apr 28, 2019.

  1. lordelan

    lordelan GBAtemp Psycho!

    Member
    11
    Jan 4, 2015
    Germany
  2. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    Even if I wanted to replace it with android, that isnt possible, as android uses framebuffer graphics, not X11, where the Nvidia drivers are loaded. I am working on building gentoo, from nothing, so everything is optimized specifically for the tegra210. This should also give me a decent video player with hardware acceleration(kodi). If I can find 32bit video card libraries, I can get netflix to work there as well, as I have had working netflix in kodi 18 on the switch for 8 months now, using a 32bit gentoo build. Unfortunatly, I dont think that will be possible using l4t, as I dont think nvidia has released modern 32bit xorg drivers. Mesa will compile the tegra drivers in 32bit, but those dont work with l4t. That being said, if I can get everything to work correctly, I will release my build. I also have some other fun stuff, such as bashbunny patches for the RNDIS and ECM ethernet gadgets, that spoof speed to give highest metric. As a computer security person, I cant think of a better platform for social engineering, as most people will trust a nintendo. ;) That being said, I have reimplemented *most* of the bashbunny framework, with a custom Attackmode script that uses libcomposite gadgets, instead of prebuilt composite gadgets, which will allow more configuration. I also have a working MTP responder, which makes copying music, roms, movies, etc to the sd card as simple as copying them to an android phone. So, when all is said and done, this build should be interesting. That being said, I take no responsibility for anything people may do with said scripts, and patches. lol.
     
    Last edited by Gavin_Darkglider, May 29, 2019
    trohn_javolta, Watermelonz and Csmrcc like this.
  3. dotmick

    dotmick Member

    Newcomer
    1
    Oct 7, 2018
    United Kingdom
    Thanks @Gavin_Darkglider

    So I've followed your instructions and this is what I've got:

    dotmick@dotmick-VirtualBox:~/kernel$ ./l4t_kernel_prep.sh aarch64-linux-gnu-

    [...]

    Preparing Source and Creating Defconfig
    HOSTCC scripts/basic/fixdep
    HOSTCC scripts/kconfig/conf.o
    SHIPPED scripts/kconfig/zconf.tab.c
    SHIPPED scripts/kconfig/zconf.lex.c
    SHIPPED scripts/kconfig/zconf.hash.c
    HOSTCC scripts/kconfig/zconf.tab.o
    HOSTLD scripts/kconfig/conf
    scripts/kconfig/conf --silentoldconfig Kconfig
    ***
    *** Configuration file ".config" not found!
    ***
    *** Please run some configurator (e.g. "make oldconfig" or
    *** "make menuconfig" or "make xconfig").
    ***
    scripts/kconfig/Makefile:37: recipe for target 'silentoldconfig' failed
    make[2]: *** [silentoldconfig] Error 1
    Makefile:562: recipe for target 'silentoldconfig' failed
    make[1]: *** [silentoldconfig] Error 2
    SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
    SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
    SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h
    SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
    HOSTCC arch/x86/tools/relocs_32.o
    HOSTCC arch/x86/tools/relocs_64.o
    HOSTCC arch/x86/tools/relocs_common.o
    HOSTLD arch/x86/tools/relocs
    make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'. Stop.
    ***
    *** Can't find default configuration "arch/x86/configs/t210_switch_defconfig"!
    ***
    scripts/kconfig/Makefile:113: recipe for target 't210_switch_defconfig' failed
    make[1]: *** [t210_switch_defconfig] Error 1
    Makefile:562: recipe for target 't210_switch_defconfig' failed
    make: *** [t210_switch_defconfig] Error 2
    scripts/kconfig/conf --silentoldconfig Kconfig
    ***
    *** Configuration file ".config" not found!
    ***
    *** Please run some configurator (e.g. "make oldconfig" or
    *** "make menuconfig" or "make xconfig").
    ***
    scripts/kconfig/Makefile:37: recipe for target 'silentoldconfig' failed
    make[2]: *** [silentoldconfig] Error 1
    Makefile:562: recipe for target 'silentoldconfig' failed
    make[1]: *** [silentoldconfig] Error 2
    make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'. Stop.
    scripts/kconfig/conf --silentoldconfig Kconfig
    ***
    *** Configuration file ".config" not found!
    ***
    *** Please run some configurator (e.g. "make oldconfig" or
    *** "make menuconfig" or "make xconfig").
    ***
    scripts/kconfig/Makefile:37: recipe for target 'silentoldconfig' failed
    make[2]: *** [silentoldconfig] Error 1
    Makefile:562: recipe for target 'silentoldconfig' failed
    make[1]: *** [silentoldconfig] Error 2
    make: *** No rule to make target 'modules_prepare'. Stop.
    Done
    Finished

    dotmick@dotmick-VirtualBox:~/kernel$ cd kernel/kernel-4.9/
    dotmick@dotmick-VirtualBox:~/kernel/kernel/kernel-4.9$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make menuconfig
    HOSTCC scripts/kconfig/mconf.o
    HOSTCC scripts/kconfig/lxdialog/checklist.o
    HOSTCC scripts/kconfig/lxdialog/util.o
    HOSTCC scripts/kconfig/lxdialog/inputbox.o
    HOSTCC scripts/kconfig/lxdialog/textbox.o
    HOSTCC scripts/kconfig/lxdialog/yesno.o
    HOSTCC scripts/kconfig/lxdialog/menubox.o
    HOSTLD scripts/kconfig/mconf
    scripts/kconfig/mconf Kconfig
    #
    # using defaults found in /boot/config-4.18.0-20-generic
    #
    /boot/config-4.18.0-20-generic:1972:warning: symbol value 'm' invalid for REGMAP_SPMI
    /boot/config-4.18.0-20-generic:4286:warning: symbol value 'm' invalid for GPIO_MB86S7X
    /boot/config-4.18.0-20-generic:5334:warning: symbol value 'm' invalid for RADIO_SI470X
    /boot/config-4.18.0-20-generic:7281:warning: symbol value 'm' invalid for DMA_VIRTUAL_CHANNELS
    /boot/config-4.18.0-20-generic:9541:warning: symbol value 'm' invalid for KVM


    *** End of the configuration.
    *** Execute 'make' to start the build or try 'make help'.

    dotmick@dotmick-VirtualBox:~/kernel/kernel/kernel-4.9$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make prepare
    scripts/kconfig/conf --silentoldconfig Kconfig
    CHK include/config/kernel.release
    UPD include/config/kernel.release
    WRAP arch/arm64/include/generated/asm/bugs.h
    WRAP arch/arm64/include/generated/asm/clkdev.h
    WRAP arch/arm64/include/generated/asm/cputime.h
    WRAP arch/arm64/include/generated/asm/current.h
    WRAP arch/arm64/include/generated/asm/delay.h
    WRAP arch/arm64/include/generated/asm/div64.h
    WRAP arch/arm64/include/generated/asm/dma.h
    WRAP arch/arm64/include/generated/asm/dma-contiguous.h
    WRAP arch/arm64/include/generated/asm/early_ioremap.h
    WRAP arch/arm64/include/generated/asm/emergency-restart.h
    WRAP arch/arm64/include/generated/asm/errno.h
    WRAP arch/arm64/include/generated/asm/hw_irq.h
    WRAP arch/arm64/include/generated/asm/ioctl.h
    WRAP arch/arm64/include/generated/asm/ioctls.h
    WRAP arch/arm64/include/generated/asm/ipcbuf.h
    WRAP arch/arm64/include/generated/asm/irq_regs.h
    WRAP arch/arm64/include/generated/asm/kdebug.h
    WRAP arch/arm64/include/generated/asm/kmap_types.h
    WRAP arch/arm64/include/generated/asm/kvm_para.h
    WRAP arch/arm64/include/generated/asm/local.h
    WRAP arch/arm64/include/generated/asm/local64.h
    WRAP arch/arm64/include/generated/asm/mcs_spinlock.h
    WRAP arch/arm64/include/generated/asm/mm-arch-hooks.h
    WRAP arch/arm64/include/generated/asm/mman.h
    WRAP arch/arm64/include/generated/asm/msgbuf.h
    WRAP arch/arm64/include/generated/asm/msi.h
    WRAP arch/arm64/include/generated/asm/mutex.h
    WRAP arch/arm64/include/generated/asm/poll.h
    WRAP arch/arm64/include/generated/asm/preempt.h
    WRAP arch/arm64/include/generated/asm/resource.h
    WRAP arch/arm64/include/generated/asm/rwsem.h
    WRAP arch/arm64/include/generated/asm/segment.h
    WRAP arch/arm64/include/generated/asm/sembuf.h
    WRAP arch/arm64/include/generated/asm/serial.h
    WRAP arch/arm64/include/generated/asm/shmbuf.h
    WRAP arch/arm64/include/generated/asm/simd.h
    WRAP arch/arm64/include/generated/asm/sizes.h
    WRAP arch/arm64/include/generated/asm/socket.h
    WRAP arch/arm64/include/generated/asm/sockios.h
    WRAP arch/arm64/include/generated/asm/swab.h
    WRAP arch/arm64/include/generated/asm/switch_to.h
    WRAP arch/arm64/include/generated/asm/termbits.h
    WRAP arch/arm64/include/generated/asm/termios.h
    WRAP arch/arm64/include/generated/asm/trace_clock.h
    WRAP arch/arm64/include/generated/asm/types.h
    WRAP arch/arm64/include/generated/asm/unaligned.h
    WRAP arch/arm64/include/generated/asm/user.h
    WRAP arch/arm64/include/generated/asm/vga.h
    WRAP arch/arm64/include/generated/asm/xor.h
    WRAP arch/arm64/include/generated/uapi/asm/kvm_para.h
    CHK include/generated/uapi/linux/version.h
    UPD include/generated/uapi/linux/version.h
    CHK include/generated/utsrelease.h
    UPD include/generated/utsrelease.h
    HOSTCC scripts/basic/bin2c
    CHK include/generated/timeconst.h
    UPD include/generated/timeconst.h
    CC kernel/bounds.s
    CHK include/generated/bounds.h
    UPD include/generated/bounds.h
    GEN scripts/gdb/linux/constants.py
    CC arch/arm64/kernel/asm-offsets.s
    CHK include/generated/asm-offsets.h
    UPD include/generated/asm-offsets.h
    CALL scripts/checksyscalls.sh
    LDS arch/arm64/kernel/vdso/vdso.lds
    VDSOA arch/arm64/kernel/vdso/gettimeofday.o
    VDSOA arch/arm64/kernel/vdso/note.o
    VDSOA arch/arm64/kernel/vdso/sigreturn.o
    VDSOL arch/arm64/kernel/vdso/vdso.so.dbg
    VDSOSYM include/generated/vdso-offsets.h
    dotmick@dotmick-VirtualBox:~/kernel/kernel/kernel-4.9$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make modules_prepare
    CHK include/config/kernel.release
    CHK include/generated/uapi/linux/version.h
    CHK include/generated/utsrelease.h
    CHK include/generated/timeconst.h
    CHK include/generated/bounds.h
    CHK include/generated/asm-offsets.h
    CALL scripts/checksyscalls.sh
    HOSTCC scripts/dtc/dtc.o
    HOSTCC scripts/dtc/flattree.o
    HOSTCC scripts/dtc/fstree.o
    HOSTCC scripts/dtc/data.o
    HOSTCC scripts/dtc/livetree.o
    HOSTCC scripts/dtc/treesource.o
    HOSTCC scripts/dtc/srcpos.o
    HOSTCC scripts/dtc/checks.o
    HOSTCC scripts/dtc/util.o
    SHIPPED scripts/dtc/dtc-lexer.lex.c
    SHIPPED scripts/dtc/dtc-parser.tab.h
    HOSTCC scripts/dtc/dtc-lexer.lex.o
    SHIPPED scripts/dtc/dtc-parser.tab.c
    HOSTCC scripts/dtc/dtc-parser.tab.o
    HOSTLD scripts/dtc/dtc
    CC scripts/mod/empty.o
    HOSTCC scripts/mod/mk_elfconfig
    MKELF scripts/mod/elfconfig.h
    HOSTCC scripts/mod/modpost.o
    CC scripts/mod/devicetable-offsets.s
    GEN scripts/mod/devicetable-offsets.h
    HOSTCC scripts/mod/file2alias.o
    HOSTCC scripts/mod/sumversion.o
    HOSTLD scripts/mod/modpost
    HOSTCC scripts/selinux/genheaders/genheaders
    HOSTCC scripts/selinux/mdp/mdp
    HOSTCC scripts/kallsyms
    HOSTCC scripts/conmakehash
    HOSTCC scripts/recordmcount
    HOSTCC scripts/sortextable
    HOSTCC scripts/asn1_compiler
    HOSTCC scripts/sign-file
    HOSTCC scripts/extract-cert
    HOSTCC scripts/insert-sys-cert
    dotmick@dotmick-VirtualBox:~/kernel/kernel/kernel-4.9$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j5 tegra-dtstree="../hardware/nvidia/"
    CHK include/config/kernel.release
    CHK include/generated/uapi/linux/version.h
    CHK include/generated/utsrelease.h
    cp -u arch/arm64/boot/dts/
    cp: missing destination file operand after 'arch/arm64/boot/dts/'
    Try 'cp --help' for more information.
    arch/arm64/boot/dts/Makefile:129: recipe for target 'dtbs' failed
    make[1]: *** [dtbs] Error 1
    arch/arm64/Makefile:124: recipe for target 'dtbs' failed
    make: *** [dtbs] Error 2
    make: *** Waiting for unfinished jobs....


    Any idea about why it's not working?
     
  4. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    You are using the version of the script I created for people who wanted to build it on their l4t install, so it is not setting up the ARCH, or CROSS_COMPILE options properly. use this version: https://gitlab.com/switchroot/switc...31b56145d48f7f354b75fb6a4/l4t_kernel_prep.txt

    I removed the cross compile bits from the script I made to run on the switch, so the you have no defconfig, as that is specific to arm64 builds only.
     
  5. ZachyCatGames

    ZachyCatGames GBAtemp Advanced Maniac

    Member
    8
    Jun 19, 2018
    United States
    Hell
    When I build L4T using either of your scripts, it builds successfully, but doesn’t boot (black screen with backlight, then sometimes it reboots to RCM)
     
    Last edited by ZachyCatGames, May 29, 2019
  6. Deathscreton

    Deathscreton GBAtemp Advanced Fan

    Member
    7
    Oct 1, 2009
    United States
    I'm having issues enabling bridge-utils support in the kernel. Does anyone have any tips on how to do this? I need to be able to bridge a wifi adapter to a virtual tap device.
     
  7. dotmick

    dotmick Member

    Newcomer
    1
    Oct 7, 2018
    United Kingdom
    Thanks! Trying it now.
     
  8. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    It is with the netfilter/iptables stuff in the kernel. In fact, the defconfig has been updated on git lab to include this already. The only feature that hasnt been included up there that has been asked about is binfmt_misc, which is for running different arch emulation with qemu. Needed for things like xbox emulation, I would assume.

    This should give you an idea of where to look in the kernel config. https://wiki.gentoo.org/wiki/Home_router#Kernel_setup_.28know_thyself_first.29 That being said, that is for setting up NAT mainly, but the bridge options should be in the same area. NAT comes in handy, if you want to use your switch as a mini router, which I have found handy, as my switch has a much better wifi card then my laptop, so it will pick up networks my computer wont. A little NAT, and dns/dhcp setup and I have a wired connection. I will release all of this prebuilt, once I get basic hardware support working on my gentoo build. What I release is going to be about as minimal as possible but usable also. So, for those who know gentoo, a basic stage 4, with lxde, and stuff to set up hardware. from there, you will have to build your own apps. I am doing it this way, so people can run what they want without having to strip the system down, and fight with apt and their crappy arm64 repositories.
     
    Watermelonz likes this.
  9. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    I just worked it out far enough to get it to compile, which it does. As for why it isnt booting, that I havnt looked into, as I am not far enough in my build to try to boot it yet. I havnt tested the kernel, though it might be because it builds a sleightly older version of 4.9, than what is being used on the l4t build already. Bylaws would be the person to ask. Or, maybe if you could post the kernel log, we could debug the issue. I can say that there are no modules in the initramfs, as I did check that, it is mainly just a wrapper to load ubuntu init, so there should be no need to mess with that. If the backlight is coming on, then the system is booting, but it is hanging before X11 starts, or it doesnt like the version of the video card driver. Either that, or you might need to compile it with the GCC 4.x compiler that nvidia released as the toolchain for the kernel. I dont see why that would be needed though, as lakka-switch uses the 6.2.x(i believe) linaro toolchain for this, and my script is based off of the work that was done there.

    @bylaws, if you want to chime in on why this isnt working for people, that would be nice, since it compiles, and tries to boot, it seems strange to me. I also dont get why the kernel versions are different, if we are all using the same sources.
     
    Deathscreton and ZachyCatGames like this.
  10. Deathscreton

    Deathscreton GBAtemp Advanced Fan

    Member
    7
    Oct 1, 2009
    United States
    That's part of the problem. The kernel script you gave us doesn't boot, and the build @bylaws gave us doesn't have the bridge.ko module installed. I tried injecting the module, but modprobe doesn't work properly either. Unfortunately, I'm not very experienced in linux kernels enough to know how to fix this myself.
     
  11. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    boot the kernel you created, then plug the sdcard into a computer, and mount the root partition, and send me a copy of /var/log/messages, which is the kernel log, and I will look into it. Do not boot the working kernel, as it will overwrite the log.
     
  12. bylaws
    OP

    bylaws GBAtemp Regular

    Member
    6
    Dec 11, 2018
    United Kingdom
    Nope, you need something thats gstreamer based or supports 'openmax'
    next ver will have it
     
    lordelan and Watermelonz like this.
  13. bylaws
    OP

    bylaws GBAtemp Regular

    Member
    6
    Dec 11, 2018
    United Kingdom
    1.3 is out NOW. Adds sleep support - just press the power button.
     
    lordelan, Sticker, ganons and 9 others like this.
  14. Waltee

    Waltee Member

    Newcomer
    2
    Nov 11, 2017
    United Kingdom
    That's super cool, cheers!
     
  15. stick267

    stick267 GBAtemp Advanced Fan

    Member
    4
    Dec 17, 2018
    United States
    Thank you.
     
  16. Deathscreton

    Deathscreton GBAtemp Advanced Fan

    Member
    7
    Oct 1, 2009
    United States
    You're a damn magician. Thank you!

    EDIT: "Sped up sdcards, broken ones still wont work though."

    Are we going to see visible improvements in general activity? ie. less lag/hangups, programs opening quicker, etc.
     
    Last edited by Deathscreton, May 29, 2019
  17. stick267

    stick267 GBAtemp Advanced Fan

    Member
    4
    Dec 17, 2018
    United States
    Trying to download the update directly on my Switch and it's taking ages. I wonder why. It's instant on my Mac.
     
  18. MrSaturn

    MrSaturn Member

    Newcomer
    1
    May 29, 2019
    United States
    I'm having problems with this step:
    "Boot hekate and select L4T from the configs menu."

    I can boot my Switch to RCM because I used to use ReInx on the Switch. I did that, with the imaged SD card inserted, and used Rekado on my phone to send the Hekate payload that I downloaded from their github releases. I get a menu out of it, but selecting "Launch" results in an error (something about a Fat32 partition?). There's no "configs menu" that I can see, and nothing in the menu tree reads "L4T". I'm unfamiliar with Hekate, so I might be doing something wrong. I'm familiar with linux, dd, programming etc. I flashed the SD card from a Mac, and idk if maybe that messed some things up?
     
  19. Gavin_Darkglider

    Gavin_Darkglider GBAtemp Regular

    Member
    3
    May 20, 2019
    United States
    Download the latest version of hekate from here:https://github.com/CTCaer/hekate/releases, then the configs menu will show up.
     
  20. bedbug1226

    bedbug1226 Advanced Member

    Newcomer
    2
    Dec 1, 2014
    United States
    I ended up having to put the hekate_ipl.ini in the bootloader before it would let me select anything.
    Use the file below and change .txt to .ini
     

    Attached Files:

Loading...