我正在使用 raspberry 和 raspbian wheezy 开发一个有趣的嵌入式项目。对于这个项目,我需要在集成触摸屏(tontec mz61561)通电后立即显示项目徽标。
我设法通过使用自定义 initramfs 来做到这一点,该 initramfs 是为启动 1) plymouth、2) 触摸屏模块 (spi_bcm2708) 和 3) 将显示从 HDMI 输出复制到嵌入式屏幕 (fbcp) 的程序而设计的。通电后几秒钟内即可自豪地显示徽标 =)
遗憾的是,我不得不对我的系统进行升级(从 4.0.7 到 4.4.27-v7+),然后这个技巧就停止工作了:触摸屏在 initramfs 之后加载,所以 fbcp 退出,给我们一个黑屏。
这是我以前的 initramfs 脚本,放置在 init-top 部分,可执行。
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
modprobe spi_bcm2708
cat /etc/image640.raw >/dev/fb0
/etc/fbcp &
exit 0
这是以前的 /initramfs-tools/modules 内容:
spi_bcm2708
fbtft
fb_s6d02a1
以下是 config.txt 中对触摸屏 dtoverlay 的调用并启动 initramfs :
dtoverlay=mz61581,speed=68000000
initramfs initrd.img-4.0.7-v7+
#Now : initramfs initrd.img-4.4.27-v7+
我自己发现spi_bcm2708
不再可用,lsmod 提示我 spi_bcm2835 似乎是要使用的新模块。在我的系统和 initramfs 内容中用 spi_bcm2835 替换每个出现的 spi_bcm2708 并没有解决问题。
我还检查了没有相关模块被列入黑名单,并且记录在 deviceTree 日志中没有错误。
以下是触摸屏的加载方式:
[ 4.873550] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 6.176518] udevd[377]: starting version 175
[ 6.631417] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[ 6.800118] bcm2708_i2c 3f804000.i2c: BSC1 Controller at 0x3f804000 (irq 83) (baudrate 100000)
[ 6.868206] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[ 7.027694] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[ 7.035284] fb_s6d02a1: module is from the staging directory, the quality is unknown, you have been warned.
[ 7.036436] fbtft_of_value: width = 320
[ 7.036463] fbtft_of_value: height = 480
[ 7.036481] fbtft_of_value: buswidth = 8
[ 7.036496] fbtft_of_value: debug = 3
[ 7.036510] fbtft_of_value: rotate = 270
[ 7.036523] fbtft_of_value: fps = 30
[ 7.036536] fbtft_of_value: txbuflen = 32768
[ 7.037182] fb_s6d02a1 spi0.0: fbtft_request_one_gpio: 'reset-gpios' = GPIO15
[ 7.037273] fb_s6d02a1 spi0.0: fbtft_request_one_gpio: 'dc-gpios' = GPIO25
[ 7.037357] fb_s6d02a1 spi0.0: fbtft_request_one_gpio: 'led-gpios' = GPIO18
[ 7.037577] fb_s6d02a1 spi0.0: fbtft_verify_gpios()
[ 7.037614] fb_s6d02a1 spi0.0: fbtft_reset()
[ 7.157731] fb_s6d02a1 spi0.0: init: write_register:
[ 7.157763] fb_s6d02a1 spi0.0: buf[0] = B0
[ 7.157779] fb_s6d02a1 spi0.0: buf[1] = 00
[ 7.157950] fb_s6d02a1 spi0.0: init: write_register:
[ 7.157974] fb_s6d02a1 spi0.0: buf[0] = 11
[ 7.158014] fb_s6d02a1 spi0.0: init: msleep(255)
[ 7.418607] fb_s6d02a1 spi0.0: init: write_register:
[ 7.418637] fb_s6d02a1 spi0.0: buf[0] = B3
[ 7.418654] fb_s6d02a1 spi0.0: buf[1] = 02
[ 7.418669] fb_s6d02a1 spi0.0: buf[2] = 00
[ 7.418685] fb_s6d02a1 spi0.0: buf[3] = 00
[ 7.418700] fb_s6d02a1 spi0.0: buf[4] = 00
[ 7.418797] fb_s6d02a1 spi0.0: init: write_register:
[ 7.418815] fb_s6d02a1 spi0.0: buf[0] = C0
[ 7.418831] fb_s6d02a1 spi0.0: buf[1] = 13
[ 7.418846] fb_s6d02a1 spi0.0: buf[2] = 3B
[ 7.418861] fb_s6d02a1 spi0.0: buf[3] = 00
[ 7.418876] fb_s6d02a1 spi0.0: buf[4] = 02
[ 7.418891] fb_s6d02a1 spi0.0: buf[5] = 00
[ 7.418906] fb_s6d02a1 spi0.0: buf[6] = 01
[ 7.418921] fb_s6d02a1 spi0.0: buf[7] = 00
[ 7.418936] fb_s6d02a1 spi0.0: buf[8] = 43
[ 7.418993] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419010] fb_s6d02a1 spi0.0: buf[0] = C1
[ 7.419025] fb_s6d02a1 spi0.0: buf[1] = 08
[ 7.419041] fb_s6d02a1 spi0.0: buf[2] = 16
[ 7.419056] fb_s6d02a1 spi0.0: buf[3] = 08
[ 7.419071] fb_s6d02a1 spi0.0: buf[4] = 08
[ 7.419121] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419138] fb_s6d02a1 spi0.0: buf[0] = C4
[ 7.419153] fb_s6d02a1 spi0.0: buf[1] = 11
[ 7.419168] fb_s6d02a1 spi0.0: buf[2] = 07
[ 7.419183] fb_s6d02a1 spi0.0: buf[3] = 03
[ 7.419198] fb_s6d02a1 spi0.0: buf[4] = 03
[ 7.419249] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419265] fb_s6d02a1 spi0.0: buf[0] = C6
[ 7.419281] fb_s6d02a1 spi0.0: buf[1] = 00
[ 7.419329] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419345] fb_s6d02a1 spi0.0: buf[0] = C8
[ 7.419361] fb_s6d02a1 spi0.0: buf[1] = 03
[ 7.419376] fb_s6d02a1 spi0.0: buf[2] = 03
[ 7.419392] fb_s6d02a1 spi0.0: buf[3] = 13
[ 7.419407] fb_s6d02a1 spi0.0: buf[4] = 5C
[ 7.419422] fb_s6d02a1 spi0.0: buf[5] = 03
[ 7.419437] fb_s6d02a1 spi0.0: buf[6] = 07
[ 7.419452] fb_s6d02a1 spi0.0: buf[7] = 14
[ 7.419467] fb_s6d02a1 spi0.0: buf[8] = 08
[ 7.419482] fb_s6d02a1 spi0.0: buf[9] = 00
[ 7.419497] fb_s6d02a1 spi0.0: buf[10] = 21
[ 7.419512] fb_s6d02a1 spi0.0: buf[11] = 08
[ 7.419528] fb_s6d02a1 spi0.0: buf[12] = 14
[ 7.419543] fb_s6d02a1 spi0.0: buf[13] = 07
[ 7.419558] fb_s6d02a1 spi0.0: buf[14] = 53
[ 7.419573] fb_s6d02a1 spi0.0: buf[15] = 0C
[ 7.419588] fb_s6d02a1 spi0.0: buf[16] = 13
[ 7.419603] fb_s6d02a1 spi0.0: buf[17] = 03
[ 7.419618] fb_s6d02a1 spi0.0: buf[18] = 03
[ 7.419633] fb_s6d02a1 spi0.0: buf[19] = 21
[ 7.419648] fb_s6d02a1 spi0.0: buf[20] = 00
[ 7.419709] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419726] fb_s6d02a1 spi0.0: buf[0] = 35
[ 7.419741] fb_s6d02a1 spi0.0: buf[1] = 00
[ 7.419788] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419805] fb_s6d02a1 spi0.0: buf[0] = 36
[ 7.419821] fb_s6d02a1 spi0.0: buf[1] = A0
[ 7.419868] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419885] fb_s6d02a1 spi0.0: buf[0] = 3A
[ 7.419900] fb_s6d02a1 spi0.0: buf[1] = 55
[ 7.419948] fb_s6d02a1 spi0.0: init: write_register:
[ 7.419965] fb_s6d02a1 spi0.0: buf[0] = 44
[ 7.419980] fb_s6d02a1 spi0.0: buf[1] = 00
[ 7.419995] fb_s6d02a1 spi0.0: buf[2] = 01
[ 7.420043] fb_s6d02a1 spi0.0: init: write_register:
[ 7.420060] fb_s6d02a1 spi0.0: buf[0] = D0
[ 7.420076] fb_s6d02a1 spi0.0: buf[1] = 07
[ 7.420091] fb_s6d02a1 spi0.0: buf[2] = 07
[ 7.420106] fb_s6d02a1 spi0.0: buf[3] = 1D
[ 7.420122] fb_s6d02a1 spi0.0: buf[4] = 03
[ 7.420179] fb_s6d02a1 spi0.0: init: write_register:
[ 7.420196] fb_s6d02a1 spi0.0: buf[0] = D1
[ 7.420212] fb_s6d02a1 spi0.0: buf[1] = 03
[ 7.420227] fb_s6d02a1 spi0.0: buf[2] = 30
[ 7.420242] fb_s6d02a1 spi0.0: buf[3] = 10
[ 7.420290] fb_s6d02a1 spi0.0: init: write_register:
[ 7.420307] fb_s6d02a1 spi0.0: buf[0] = D2
[ 7.420322] fb_s6d02a1 spi0.0: buf[1] = 03
[ 7.420337] fb_s6d02a1 spi0.0: buf[2] = 14
[ 7.420353] fb_s6d02a1 spi0.0: buf[3] = 04
[ 7.420401] fb_s6d02a1 spi0.0: init: write_register:
[ 7.420417] fb_s6d02a1 spi0.0: buf[0] = 29
[ 7.420451] fb_s6d02a1 spi0.0: init: write_register:
[ 7.420467] fb_s6d02a1 spi0.0: buf[0] = 2C
[ 7.504691] fb_s6d02a1 spi0.0: Display update: 3565 kB/s, fps=0
[ 7.505815] graphics fb1: fb_s6d02a1 frame buffer, 480x320, 300 KiB video memory, 32 KiB DMA buffer memory, fps=33, spi0.0 at 68 MHz
[ 7.505842] fb_s6d02a1 spi0.0: fbtft_backlight_update_status: polarity=0, power=0, fb_blank=0
[ 7.507039] ads7846 spi0.1: touchscreen, irq 170
[ 7.507764] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input1
这是屏幕加载后 lsmod 的结果:
uvcvideo 72430 0
videobuf2_vmalloc 5187 1 uvcvideo
videobuf2_memops 1268 1 videobuf2_vmalloc
videobuf2_v4l2 16535 1 uvcvideo
videobuf2_core 20861 2 uvcvideo,videobuf2_v4l2
v4l2_common 3929 1 videobuf2_v4l2
videodev 132913 4 uvcvideo,v4l2_common,videobuf2_core,videobuf2_v4l2
media 11573 2 uvcvideo,videodev
evdev 11396 0
ads7846 11390 0
fb_s6d02a1 3367 0
hwmon 2840 1 ads7846
fbtft 26084 1 fb_s6d02a1
syscopyarea 2945 1 fbtft
sysfillrect 3443 1 fbtft
sysimgblt 2069 1 fbtft
fb_sys_fops 1309 1 fbtft
bcm2835_gpiomem 3040 0
spi_bcm2835 6678 0
i2c_bcm2708 4834 0
bcm2835_wdt 3225 0
uio_pdrv_genirq 3164 0
uio 8000 1 uio_pdrv_genirq
我是否缺少一些明显的使其工作的东西,或者某种跟踪 initramfs/deviceTree/Modules 错误的方法?
谢谢 :)
相对于评论进行编辑:
通过 成功生成了 initramfs update-initramfs -c -k 'uname -r' -v
。感谢 @Rui F Ribeiro 向我指出 initramfs 的另一个包含文件夹,我坚持使用 /etc/initramfs-tools。