deb http://mirrors.mit.edu/ubuntu-port/ trusty main restricted universe multiverse deb http://mirrors.mit.edu/ubuntu-port/ trusty-security main restricted universe multiverse deb http://mirrors.mit.edu/ubuntu-port/ trusty-updates main restricted universe multiverse deb http://mirrors.mit.edu/ubuntu-port/ trusty-proposed main restricted universe multiverse deb http://mirrors.mit.edu/ubuntu-port/ trusty-backports main restricted universe multiverse deb-src http://mirrors.mit.edu/ubuntu-port/ trusty main restricted universe multiverse deb-src http://mirrors.mit.edu/ubuntu-port/ trusty-security main restricted universe multiverse deb-src http://mirrors.mit.edu/ubuntu-port/ trusty-updates main restricted universe multiverse deb-src http://mirrors.mit.edu/ubuntu-port/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.mit.edu/ubuntu-port/ trusty-backports main restricted universe multiverse
#!/bin/bash #NVIDIA Jetson TK1 #Create a swapfile for Ubuntu at the current directory location fallocate -l4G swapfile #List out the file ls -lh swapfile # Change permissions so that only root can use it chmod 600 swapfile #List out the file ls -lh swapfile #Set up the Linux swap area mkswap swapfile #Now start using the swapfile swapon swapfile #Show that it's now being used swapon -s
以上脚本会在执行的地方搞出一个 4G 的 swap 空间,执行完以后,系统空间就少了 4G。
开机自动挂载这个空间,需要修改 fstab。
1
$ sudo gedit /etc/fstab
1
/media/swapfile noneswap sw 00
如果想要重新调整 swap 大小,切换到 swap 所在的目录,然后
1 2 3 4
dd if=/dev/zero of=swapfile bs=1M count=2048# 调成 2G chmod 600 /swapfile # only root has permission mkswap /swapfile # format it to swap swapon /swapfile # activate
ubuntu@tegra-ubuntu:~$ lsusb Bus 002 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
可是 TK1 的内核默认没有开启支持
1 2 3
ubuntu@tegra-ubuntu:~$ zcat /proc/config.gz | grep FTDI # CONFIG_USB_SERIAL_FTDI_SIO is not set # CONFIG_USB_FTDI_ELAN is not set
解决方案:
下载内核源代码,假设解压到 ~/kernel 文件夹
将当前内核配置复制到源码文件夹里
1
zcat /proc/config.gz > ~/kernel/.config
启动 menuconfig 工具配置内核
1 2
sudo apt-get install ncurses-bin libncurses5-dev make menuconfig
进入 Device Drivers -> USB Support -> USB Serial Converter Support,将 USB FTDI Single Port Serial Driver 标记为 M,保存并退出
确认驱动已设置为模块编译
1 2 3
ubuntu@tegra-ubuntu:~/kernel$ cat .config | grep FTDI CONFIG_USB_SERIAL_FTDI_SIO=m # CONFIG_USB_FTDI_ELAN is not set
编译内核(只针对串口驱动部分)
1 2 3 4 5 6 7 8 9 10
make prepare make modules_prepare
make M=drivers/usb/serial/ Building modules, stage 2. MODPOST 2 modules CC drivers/usb/serial/baseband_usb_chr.mod.o LD [M] drivers/usb/serial/baseband_usb_chr.ko CC drivers/usb/serial/ftdi_sio.mod.o LD [M] drivers/usb/serial/ftdi_sio.ko
安装编译好的模块
1 2
sudo cp drivers/usb/serial/ftdi_sio.ko /lib/modules/$(uname -r)/kernel sudo depmod -a
include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif()