在 Toradex 模块上重新编译 Linux 内核的一般指南在以下来自 Toradex developer website 的文章中描述:
Build U-Boot and Linux Kernel From Source Code
首先你必须安装交叉编译工具链,如Build U-Boot and Linux Kernel From Source Code - Toolchain中所述
具体到您的用例,您必须克隆Build U-Boot and Linux Kernel From Source Code - Source Code - i.MX 6 Based Modules (Apalis/Colibri iMX6) 表中提供的正确 iMX6 内核分支。从您在问题中提供的链接来看,它似乎是toradex_4.9-2.3.x-imx。然后获取内核源代码关注Build U-Boot and Linux Kernel From Source Code - Kernel Source
之后,您必须使用 apalis_imx6_defconfig 为 Apalis iMX6 配置内核,如 Build U-Boot and Linux Kernel From Source Code - Kernel Configuration - i.MX 6 based modules 中所述
现在是您对源代码文件 drivers/video/fbdev/mxc/mxc_edid.c 进行更改的时候了。
完成后,是时候编译内核了,在Build U-Boot and Linux Kernel From Source Code - Kernel Compilation - i.MX 6 Based Kernel (Apalis/Colibri iMX6) 中有描述。您可能还需要按照Build U-Boot and Linux Kernel From Source Code - Kernel Module Compilation, all Modules 中的说明重新编译内核模块。
最后按照Build U-Boot and Linux Kernel From Source Code - Kernel Update 中的说明将内核更新到板上。
迭代edit source code的过程 --> re-build the kernel --> re-deploy the kernel --> test changes直到你确定为止。
或者,您可以编辑设备树来添加您的显示配置。
这样做的主要参考是Device Tree Customization。设备树源码基本上是内核源码自带的,Build U-Boot and Linux Kernel From Source Code也提供了如何编译设备树的信息。
这是一个代码 sn-p 突出显示相关更改:
timing_wide: 1920x720 {
+ clock-frequency = <104600000>;
+ hactive = <1920>;
+ vactive = <720>;
+ hback-porch = <24>;
+ hfront-porch = <24>;
+ vback-porch = <8>;
+ vfront-porch = <57>;
+ hsync-len = <32>;
+ vsync-len = <5>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
将其调整为适合您的显示器后,按照Build U-Boot and Linux Kernel From Source Code 中的说明构建并部署到设备。
将设备树部署到模块后,您只需在 U-Boot 中设置正确的 vidargs:
env set vidargs video=mxcfb0:dev=ldb,1920x720M@60,if=RGB666 ldb=sin0 fbmem=32M
env save
reset
请注意,您不需要重建 U-Boot。您必须通过以下方式访问模块终端:
1) 调试 UART,即串行控制台或;
2) 连接到模块的显示器和 USB 键盘。
重启或重启时,您必须按任意键(如果使用 1,则从计算机中的串行终端仿真器应用程序)或直接在模块上(如果使用 2))访问 U-Boot 环境,您可以在其中执行上述命令。
有关设备树自定义的参考,以下是支持自定义 LVDS 显示的相关设备树文件的差异(不是您的显示,但可以用作示例):
diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index cfaaa571c158..b3c92314367b 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -89,8 +89,8 @@
mxcfb1: fb@0 {
compatible = "fsl,mxc_sdc_fb";
disp_dev = "ldb";
- interface_pix_fmt = "RGB666";
- default_bpp = <16>;
+ interface_pix_fmt = "RGB24";
+ default_bpp = <24>;
int_clk = <0>;
late_init = <0>;
status = "disabled";
@@ -507,123 +507,135 @@
};
&ldb {
- status = "okay";
-// split-mode;
-// dual-mode;
-
- lvds-channel@0 {
- reg = <0>;
- fsl,data-mapping = "spwg"; /* "jeida"; */
- fsl,data-width = <18>;
- crtc = "ipu2-di1";
- primary;
- status = "okay";
-
- display-timings {
- native-mode = <&timing_xga>;
- /* LDB-AM-800600LTNQW-A0H */
- timing_svga: 800x600 {
- clock-frequency = <55000000>;
- hactive = <800>;
- vactive = <600>;
- hback-porch = <112>;
- hfront-porch = <32>;
- vback-porch = <3>;
- vfront-porch = <17>;
- hsync-len = <80>;
- vsync-len = <4>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- /* Standard XGA timing */
- timing_xga: 1024x768 {
- clock-frequency = <65000000>;
- hactive = <1024>;
- vactive = <768>;
- hback-porch = <160>;
- hfront-porch = <24>;
- vback-porch = <29>;
- vfront-porch = <3>;
- hsync-len = <136>;
- vsync-len = <6>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- timing_wxga: 1280x800 {
- clock-frequency = <68930000>;
- hactive = <1280>;
- vactive = <800>;
- hback-porch = <64>;
- hfront-porch = <64>;
- vback-porch = <5>;
- vfront-porch = <5>;
- hsync-len = <40>;
- vsync-len = <6>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- /* LTTD1280800101-L4WH-CT1, note that it needs
- fsl,data-mapping = "spwg"; fsl,data-width = <24>; */
- timing_wxga1: 1280x800-1 {
- clock-frequency = <71100000>;
- hactive = <1280>;
- vactive = <800>;
- hback-porch = <60>;
- hfront-porch = <60>;
- vback-porch = <7>;
- vfront-porch = <7>;
- hsync-len = <40>;
- vsync-len = <9>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- timing_fullhd: 1920x1080 {
- clock-frequency = <138500000>;
- hactive = <1920>;
- vactive = <1080>;
- hback-porch = <80>;
- hfront-porch = <48>;
- vback-porch = <23>;
- vfront-porch = <3>;
- hsync-len = <32>;
- vsync-len = <5>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- };
- };
-
- lvds-channel@1 {
- reg = <1>;
- fsl,data-mapping = "spwg";
- fsl,data-width = <18>;
- crtc = "ipu1-di0";
- status = "okay";
-
- display-timings {
-/* native-mode = <&timing_svga_ch2>;*/
- /* LDB-AM-800600LTNQW-A0H */
- timing_svga_ch2: 800x600 {
- clock-frequency = <55000000>;
- hactive = <800>;
- vactive = <600>;
- hback-porch = <112>;
- hfront-porch = <32>;
- vback-porch = <3>;
- vfront-porch = <17>;
- hsync-len = <80>;
- vsync-len = <4>;
- hsync-active = <0>;
- vsync-active = <0>;
- pixelclk-active = <0>;
- };
- };
- };
+ status = "okay";
+ split-mode; // split mode on
+// dual-mode;
+
+ lvds-channel@0 {
+ reg = <0>;
+ fsl,data-mapping = "spwg"; /* "jeida"; */
+ fsl,data-width = <24>;
+ crtc = "ipu2-di1";
+ primary;
+ status = "okay";
+
+ display-timings {
+ native-mode = <&timing_wide>;
+ /* LDB-AM-800600LTNQW-A0H */
+ timing_svga: 800x600 {
+ clock-frequency = <55000000>;
+ hactive = <800>;
+ vactive = <600>;
+ hback-porch = <112>;
+ hfront-porch = <32>;
+ vback-porch = <3>;
+ vfront-porch = <17>;
+ hsync-len = <80>;
+ vsync-len = <4>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ /* Standard XGA timing */
+ timing_xga: 1024x768 {
+ clock-frequency = <65000000>;
+ hactive = <1024>;
+ vactive = <768>;
+ hback-porch = <160>;
+ hfront-porch = <24>;
+ vback-porch = <29>;
+ vfront-porch = <3>;
+ hsync-len = <136>;
+ vsync-len = <6>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ timing_wxga: 1280x800 {
+ clock-frequency = <68930000>;
+ hactive = <1280>;
+ vactive = <800>;
+ hback-porch = <64>;
+ hfront-porch = <64>;
+ vback-porch = <5>;
+ vfront-porch = <5>;
+ hsync-len = <40>;
+ vsync-len = <6>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ timing_fullhd: 1920x1080 {
+ clock-frequency = <138500000>;
+ hactive = <1920>;
+ vactive = <1080>;
+ hback-porch = <80>;
+ hfront-porch = <48>;
+ vback-porch = <23>;
+ vfront-porch = <3>;
+ hsync-len = <32>;
+ vsync-len = <5>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ timing_wide: 1920x720 {
+ clock-frequency = <104600000>;
+ hactive = <1920>;
+ vactive = <720>;
+ hback-porch = <24>;
+ hfront-porch = <24>;
+ vback-porch = <8>;
+ vfront-porch = <57>;
+ hsync-len = <32>;
+ vsync-len = <5>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ };
+ };
+
+ lvds-channel@1 {
+ reg = <1>;
+ fsl,data-mapping = "spwg";
+ fsl,data-width = <18>;
+ crtc = "ipu1-di0";
+ status = "okay";
+
+ display-timings {
+ native-mode = <&timing_wide_ch2>;
+ /* LDB-AM-800600LTNQW-A0H */
+ timing_svga_ch2: 800x600 {
+ clock-frequency = <55000000>;
+ hactive = <800>;
+ vactive = <600>;
+ hback-porch = <112>;
+ hfront-porch = <32>;
+ vback-porch = <3>;
+ vfront-porch = <17>;
+ hsync-len = <80>;
+ vsync-len = <4>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ timing_wide_ch2: 1920x720 {
+ clock-frequency = <104600000>;
+ hactive = <1920>;
+ vactive = <720>;
+ hback-porch = <24>;
+ hfront-porch = <24>;
+ vback-porch = <8>;
+ vfront-porch = <57>;
+ hsync-len = <32>;
+ vsync-len = <5>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pixelclk-active = <0>;
+ };
+ };
+ };
};