Skip to content

Commit 65a20a1

Browse files
committed
Merge branch 'rk3399-nxt' into all-in-one
2 parents 67e596a + 5d34110 commit 65a20a1

File tree

122 files changed

+9724
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+9724
-0
lines changed

rk3399/1p8.png

35.9 KB
Loading

rk3399/3p0.png

29.1 KB
Loading

rk3399/README.md

Lines changed: 892 additions & 0 deletions
Large diffs are not rendered by default.

rk3399/apio4.png

74.2 KB
Loading

rk3399/apio4_vdd.png

11.6 KB
Loading

rk3399/apio5.png

58.2 KB
Loading

rk3399/apps/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Application test example
2+
3+
## lcd_test
4+
5+
简单的LCD测试程序,在LCD屏幕上显示彩色条纹

rk3399/apps/lcd_test.c

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#include <stdlib.h>
2+
#include <unistd.h>
3+
#include <stdio.h>
4+
#include <fcntl.h>
5+
#include <linux/fb.h>
6+
#include <sys/mman.h>
7+
#include <sys/ioctl.h>
8+
9+
#ifdef ANDROID_SYSTEM
10+
#define DEFAULT_FB_DEVICE "/dev/graphics/fb0"
11+
#else
12+
#define DEFAULT_FB_DEVICE "/dev/fb0"
13+
#endif
14+
15+
/*
16+
* Usage:
17+
* Android:
18+
* # stop
19+
* ./lcd_test
20+
* # start
21+
* Linux:
22+
* ./lcd_test
23+
*/
24+
int main(int argc, char *argv[])
25+
{
26+
int fd = 0;
27+
struct fb_var_screeninfo vinfo;
28+
struct fb_fix_screeninfo finfo;
29+
long int screensize = 0;
30+
char *fbp = 0;
31+
int x = 0, y = 0;
32+
long int location = 0;
33+
34+
/* Open the file for reading and writing */
35+
fd = open(DEFAULT_FB_DEVICE, O_RDWR);
36+
if (fd == -1) {
37+
perror("Error: cannot open framebuffer device");
38+
exit(1);
39+
}
40+
printf("The framebuffer device was opened successfully.\n");
41+
42+
/* Get fixed screen information */
43+
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
44+
perror("Error reading fixed information");
45+
exit(2);
46+
}
47+
48+
/* Get variable screen information */
49+
if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
50+
perror("Error reading variable information");
51+
exit(3);
52+
}
53+
54+
printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);
55+
56+
/* Figure out the size of the screen in bytes */
57+
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
58+
59+
/* Map the device to memory */
60+
fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
61+
if (fbp < 0) {
62+
perror("Error: failed to map framebuffer device to memory");
63+
exit(4);
64+
}
65+
printf("The framebuffer device was mapped to memory successfully.\n");
66+
67+
/* Figure out where in memory to put the pixel */
68+
for (y = 0; y < vinfo.yres; y++)
69+
{
70+
for (x = 0; x < vinfo.xres; x++)
71+
{
72+
location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
73+
(y+vinfo.yoffset) * finfo.line_length;
74+
75+
if (vinfo.bits_per_pixel == 32)
76+
{
77+
*(fbp + location) = 100;// Some blue
78+
*(fbp + location + 1) = 15+(x-100)/2; // A little green
79+
*(fbp + location + 2) = 200-(y-100)/5;// A lot of red
80+
*(fbp + location + 3) = 0;// No transparency
81+
}
82+
else //assume 16bpp
83+
{
84+
int b = 10;
85+
int g = (x-100)/6; // A little green
86+
int r = 31-(y-100)/16;// A lot of red
87+
unsigned short int t = r<<11 | g << 5 | b;
88+
*((unsigned short int*)(fbp + location)) = t;
89+
}
90+
}
91+
}
92+
93+
munmap(fbp, screensize);
94+
close(fd);
95+
return 0;
96+
}

rk3399/bsp/README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# BSP for Firefly_RK3399
2+
3+
## 分区表
4+
5+
![默认分区表](default_storage_map.png)
6+
7+
更新分区表方法1(烧写分区表文件)
8+
9+
rkdeveloptool db rk3399_loader_v1.08.106.bin
10+
rkdeveloptool gpt parameter_gpt.txt
11+
12+
parameter_gpt.txt内容如下
13+
14+
CMDLINE:
15+
mtdparts=rk29xxnand:0x00001f40@0x00000040(loader1),0x00000080@0x00001f80(reserved1),0x00002000@0x00002000(reserved2),0x00002000@0x00004000(loader2),0x00002000@0x00006000(atf),0x00038000@0x00008000(boot:bootable),-@0x0040000(rootfs)
16+
17+
更新分区表方法2(uboot中操作)
18+
19+
=> env set partitions name=rootfs,size=-,type=system
20+
=> gpt write mmc 0 $partitions
21+
22+
23+
更新分区表方法3(fastboot烧写,参考官网)
24+
25+
## U-Boot 2017.09
26+
27+
使用ROCKCHIP官方代码
28+
29+
mkdir rk-linux
30+
cd rk-linux
31+
32+
repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master
33+
repo sync
34+
35+
编译Uboot
36+
37+
build/mk-uboot.sh rk3399-firefly
38+
39+
或者使用54shady的代码
40+
41+
[Firefly_RK3399_UBOOT_Usage](https://github.com/54shady/firefly_rk3399_uboot)
42+
43+
### 启动分析
44+
45+
启动参数涉及下面环境变量
46+
47+
bootcmd=run distro_bootcmd
48+
49+
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
50+
51+
boot_targets=mmc0 mmc1 usb0 pxe dhcp
52+
53+
bootcmd_mmc0=setenv devnum 0; run mmc_boot
54+
55+
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
56+
57+
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devpli st || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devn um}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
58+
59+
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in $ {boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_ for_efi;
60+
61+
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/ extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCR IPT FAILED: continuing...; fi
62+
63+
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
64+
65+
上面环境变量最终结果
66+
67+
sysboot mmc 0:4 any 0x00500000 /extlinux/extlinux.conf
68+
69+
## Kernel (4.4.16)
70+
71+
获取代码
72+
73+
git clone https://github.com/54shady/firefly_rk3399_kernel.git
74+
75+
编译出Image和dtb
76+
77+
./mk-kernel.sh
78+
79+
## Rootfs
80+
81+
ROCKCHIP官方提供的linaro-rootfs.img即可,或是自己制作
82+
83+
## Flash Image
84+
85+
使用rkdeveloptool烧写所有镜像
86+
87+
rkdeveloptool db rk3399_loader_v1.08.106.bin
88+
rkdeveloptool wl 0x40 idbloader.img
89+
rkdeveloptool wl 0x4000 uboot.img
90+
rkdeveloptool wl 0x6000 trust.img
91+
rkdeveloptool wl 0x8000 boot.img
92+
rkdeveloptool wl 0x40000 linaro-rootfs.img
93+
rkdeveloptool rd
94+
95+
进入uboot后,写入gpt
96+
97+
gpt write mmc 0 $partitions
98+
99+
文件build/extlinux/rk3399.conf内容如下
100+
101+
label kernel-4.4
102+
kernel /Image
103+
fdt /rk3399-firefly-linux.dtb
104+
append earlyprintk console=ttyFIQ0,115200 rw root=PARTUUID=b921b045-1d rootfstype=ext4 init=/sbin/init rootwait

rk3399/bsp/default_storage_map.png

54.9 KB
Loading

0 commit comments

Comments
 (0)