cd /etc
vim profile
在末尾加入:export PATH=
Rebuild source using the top-level makefile in the SDK rootdirectory.
· make allrebuilds all components in the SDK
· makelinux configures and builds the kernel
· makeu-boot-spl builds u-boot and u-boot-spl
make ARCH=armCROSS_COMPILE=arm-linux-gnueabihf- distclean
在编译内核之前,需要配置哪些组件成内核镜像,哪些模块作为动态模块,
3.1默认配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- defconfig
After the configuration step has run the full configuration file is saved to the root of the kernel tree as .config.
e.g: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-am335x_evm_defconfig
3.2定制化配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
3.3编译内核
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage
This will result in a kernel image filebeing created in the arch/arm/boot/directory called zImage.
3.4编译设备树
在arch/arm/boot/dts/目录下:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x-evmsk .dtb
3.5编译内核模块
很多驱动没有集成到zImage里面,而是在动态模块中。
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
这会生成kernel object(.ko)文件。
4.1 将zImage 、 dtb 拷贝在文件夹(从这里开始读)Installing the Kernel Image and Device TreeBinaries。
cd
sudo cparch/arm/boot/zImage
sudo cparch/arm/boot/dts/
例如:
if you wanted to copy the kernel image and BeagleBone Black devicetree file to the rootfs partition of a SD card you would enter the below commands
cd
sudo cparch/arm/boot/zImage arch/arm/boot/dts/am335x-boneblack.dtb /media/rootfs/boot
4.2安装模块
sudomake ARCH=arm INSTALL_MOD_PATH=
For example if you are installing the moduleson the rootfs partition of the SD card you would do:
sudo make ARCH=arm INSTALL_MOD_PATH=/media/rootfsmodules_install
http://processors.wiki.ti.com/index.php?title=Linux_PSP_GPIO_Driver_Guide&keyMatch=gpio&tisearch=Search-EN
http://processors.wiki.ti.com/index.php/Processor_SDK_Linux_GPIO_Driver_Overview
IRQ handling:
irq_num = gpio_to_irq(30)
request_irq(irq_num, handler, 0,"gpio_test", NULL);
set_irq_type(irq_num, IRQ_TYPE_EDGE_RISING);
free_irq(irq_num, NULL);
gpio_free(30);
err = gpio_request(30,"sample_name");
gpio_direction_input(30);
Make pin 30 as output and set the value ashigh.
gpio_direction_output(30, 1);
Exporting that particular pin (30) to sysfsentry then use this API
gpio_export(30, true);
gpio_get_value(30);
Enable GPIO sysfs support in kernelconfiguration and build the kernel
Device Drivers ---> GPIOSupport ---> /sys/class/gpio/...(sysfs interface)
Sysfs entries
Export the particular GPIO pin for usercontrol. GPIO30 is taken as example.
$ echo 30 >/sys/class/gpio/export
Change the GPIO pin direction to in/out
$ echo "out"> /sys/class/gpio/gpio30/direction
or
$ echo "in"> /sys/class/gpio/gpio30/direction
Change the value
$ echo 1 >/sys/class/gpio/gpio30/value
or
$ echo 0 >/sys/class/gpio/gpio30/value
Unexport the GPIO pin
$ echo 30 >/sys/class/gpio/unexport
Run these commands for knowing what are theGPIO's already requested in the drivers.
$ mount -t debugfs debugfs /sys/kernel/debug
$ cat /sys/kernel/debug/gpio
查看设备号
$ cat /proc/devices
$ mknod /dev/设备名 c 主设备号 0
http://www.cnblogs.com/zengjfgit/p/4788923.html