CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
楼主: matson

[教程]使用buildroot完全自定义自己的embedded linux系统(nand)

  [复制链接]
 楼主| 发表于 2013-4-27 12:31:57 | 显示全部楼层
刚刚更新了linux-sunxi和tools-sunxi,把ir, leds默认编译进linux内核,gpio编译成模块。所以现在取最新的代码,然后添加下面的脚本,就可以红外控制灯了。理论上控制gpio也是一样的,但记得要加载驱动,并且运行ir-daemon

cat /tools/ir-hook
#!/bin/bash

if [ "$2" -eq "1" ]; then
if cat /sys/class/leds/blue\:ph21\:led2/brightness|grep 1
then
echo 0 > /sys/class/leds/blue\:ph21\:led2/brightness
else
echo 1 > /sys/class/leds/blue\:ph21\:led2/brightness
fi

fi
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-4-27 16:57:25 | 显示全部楼层
使用红外控制gpio灯的例子。用了cubieboard的面包板

脚本如下
cat /tools/ir-hook
#!/bin/bash

if [ "$2" -eq "0" ]; then
        exit 0
fi

if ! ls /sys/class/gpio |grep gpio30
then
        echo "export 30, 31"
        echo 30 > /sys/class/gpio/export
        echo 31 > /sys/class/gpio/export
        echo out > /sys/class/gpio/gpio30_pd2/direction
        echo out > /sys/class/gpio/gpio31_pd1/direction
fi

if cat /sys/class/gpio/gpio31_pd1/value |grep 1
then
        echo 0 > /sys/class/gpio/gpio30_pd2/value
        echo 0 > /sys/class/gpio/gpio31_pd1/value
else
        echo 0 > /sys/class/gpio/gpio30_pd2/value
        echo 1 > /sys/class/gpio/gpio31_pd1/value
fi

gpio映射可以看:
1) http://linux-sunxi.org/Cubieboard
2)tools/pack/chips/sun4i/configs/linux/cubieboard/sys_config1.fex
  其中的gpio_para段
3)http://linux-sunxi.org/GPIO




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复 支持 反对

使用道具 举报

发表于 2013-4-29 10:18:31 | 显示全部楼层
此文不错。一直都想研究这个了。
谢谢楼主~
回复 支持 反对

使用道具 举报

发表于 2013-6-8 10:54:08 | 显示全部楼层
很好的帖子,很感谢!
回复 支持 反对

使用道具 举报

发表于 2013-6-8 16:22:06 | 显示全部楼层
能否把tools,u-boot,buildroot,linux-3.4源码压缩上传,或者是其他方式方便新手下载。用git很慢。谢谢!
回复 支持 反对

使用道具 举报

发表于 2013-6-10 22:39:20 | 显示全部楼层
收藏,学习!感谢!辛苦!
回复 支持 反对

使用道具 举报

发表于 2013-6-12 05:41:27 | 显示全部楼层
好教程,是要马克的
回复 支持 反对

使用道具 举报

发表于 2013-6-12 17:09:00 | 显示全部楼层
swads@swads-H61M-D2P-B3:~/mylinux$ tools/build.sh
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  GZIP    kernel/config_data.gz
  CHK     kernel/config_data.h
  CC [M]  drivers/gpu/mali/mali/linux/mali_osk_misc.o
  LD [M]  drivers/gpu/mali/mali/mali.o
  CC [M]  drivers/gpu/mali/ump/../mali/linux/mali_osk_atomics.o
  CC [M]  drivers/gpu/mali/ump/../mali/linux/mali_osk_locks.o
  CC [M]  drivers/gpu/mali/ump/../mali/linux/mali_osk_memory.o
  CC [M]  drivers/gpu/mali/ump/../mali/linux/mali_osk_math.o
  CC [M]  drivers/gpu/mali/ump/../mali/linux/mali_osk_misc.o
  LD [M]  drivers/gpu/mali/ump/ump.o
  Building modules, stage 2.
  Kernel: arch/arm/boot/Image is ready
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  MODPOST 38 modules
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.4.29+
Created:      Wed Jun 12 17:04:54 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    4252296 Bytes = 4152.63 kB = 4.06 MB
Load Address: 40008000
Entry Point:  40008000
  Image arch/arm/boot/uImage is ready
  CC      drivers/gpu/mali/mali/mali.mod.o
  CC      drivers/gpu/mali/ump/ump.mod.o
  LD [M]  drivers/gpu/mali/ump/ump.ko
  LD [M]  drivers/gpu/mali/mali/mali.ko
  GEN     /home/swads/mylinux/out/br/Makefile
#
# configuration written to /home/swads/mylinux/out/br/.config
#
boot/uboot/uboot.mk:134: *** NO U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting.  Stop.
Regenerating rootfs
  INSTALL drivers/ata/sw_ahci_platform.ko
  INSTALL drivers/cpufreq/cpufreq_stats.ko
  INSTALL drivers/gpu/drm/drm.ko
  INSTALL drivers/gpu/drm/mali/mali_drm.ko
  INSTALL drivers/gpu/mali/mali/mali.ko
  INSTALL drivers/gpu/mali/ump/ump.ko
  INSTALL drivers/hid/hid-logitech-dj.ko
  INSTALL drivers/i2c/algos/i2c-algo-bit.ko
  INSTALL drivers/input/keyboard/hv2605.ko
  INSTALL drivers/input/keyboard/sun4i-keyboard.ko
  INSTALL drivers/input/keyboard/sun4i-keypad.ko
  INSTALL drivers/input/touchscreen/ft5x_ts.ko
  INSTALL drivers/input/touchscreen/goodix_touch.ko
  INSTALL drivers/input/touchscreen/sun4i-ts.ko
  INSTALL drivers/input/touchscreen/zt8031.ko
  INSTALL drivers/media/common/tuners/mt2063.ko
  INSTALL drivers/media/common/tuners/tea5761.ko
  INSTALL drivers/media/common/tuners/xc4000.ko
  INSTALL drivers/misc/sunxi-dbgreg.ko
  INSTALL drivers/net/wireless/bcm4330/bcm4330.ko
  INSTALL drivers/scsi/scsi_wait_scan.ko
  INSTALL drivers/usb/gadget/g_file_storage.ko
  INSTALL drivers/video/cfbcopyarea.ko
  INSTALL drivers/video/cfbfillrect.ko
  INSTALL drivers/video/cfbimgblt.ko
  INSTALL drivers/video/sunxi/disp/disp.ko
  INSTALL drivers/video/sunxi/disp/disp_ump.ko
  INSTALL drivers/video/sunxi/hdmi/hdmi.ko
  INSTALL drivers/video/sunxi/lcd/lcd.ko
  INSTALL net/core/pktgen.ko
  INSTALL sound/soc/sun4i/i2s/sndi2s.ko
  INSTALL sound/soc/sun4i/i2s/sun4i-i2s.ko
  INSTALL sound/soc/sun4i/i2s/sun4i-i2sdma.ko
  INSTALL sound/soc/sun4i/i2s/sun4i-sndi2s.ko
  INSTALL sound/soc/sun4i/spdif/sndspdif.ko
  INSTALL sound/soc/sun4i/spdif/sun4i_sndspdif.ko
  INSTALL sound/soc/sun4i/spdif/sun4i_spdif.ko
  INSTALL sound/soc/sun4i/spdif/sun4i_spdma.ko
  DEPMOD  3.4.29+
boot/uboot/uboot.mk:134: *** NO U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting.  Stop.
cp: cannot stat `/home/swads/mylinux/out/br/images/rootfs.ext4': No such file or directory
!!!Packing for linux!!!
`chips/sun4i/configs/linux/default/env.cfg' -> `out/env.cfg'
`chips/sun4i/configs/linux/default/image.cfg' -> `out/image.cfg'
`chips/sun4i/configs/linux/default/sys_config.fex' -> `out/sys_config.fex'
`chips/sun4i/configs/linux/cubieboard/sys_config1.fex' -> `out/sys_config1.fex'
cp: cannot stat `/home/swads/mylinux/out/u-boot.bin': No such file or directory
cp: cannot stat `/home/swads/mylinux/out/cb.dtb': No such file or directory
./pack: line 384: /home/swads/mylinux/tools/pack/pctools/linux/mod_update/script: cannot execute binary file
./pack: line 385: /home/swads/mylinux/tools/pack/pctools/linux/mod_update/script: cannot execute binary file
./pack: line 386: /home/swads/mylinux/tools/pack/pctools/linux/mod_update/update_23: cannot execute binary file
./pack: line 387: /home/swads/mylinux/tools/pack/pctools/linux/mod_update/update_23: cannot execute binary file
cp: cannot stat `sys_config1.bin': No such file or directory
cp: cannot stat `sys_config1.bin': No such file or directory
./pack: line 392: /home/swads/mylinux/tools/pack/pctools/linux/mod_update/update_mbr: cannot execute binary file
disk : c
CopyRootToFS(/home/swads/mylinux/tools/pack/out/bootfs)

c:\os_show

c:\linux

c:\sprite
c:\magic.bin
find magic !!
RealLen=0x8B8C00
CPlugin Free lib
CPlugin Free lib
/home/swads/mylinux/tools/pack/pctools/linux/eDragonEx//home/swads/mylinux/tools/pack/outFile rootfs.fex Not ExistBuildImg 360
Dragon execute image.cfg Failed ! 360
CPlugin Free lib
CPlugin Free lib



我不知道是我的环境配置有问题还是怎么的?那个大神帮着看看。顺便在问一下,我现在有点迷茫了。不知道该如何做了?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-6-13 17:44:23 | 显示全部楼层
试一下在uboot下面make distclean清理一下
回复 支持 反对

使用道具 举报

发表于 2013-6-17 22:44:12 | 显示全部楼层
給力到不行~~
不過有一個小問題,顯示方式例如HDMI的分辨率是在那邊控制或是調試啊?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-4-24 05:00 , Processed in 0.026556 second(s), 13 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部