nanopi t3 plus 学习(一)

make mrproper命令会删除所有的编译生成文件、内核配置文件(.config文件)和各种备份文件,所以几乎只在第一次执行内核编译前才用这条命令。

make clean命令则是用于删除大多数的编译生成文件,但是会保留内核的配置文件.config,还有足够的编译支持来建立扩展模块。所以你若只想删除前一次编译过程的残留数据,只需执行make clean命令。

1,下载内核
git clone https://github.com/friendlyarm/linux.git -b nanopi2-v4.4.y --depth 1
2,编译Ubuntu内核
touch .scmversion
make ARCH=arm64 nanopi3_linux_defconfig
make ARCH=arm64

新生成的内核是 arch/arm64/boot/Image,目录arch/arm64/boot/dts/nexell/下还包括新的DTB文件(s5p6818-nanopi3-rev*.dtb),用于替换掉SD卡boot分区下对应的文件。

2,制作sd卡启动卡

  1. 将SD卡插入Ubuntu的电脑,用以下命令查看你的SD卡设备名
    dmesg | tail
    当dmesg输出类拟信息 sdc: sdc1 sdc2时,则表示SD卡对应的设备名为 /dev/sdc,也通过用命令cat /proc/partitions来查看。
  2. 下载Linux下的制作脚本
    git clone https://github.com/friendlyarm/sd-fuse_s5p6818.git
    cd sd-fuse_s5p6818
  3. 以下是制作启动Lubuntu desktop的SD卡的方法
    sudo ./fusing.sh /dev/sdx lubuntu
    (注:/dev/sdx请替换为实际的SD卡设备文件名)
    制作包中未包含系统映象文件,第一次使用时会提示需要下载,输入Y下载,N或10秒未输入则取消。
  4. 如果只想制成一个用于量产的系统映象文件,方法如下:
    sudo ./mkimage.sh lubuntu

注:core-qte-arm64指的是s5p6818-friendly-core-xenial-4.4-arm64
core-qte :s5p6818-friendly-core-xenial-4.4-armhf(用4.4的内核)

自己实现方法:
(1)git clone https://github.com/friendlyarm/sd-fuse_s5p6818.git
cd sd-fuse_s5p6818
(2)怎么修改u-boot和kernel
编译U-Boot
(1)下载U-Boot v2016.01源代码并编译,分支是nanopi2-v2016.01,与S5P4418相同。
git clone https://github.com/friendlyarm/u-boot.git
cd u-boot
git checkout nanopi2-v2016.01
make make s5p6818_nanopi3_defconfig
make CROSS_COMPILE=aarch64-linux-

用编译成功结束后您将获得fip-nonsecure.img,用sd-fuse_s5p6818和eflasher ROM来更新板上的U-Boot。

Linux4.4.y内核编译中的问题:

sudo gedit ~/.bashrc,最后一行加入aarch64-linux-gnu-gcc的链接地址
export PATH=/usr/bin:$PATH
export GCC_COLORS=auto
Linux.4.4.y u-boot编译遇到问题:
1.openssl/ssl.h这里是库文件缺失,执行命令
$ sudo apt-get install libssl-dev
2./bin/sh: 1:dtc: not found 缺dtc工具,执行命令
$ sudo apt-get install device-tree-compiler
3.dtc: invalid option – ‘i’ 这里是dtc工具有问题,执行以下命令
$ sudo  wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
$ sudo chmod 777 dtc.sh
$ ./dtc.sh

内核移植问题讲解
1,linux-4.4.x.y内核lcd所在处:linux/drivers/gpu/drm/panel
问题1: I2C总线怎么绕开的。
(1)linux.3.4.y内核和uboot改动参考:
第一点:kernel:lcds.c
最上面加上
/* NXP display configs for supported LCD /
static struct nxp_lcd wxga_at080tn64 = {
.width = 800,
.height = 480,
.p_width = 154,
.p_height = 90,
.bpp = 24,
.freq = 60, /
page 11 */

.timing = {
	.h_fp = 80,
	.h_bp = 36,
	.h_sw = 10,
	.v_fp = 22,
	.v_fpe = 1,
	.v_bp = 15,
	.v_bpe = 1,
	.v_sw = 8,
},
.polarity = {
	.rise_vclk = 0,
	.inv_hsync = 1,
	.inv_vsync = 1,
	.inv_vden = 0,
},
.gpio_init = s70_gpio_init,

};

第二点:uboot:board.c(add)
} else {
printf(“LCD = %s\n”, nanopi2_get_lcd_name());

	cfg = nanopi2_get_lcd();
	width  = cfg->width;
	height = cfg->height;

	printf("width:%d height:%d\n", width, height);(add)
}

#if defined(CONFIG_DISPLAY_OUT)
/* Clear framebuffer */
memset((void *)CONFIG_FB_ADDR, 0, width * height * 4);
#endif
} else {
setenv(“kernel”, CONFIG_KERNELIMAGE);
}

if (bootargs && strncmp(cmdline, bootargs, sizeof(cmdline))) {
	setenv("bootargs", cmdline);

	printf("=== cmdline:%s\n", cmdline);(add)
	saveenv();
}

}

/* call from u-boot */
int board_early_init_f(void)

第三点:boot:lcd.c(add)
最上面加上:
static struct nxp_lcd wxga_at080tn64 = {
.width = 800,
.height = 480,
.p_width = 154,
.p_height = 90,
.bpp = 24,
.freq = 60, /* page 11 */

.timing = {
	.h_fp = 80,
	.h_bp = 36,
	.h_sw = 10,
	.v_fp = 22,
	.v_fpe = 1,
	.v_bp = 15,
	.v_bpe = 1,
	.v_sw = 8,
},
.polarity = {
	.rise_vclk = 0,
	.inv_hsync = 1,
	.inv_vsync = 1,
	.inv_vden = 0,
},
.gpio_init = s70_gpio_init,

};

第四点:boot:onewire.c(update)
nt onewire_get_lcd_id(void)
{
//return lcd_id;
return 111;
}

第五点:boot/include/cfg_main.h

#define CFG_DISP_PRI_RESOL_WIDTH 1280 // X Resolution
#define CFG_DISP_PRI_RESOL_HEIGHT 800 // Y Resolution
update
#define CFG_DISP_PRI_RESOL_WIDTH 800 // X Resolution
#define CFG_DISP_PRI_RESOL_HEIGHT 480 // Y Resolution

猜你喜欢

转载自blog.csdn.net/qq_40008325/article/details/86321334
T3