預設/dev下是沒有spi設備的JetPack版本JetPack-L4T-3.2.1-linux-x64_b23.run下載Kernelsudo git clone http://github.com/jetsonhacks/buildJetsonTX2Kernel.gitgit checkout ... ...
預設/dev下是沒有spi設備的
JetPack版本
JetPack-L4T-3.2.1-linux-x64_b23.run
下載Kernel
sudo git clone http://github.com/jetsonhacks/buildJetsonTX2Kernel.git
git checkout L4T32.2.1 //切換分支
./getKernelSources.sh //獲取源碼
預設配置內核
cd /usr/src/kernel/kernel-4.4
make tegra18_defconfig
安裝依賴
sudo apt-get install libncurses5-dev
配置內核
make menuconfig
模塊方式載入SPI
編譯內核
cd buildJetsonTX2Kernel
./makeKernel.sh
生成內核模塊
反編譯設備樹
cd /boot/dtb //目錄下的就是當前模塊使用的設備樹
sudo /usr/src/kernel/kernel-4.4/scripts/dtc/dtc -I dtb -O dts -o myTX2iDeviceTree.dts tegra186-quill-p3489-1000-a00-00-ucm1.dtb
修改設備樹
sudo vim myTX2iDeviceTree.dts
spi@3240000 { compatible = "nvidia,tegra186-spi"; reg = <0x0 0x3240000 0x0 0x10000>; ... linux,phandle = <0x7d>; phandle = <0x7d>; spi@0 { compatible = "spidev"; reg = <0x0>; spi-max-frequency = <0x1312D00>; nvidia,enable-hw-based-cs; nvidia,cs-setup-clk-count = <0x1e>; nvidia,cs-hold-clk-count = <0x1e>; nvidia,rx-clk-tap-delay = <0x1f>; nvidia,tx-clk-tap-delau = <0x0>; }; };
重新編譯設備樹
sudo /usr/src/kernel/kernel-4.4/scripts/dtc/dtc -I dts -O dtb -o myTX2iDeviceTree.dtb myTX2iDeviceTree.dts
註:TX2i設備樹反編譯,也看不到設備樹的修改記錄
拷貝設備樹
將myTX2iDeviceTree.dtb放到虛擬機的jetson/64_TX2/Linux_for_Tegr/kernel/dtb目錄下
cp myTX2iDeviceTree.dtb tegra186-quill-p3489-1000-a00-00-ucm1.dtb //覆蓋原TX2i設備樹文件
開發板進入Recovery模式
按住REC恢復鍵不放,輕點一下RST複位鍵
燒寫設備樹
cd jetson/64_TX2/Linux_for_Tegr
sudo ./flash.sh -r -k kernel-dtb jetson-tx2i mmcblk0p1 //將燒寫tegra186-quill-p3489-1000-a00-00-ucm1.dtb文件
完成