您尚未登录。

楼主 # 2022-11-03 11:13:22

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

基于f1c200s运行linux的学习记录.

一.起步阶段,参考帖子如下:
尝试从零构建F1C100s开发环境» 2019-11-03 13:34:50 » 作者:LinjieGuo
荔枝派nano f1c100s 开发板入坑记录 » 2018-09-10 16:17:24 » 作者:晕哥

离线

楼主 #1 2022-11-03 13:09:32

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

Re: 基于f1c200s运行linux的学习记录.

如果屏的大小分辨大于2m需要修改Uboot,下面内容引自坛友"无情一刀"
那个fbuffer会报错 就是因为如果是启动出现CONFIG_SUNXI_MAX_FB_SIZE的内存不够修改u-boot/include/configs/sunxi-common.h/CONFIG_SUNXI_MAX_FB_SIZE的中的大小 uboot默认设置为2M 我已修改为4M(在309 行)
#ifndef CONFIG_MACH_SUN8I_V3S
#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
#else
#define CONFIG_SUNXI_MAX_FB_SIZE (2 << 20)
#endif缓冲区不够,还有在代码里面修改为4M就可以"

____________________________________________________________________________________
本人屏1024*600*3<2m不做修改

离线

楼主 #2 2022-11-03 13:13:23

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

Re: 基于f1c200s运行linux的学习记录.

u-boot/include/configs/sunxi-common.h
设置了默认的kernel,fdt存放地址.

#elif defined(CONFIG_MACH_SUNIV)
/*
* 32M RAM minus 1MB heap + 8MB for u-boot, stack, fb, etc.
* 8M uncompressed kernel, 4M compressed kernel, 512K fdt,
* 512K script, 512K pxe and the ramdisk at the end.
*/
#define BOOTM_SIZE     __stringify(0x1700000)
#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(0500000))
#define FDT_ADDR_R     __stringify(SDRAM_OFFSET(0C00000))
#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(0C50000))
#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(0D00000))
#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(0D50000))

其中SDRAM_OFFSET宏位置\u-boot\include\configs\sunxi-common.h
#elif defined(CONFIG_MACH_SUNIV)
#define SDRAM_OFFSET(x) 0x8##x


KERNEL_ADDR_R  =0x80500000
设置部分代码
#define MEM_LAYOUT_ENV_SETTINGS \
    "bootm_size=" BOOTM_SIZE "\0" \
    "kernel_addr_r=" KERNEL_ADDR_R "\0" \
    "fdt_addr_r=" FDT_ADDR_R "\0" \
    "scriptaddr=" SCRIPT_ADDR_R "\0" \
    "pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
    "ramdisk_addr_r=" RAMDISK_ADDR_R "\0"

最近编辑记录 nice (2022-11-03 13:18:17)

离线

楼主 #3 2022-11-04 12:54:56

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

Re: 基于f1c200s运行linux的学习记录.

1.Uboot
    在uboot源码目录下 进入 ./include/configs/,修改 suniv.h
   
#define CONFIG_BOOTCOMMAND   "sf probe 0 50000000; "                           \
                             "sf read 0x80C00000 0x30000 0x4000; "  \
                             "sf read 0x80008000 0x40000 0x260000; " \
                             "bootz 0x80008000 - 0x80C00000"

不要在sunxi-common.h添加
因为suniv.h 中#include <configs/sunxi-common.h>
注:精简参考:F1C100S/F1C200S-减少开机时间、uboot、内核、根文件系统裁减优化问题 » 2020-01-29 23:22:57 » 作者:颜水花生


2.linux
Github下载的zip用unzip出错,改用:7z x 压缩文件名

linux屏驱动使用simple-panel,
linux 自带的屏的具体见文件.\linux\drivers\gpu\drm\panel\panel-simple.c
找到兼容的屏,修改设备书中的,panel
    panel: panel {
        compatible = "tianma,tm070jdhg30", "simple-panel";
        #address-cells = <1>;
        #size-cells = <0>;
        enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;


修改./linux/Makefile
把ARCH,和CROSS_COMPILE设置上.并将找来的.config拷贝到./linux下面.

离线

楼主 #4 2022-11-07 16:35:36

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

Re: 基于f1c200s运行linux的学习记录.

参考链接基于荔枝派Nano学习Buildroot的构建过程
应用程序如动态链接方式,动态库的提供依赖于交叉编译工具链最好使用同一个交叉编译工具链。

buildroot2007先下载,make menuconfig设置内部编译器为7.x,make一下,再把虚拟机的arm-gcc定位到:/buildroot-2017.08/output/host/bin/arm-linux-gcc,再编译u-boot,linux.

离线

楼主 #5 2022-11-10 09:55:07

nice
会员
注册时间: 2021-01-02
已发帖子: 29
积分: 26

Re: 基于f1c200s运行linux的学习记录.

linux屏幕反色修改

From adbe5b4615ed355fdd76465b0e6b89de2e9f19a4 Mon Sep 17 00:00:00 2001
From: jiangming1399 <jiangming1399@163.com>
Date: Tue, 7 Apr 2020 16:51:31 +0800
Subject: [PATCH] [drm] sun4i: add swap red and blue on tcon0

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 13 +++++++++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index ce9846c91..b024312b3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -419,6 +419,12 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
 			   SUN4I_TCON0_CTL_CLK_DELAY_MASK,
 			   SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
 
+	if (tcon->swap_red_blue) {
+		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
+				SUN4I_TCON0_CTL_SWAP,
+				SUN4I_TCON0_CTL_SWAP);
+	}
+
 	/*
 	 * This is called a backporch in the register documentation,
 	 * but it really is the back porch + hsync
@@ -498,6 +504,12 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 			   SUN4I_TCON0_CTL_CLK_DELAY_MASK,
 			   SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
 
+	if (tcon->swap_red_blue) {
+		regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
+				SUN4I_TCON0_CTL_SWAP,
+				SUN4I_TCON0_CTL_SWAP);
+	}
+
 	/*
 	 * This is called a backporch in the register documentation,
 	 * but it really is the back porch + hsync
@@ -1103,6 +1115,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	tcon->dev = dev;
 	tcon->id = engine->id;
 	tcon->quirks = of_device_get_match_data(dev);
+	tcon->swap_red_blue = of_property_read_bool(dev->of_node, "swap-red-blue");
 
 	tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
 	if (IS_ERR(tcon->lcd_rst)) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index f9f1fe80b..fe8953fe0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -53,6 +53,7 @@
 #define SUN4I_TCON0_CTL_TCON_ENABLE			BIT(31)
 #define SUN4I_TCON0_CTL_IF_MASK				GENMASK(25, 24)
 #define SUN4I_TCON0_CTL_IF_8080				(1 << 24)
+#define SUN4I_TCON0_CTL_SWAP				BIT(23)
 #define SUN4I_TCON0_CTL_CLK_DELAY_MASK			GENMASK(8, 4)
 #define SUN4I_TCON0_CTL_CLK_DELAY(delay)		((delay << 4) & SUN4I_TCON0_CTL_CLK_DELAY_MASK)
 #define SUN4I_TCON0_CTL_SRC_SEL_MASK			GENMASK(2, 0)
@@ -259,6 +260,8 @@ struct sun4i_tcon {
 	/* Associated crtc */
 	struct sun4i_crtc		*crtc;
 
+	bool			swap_red_blue;
+
 	int				id;
 
 	/* TCON list management */
-- 
2.26.0

上面不行,则修改/drivers/gpu/drm/sun4i/sun4i_backend.c

int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
				       int layer, struct drm_plane *plane)
{
	struct drm_plane_state *state = plane->state;
	struct drm_framebuffer *fb = state->fb;
	bool interlaced = false;
	u32 val;
	int ret;

	if (plane->state->crtc)
		interlaced = plane->state->crtc->state->adjusted_mode.flags
			& DRM_MODE_FLAG_INTERLACE;

	regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_MODCTL_REG,
			   SUN4I_BACKEND_MODCTL_ITLMOD_EN,
			   interlaced ? SUN4I_BACKEND_MODCTL_ITLMOD_EN : 0);

	DRM_DEBUG_DRIVER("Switching display backend interlaced mode %s\n",
			 interlaced ? "on" : "off");

	ret = sun4i_backend_drm_format_to_layer(plane, fb->format->format,
						&val);
	if (ret) {
		DRM_DEBUG_DRIVER("Invalid format\n");
		return ret;
	}

	regmap_update_bits(backend->engine.regs,
			   SUN4I_BACKEND_ATTCTL_REG1(layer),
			   SUN4I_BACKEND_ATTCTL_REG1_LAY_FBFMT, val);
    regmap_update_bits(backend->engine.regs,
			   SUN4I_BACKEND_ATTCTL_REG1(layer),
			   1<<2, 1<<2);

	return 0;
}

最近编辑记录 nice (2022-11-10 16:12:01)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn