title: 设备树学习之环境搭建
date: 2019/4/25 19:10:47
toc: true
设备树学习之环境搭建
配置编译器
u-boot 1.1.6 | gcc-linaro-4.9.4 |
---|---|
linux4.19 | gcc-linaro-4.9.4 |
APP/root filesystem | arm-linux-gcc-4.3.2 |
查看原来的环境变量
$ echo $PATH
/home/book/bin:/home/book/.local/bin:/opt/slickedit-pro2017/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm/4.3.2/bin/:/snap/bin
book@100ask:~/stu/post/tools/gcc$
解压这个gcc4.9
到我们指定的目录,这里为
/home/book/stu/post/tools/gcc/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi/
所以方便以后复制
编译内核与uboot使用的gcc4.9
export PATH=/home/book/bin:/home/book/.local/bin:/opt/slickedit-pro2017/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/book/stu/post/tools/gcc/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi/bin/:/snap/bin
arm-linux-gnueabi-gcc -v 可以看到新的了
编译app/root使用老的gcc4.3
export PATH= /home/book/bin:/home/book/.local/bin:/opt/slickedit-pro2017/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm/4.3.2/bin/:/snap/bin
编译
tar xjf u-boot-1.1.6.tar.bz2
cd u-boot-1.1.6
patch -p1 < ../u-boot-1.1.6_device_tree_for_jz2440.patch
make 100ask24x0_config
make
cd linux-4.19-rc3
patch -p1 < ../linux-4.19-rc3_device_tree_for_jz2440.patch
cp config_ok .config
make uImage
make dtbs // 编译, 可以得到arch/arm/boot/dts/jz2440.dtb
make dtbs
CALL scripts/checksyscalls.sh
<stdin>:1332:2: warning: #warning syscall io_pgetevents not implemented [-Wcpp]
DTC arch/arm/boot/dts/jz2440.dtb
DTC arch/arm/boot/dts/s3c2416-smdk2416.dtb
如果提示"mkimage not found", 先编译u-boot, 把tools/mkimage复制到/bin目录
如果提示"openssl/bio.h: No such file or directory" ,则需要
sudo apt-get update
sudo apt-get install libssl-dev
体验设备树
启动后在/sys/devices/platform
查看到设备50005.led