前言
一年前从某淘宝垃圾堆店铺收得两块RK3066机顶盒主板,共计64大洋。
板子成色一般,功能正常,其硬件配置为
- CPU: RK3066 1.0Ghz
- RAM: 南亚 1Gbyte
- NAND: hynix 4Gbyte
- PMU: tps65910
- phy: smsc8720a
- usb hub: smsc usx2064或smsc usb2514
- wifi: rtl8188eus
- 其他: USB,HDMI,SPDIF,SD卡槽,百兆网口,串口,复位按钮等
其中,USB2.0 host由外置的usb hub引出,hub共引出三路usb接口,一路给usb无线网卡,一路给usb母口,还有一路给某个无线收发装置(下图中凸起来的那块东西,卖家截图),应该是配合遥控器用的,我不需要这个东西,所以把它拆下来了。
折腾第一步
折腾不明硬件的第一步是尽可能多的搜集资料。经过一番搜索,找到了方案类似的RK3066开发板,也就是Marsboard,其官网给出了还算详细的刷机资料,包括了Debian和Ubuntu两款刷机包,下面先按照其刷机流程尝试刷入。
Marsboard官方wiki: http://www.hotmcu.com/wiki/MarsBoard_RK3066
Marsboard(rk3066)所有资料: http://www.haoyuelectronics.com/service/RK3066/
在Images目录可以找到Debian和Ubuntu镜像,及其使用的Linux 3.0.36内核源码。
RK3066内置有固化的bootrom,cpu上电后会首先执行bootroom决定启动顺序或是否进入恢复模式。若按下复位键后上电,则进入usb恢复模式,可以通过usb向nand烧写固件。
RK3066可以烧写的固件分为两种,一种是单独烧写的三个原始镜像文件,分别对应nand上事先划定好的3个分区,也就是parameters,kernel(boot)和rootfs分区。
其中parameters为bootrom读取的一些参数,大小4m,其内容如下,包括板子的一些信息以及传递给内核的参数(相当于bootargs)
FIRMWARE_VER:4.2.2
MACHINE_MODEL:marsboard
MACHINE_ID:007
MANUFACTURER:marsboard
MAGIC: 0x5041524B
ATAG: 0x60000800
MACHINE: 3066
CHECK_MASK: 0x80
KERNEL_IMG: 0x60408000
#RECOVER_KEY: 1,1,0,20,0
CMDLINE:console=ttyFIQ0,115200 console=tty2 root=/dev/mtdblock2 init=/sbin/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00000000(parameter),0x00010000@0x00002000(boot),-@0x00012000(rootfs)
kernel或者叫boot分区就是linux内核所在的分区,大小是32m,这里不能用uImage镜像(因为压根没有u-boot),直接用zImage然后用瑞芯微提供的mkbootimg
工具生成boot镜像。利用mkbootimg
还可以加入initramfs,不过我后来移植的时候没有添加。
最后是rootfs分区,剩下的空间都是它的。
bootrom读取parameters中的内核参数并传递给内核,其中有一个rk29xxnand项,是专门给nand驱动提供分区信息的参数,这里的nand驱动是瑞芯微自己写的,linux主线内核里并不包含。
在Linux下使用rkflashtool
或者rkflashkit
可依次刷入这三个镜像。还有一种update.img
固件,包括了上述三个分区。marsboard提供的刷机镜像就是这种类型的。
要注意rkflashtool
和rkflashkit
不能刷入update.img镜像,只能用原厂的Linux_upgrade_tool
刷入。
可以用afptool
与img_maker
生成update.img,若要解包update.img,可以用Linux_upgrade_tool
中的rkImageMaker
rkflashtool
是命令行操作,rkflashkit
是基于python-gtk2的图形化工具,更加容易操作。
上述工具可以从github页里得到:
https://github.com/hanwckf/rk3066a-box-4.4/tree/master/rktools
rkflashtool可以从debian/ubuntu官方仓库下载,请 apt-get install rkflashtool
以下所有操作都在Linux环境下进行
为了刷入Marsboard的Debian/Ubuntu,我们需要瑞芯微原厂的Linux_upgrade_tool工具,从上面的github仓库中下载Linux_Upgrade_Tool_v1.2.tar.xz
并解压。
板子按住复位键,插上电源,连接MicroUSB到电脑,如果接了串口会看到如下输出
运行sudo ./upgrade_tool
接着是UF MarsBoard_RK3066_PX2_Ubuntu_Trusty_14.04_Server_HDMI_720P_Nand_V3.1.img
耐心等待刷入完成。
板子重启,成功启动。
内核日志如下:
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.0.36+ (root@HAOYU-Electronics-AVRman) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #68 SMP PREEMPT Mon Jan 18 01:44:46 PST 2016
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine: RK30board
[ 0.000000] memory reserve: Memory(base:0x9b000000 size:80M) reserved for
[ 0.000000] ddr size = 1024 M, set ion_reserve_size size to 125829120
[ 0.000000] memory reserve: Memory(base:0x93800000 size:120M) reserved for
[ 0.000000] memory reserve: Memory(base:0x92d00000 size:11M) reserved for
[ 0.000000] memory reserve: Total reserved 211M
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] CPU SRAM: copied sram code from c0c38000 to fef00010 - fef020e0
[ 0.000000] CPU SRAM: copied sram data from c0c3a0d0 to fef020e0 - fef02a40
[ 0.000000] sram_log: 9 x w@ F oVn f !0F | l F k rTU b[ cY sTg ! Z
[ 0.000000] can't get a available nume and deno
[ 0.000000] clk_frac_div can't get rate=49500000,uart0_frac_div
[ 0.000000] rk30_dvfs_init
[ 0.000000] L310 cache controller enabled
[ 0.000000] l2x0: 16 ways, CACHE_ID 0x4100c0c8, AUX_CTRL 0x76050001, Cache size: 524288 B
[ 0.000000] DDR DEBUG: version 1.00 20131106
[ 0.000000] DDR DEBUG: DDR3 Device
[ 0.000000] DDR DEBUG: Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Total Capability=1024MB
[ 0.000000] DDR DEBUG: init success!!! freq=396MHz
[ 0.000000] DDR DEBUG: DTONE=0x1, DTERR=0x0, DTIERR=0x0, DTPASS=0x4, DGSL=1 extra clock, DGPS=180
[ 0.000000] DDR DEBUG: DTONE=0x1, DTERR=0x0, DTIERR=0x0, DTPASS=0x4, DGSL=1 extra clock, DGPS=180
[ 0.000000] DDR DEBUG: DTONE=0x1, DTERR=0x0, DTIERR=0x0, DTPASS=0x4, DGSL=1 extra clock, DGPS=180
[ 0.000000] DDR DEBUG: DTONE=0x1, DTERR=0x0, DTIERR=0x0, DTPASS=0x4, DGSL=1 extra clock, DGPS=180
[ 0.000000] DDR DEBUG: ZERR=0, ZDONE=0, ZPD=0x0, ZPU=0x0, OPD=0x0, OPU=0x0
[ 0.000000] DDR DEBUG: DRV Pull-Up=0xb, DRV Pull-Dwn=0xb
[ 0.000000] DDR DEBUG: ODT Pull-Up=0x2, ODT Pull-Dwn=0x2
[ 0.000000] rk30_iomux_init
[ 0.000000] Boot mode: REBOOT (6) flag: NORMAL (0xc3524200)
[ 0.000000] On node 0 totalpages: 208128
[ 0.000000] free_area_init_node: node 0, pgdat c0c356a0, node_mem_map c16f8000
[ 0.000000] Normal zone: 976 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 123952 pages, LIFO batch:31
[ 0.000000] HighMem zone: 1072 pages used for memmap
[ 0.000000] HighMem zone: 82128 pages, LIFO batch:15
[ 0.000000] PERCPU: Embedded 7 pages/cpu @c1f01000 s7040 r8192 d13440 u32768
[ 0.000000] pcpu-alloc: s7040 r8192 d13440 u32768 alloc=8*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 206080
[ 0.000000] Kernel command line: console=ttyFIQ0,115200 console=tty2 root=/dev/mtdblock2 init=/sbin/init initrd=0x62000000,0x00500000 mtdparts=rk29xxnand:0x00002000@0x00000000(parameter),0x00010000@0x00002000(boot),-@0x00012000(rootfs) bootver=2014-06-27#2.15 firmware_ver=4.2.2
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] allocated 4194304 bytes of page_cgroup
[ 0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[ 0.000000] Memory: 813MB = 813MB total
[ 0.000000] Memory: 795180k/795180k available, 253396k reserved, 332800K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] DMA : 0xff600000 - 0xffe00000 ( 8 MB)
[ 0.000000] vmalloc : 0xdf000000 - 0xfe800000 ( 504 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xde800000 ( 488 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .init : 0xc0408000 - 0xc0437000 ( 188 kB)
[ 0.000000] .text : 0xc0437000 - 0xc0bc3244 (7729 kB)
[ 0.000000] .data : 0xc0bc4000 - 0xc0c37508 ( 462 kB)
[ 0.000000] .bss : 0xc0c3b024 - 0xc16f7928 (10995 kB)
[ 0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] NR_IRQS:448
[ 0.000000] rk30_gpio_init: 176 gpio irqs in 6 banks
[ 0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [tty2] enabled, bootconsole disabled
[ 0.010525] Calibrating delay loop (skipped) preset value.. 1631.46 BogoMIPS (lpj=8157341)
[ 0.010553] pid_max: default: 32768 minimum: 301
[ 0.010707] Security Framework initialized
[ 0.010727] SELinux: Initializing.
[ 0.010762] SELinux: Starting in permissive mode
[ 0.010833] Mount-cache hash table entries: 512
[ 0.011403] Initializing cgroup subsys debug
[ 0.011423] Initializing cgroup subsys cpuacct
[ 0.011474] Initializing cgroup subsys memory
[ 0.011510] Initializing cgroup subsys freezer
[ 0.011548] CPU: Testing write buffer coherency: ok
[ 0.102145] CPU1: Booted secondary processor
[ 0.102192] Brought up 2 CPUs
[ 0.102214] SMP: Total of 2 processors activated (3262.93 BogoMIPS).
[ 0.102560] devtmpfs: initialized
[ 0.109996] NET: Registered protocol family 16
[ 0.110094] last_log: 0xde100000 map to 0xdf004000 and copy to 0xc0c3f290 (version 2.1)
[ 0.121967] DVFS MSG: AVS Value(index=0): 171 6 170 6 172 6 171 6 171 6
[ 0.132624] lcdc0 is used as primary display device contoller!
[ 0.132664] lcdc1 is used as external display device controller!
[ 0.132894] rk29sdk_wifi_bt_gpio_control_init: init finished
[ 0.136476] console [ttyFIQ0] enabled
[ 0.136638] Registered FIQ tty driver de098c00
[ 0.137215] Loaded driver for PL330 DMAC-1 rk29-pl330
[ 0.137268] DBUFF-32x8bytes Num_Chans-6 Num_Peri-12 Num_Events-12
[ 0.137455] Loaded driver for PL330 DMAC-2 rk29-pl330
[ 0.137507] DBUFF-64x8bytes Num_Chans-7 Num_Peri-20 Num_Events-14
[ 0.662757] rk29xx_spim: driver initialized, fifo_len=32,bus_num=0
[ 0.669072] rk29xx_spim: driver initialized, fifo_len=32,bus_num=1
[ 0.684132] bio: create slab at 0
[ 0.688560] SCSI subsystem initialized
[ 0.688782] usbcore: registered new interface driver usbfs
[ 0.688909] usbcore: registered new interface driver hub
[ 0.703145] usbcore: registered new device driver usb
[ 0.703457] rk30_i2c rk30_i2c.0: i2c-0: RK30 I2C adapter
[ 0.703661] rk30_i2c rk30_i2c.1: i2c-1: RK30 I2C adapter
[ 0.703809] rk30_i2c rk30_i2c.2: i2c-2: RK30 I2C adapter
[ 0.703958] rk30_i2c rk30_i2c.3: i2c-3: RK30 I2C adapter
[ 0.704106] rk30_i2c rk30_i2c.4: i2c-4: RK30 I2C adapter
[ 0.734738] rk30-adc rk30-adc: rk30 adc: driver initialized
[ 0.735068] timed_gpio_probe
[ 0.735182] Advanced Linux Sound Architecture Driver Version 1.0.24.
[ 0.735627] Bluetooth: Core ver 2.16
[ 0.735708] NET: Registered protocol family 31
[ 0.735756] Bluetooth: HCI device and connection manager initialized
[ 0.735818] Bluetooth: HCI socket layer initialized
[ 0.735868] Bluetooth: L2CAP socket layer initialized
[ 0.735935] Bluetooth: SCO socket layer initialized
[ 0.736993] rk fb probe ok!
[ 0.764343] tps65910_pre_init,line=38
[ 0.766952] TPS65910 Set default voltage.
[ 0.769031] tps65910_pre_init,line=248
[ 0.792734] cfg80211: Calling CRDA to update world regulatory domain
[ 0.792854] tps65910_post_init,line=256
[ 0.792896] tps65910_post_init:g_pmic_type=2
[ 0.812431] tps65910_post_init set vio vcc_io=3300000mV end
[ 0.813487] tps65910_post_init set vpll vdd11=2500000mV end
[ 0.814529] tps65910_post_init set vdig2 vdd11=1100000mV end
[ 0.815567] tps65910_post_init set vaux33 vcc_tp=3300000mV end
[ 0.817972] tps65910_post_init set vdd1 vdd_cpu=1200000mV end
[ 0.820361] tps65910_post_init set vdd2 vcc_ddr=1200000mV end
[ 0.821400] tps65910_post_init set vdig1 vcc18_cif=1800000mV end
[ 0.822443] tps65910_post_init set vaux1 vcc25_hdmi=2500000mV end
[ 0.823483] tps65910_post_init set vaux2 vcca33=3300000mV end
[ 0.824520] tps65910_post_init set vdac vccio_wl=1800000mV end
[ 0.825559] tps65910_post_init set vmmc vcc28_cif=2800000mV end
[ 0.825718] tps65910_post_init,line=342 END
[ 0.825762] tps65910_i2c_probe:irq=356,irq_base=384,gpio_base=384
[ 0.835428] tps65910-rtc tps65910-rtc: rtc core: registered tps65910 as rtc0
[ 0.838166] tps65910_rtc_probe:ok
[ 0.838255] Switching to clocksource timer1
[ 0.841731] Switched to NOHz mode on CPU #0
[ 0.842179] Switched to NOHz mode on CPU #1
[ 0.846298] lcdc0:reg_phy_base = 0x1010c000,reg_vir_base:0xdf0bc000
[ 0.846401] fb0:win1
[ 0.846407] fb1:win0
[ 0.846411] fb2:win2
[ 0.846562] rk30 lcdc0 clk enable...
[ 0.876674] rk30 lcdc0 clk disable...
[ 0.896822] fb0:phy:92d00000>>vir:e0000000>>len:0xb00000
[ 0.897094] rk_fb_register>>>>>fb0
[ 0.937830] rk_fb_register>>>>>fb1
[ 0.938036] rk_fb_register>>>>>fb2
[ 0.938137] rk30 lcdc0 clk enable...
[ 0.938190] lcdc0: dclk:74250000>>fps:60 rk30_load_screen for lcdc0 ok!
[ 0.938258] lcdc0 wakeup from standby!
[ 0.938298] lcdc0 win1 open,atv layer:1
[ 0.953960] rk30 lcdc0 probe ok!
[ 0.954036] lcdc1:reg_phy_base = 0x1010e000,reg_vir_base:0xdf0c8000
[ 0.954124] fb0:win1
[ 0.954129] fb1:win0
[ 0.954133] fb2:win2
[ 0.954231] rk30 lcdc1 clk enable...
[ 0.984313] rk30 lcdc1 clk disable...
[ 0.984361] fb3:phy:92d00000>>vir:e0000000>>len:0xb00000
[ 0.984587] rk_fb_register>>>>>fb3
[ 0.996943] rk_fb_register>>>>>fb4
[ 0.997128] rk_fb_register>>>>>fb5
[ 0.997167] rk30 lcdc1 probe ok!
[ 0.997294] pwm_regulator_probe:n_voltages=19
[ 0.997470] pwm_regulator.0: driver initialized
[ 1.015951] NET: Registered protocol family 2
[ 1.016112] IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 1.016460] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[ 1.017464] TCP bind hash table entries: 65536 (order: 7, 786432 bytes)
[ 1.018916] TCP: Hash tables configured (established 65536 bind 65536)
[ 1.018979] TCP reno registered
[ 1.019020] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 1.019091] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 1.019414] NET: Registered protocol family 1
[ 1.067291] RPC: Registered named UNIX socket transport module.
[ 1.067333] RPC: Registered udp transport module.
[ 1.067389] RPC: Registered tcp transport module.
[ 1.067435] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.067638] RK29 Backlight Driver Initialized.
[ 1.067894] Unpacking initramfs...
[ 1.115543] Initramfs unpacking failed: junk in compressed archive
[ 1.116352] Freeing initrd memory: 5120K
[ 1.116554] rk30-tsadc rk30-tsadc: initialized
[ 1.116676] PMU: registered new PMU device of type 0
[ 1.117576] DVFS WARNING: vd_cpu : selector=86,but volt <=0
[ 1.121008] VPU_SERVICE: failed on clk_get aclk_ddr_vepu
[ 1.121074] VPU_SERVICE: failed on clk_get hclk_cpu_vcodec
[ 1.121133] vpu: power on
[ 1.121201] VPU_SERVICE: checking hw id 4831
[ 1.121688] vpu: power off...done
[ 1.121757] VPU_SERVICE: init success
[ 1.122072] audit: initializing netlink socket (disabled)
[ 1.122152] type=2000 audit(1.110:1): initialized
[ 1.122630] highmem bounce pool size: 64 pages
[ 1.122817] ashmem: initialized
[ 1.128650] Installing knfsd (copyright (C) 1996 [email protected]).
[ 1.129196] fuse init (API version 7.16)
[ 1.129558] msgmni has been set to 913
[ 1.129624] SELinux: Registering netfilter hooks
[ 1.131304] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[ 1.131384] io scheduler noop registered
[ 1.131426] io scheduler deadline registered
[ 1.131528] io scheduler cfq registered (default)
[ 1.137248] rga: Driver loaded succesfully
[ 1.137557] rk_serial.c v1.6 2013-12-23
[ 1.137689] rk_serial.0: ttyS0 at MMIO 0x10124000 (irq = 66) is a rk29_serial.0
[ 1.137913] rk_serial rk_serial.0: membase 0xdf0d8000
[ 1.138005] rk_serial.1: ttyS1 at MMIO 0x10126000 (irq = 67) is a rk29_serial.1
[ 1.138220] rk_serial rk_serial.1: membase 0xdf0dc000
[ 1.138315] rk_serial.3: ttyS3 at MMIO 0x20068000 (irq = 69) is a rk29_serial.3
[ 1.138576] rk_serial rk_serial.3: membase 0xdf0e0000
[ 1.138897] Rockchip ion module(version: 1.0) is successfully loaded
[ 1.141614] loop: module loaded
[ 1.141686] Android kernel panic handler initialized (bind=kpanic)
[ 1.142644] Read the Ethernet MAC address from IDB:00:00:00:00:00:00
[ 1.142741] random_ether_addr***********:1E:A1:92:6B:1D:8B
[ 1.143113] rk29 vmac rk29 vmac.0: ARC VMAC at 0x10204000 irq 51 1e:a1:92:6b:1d:8b
[ 1.143294] PPP generic driver version 2.4.2
[ 1.143499] PPP Deflate Compression module registered
[ 1.143553] PPP BSD Compression module registered
[ 1.173715] PPP MPPE Compression module registered
[ 1.173773] NET: Registered protocol family 24
[ 1.173821] tun: Universal TUN/TAP device driver, 1.6
[ 1.173871] tun: (C) 1999-2004 Max Krasnyansky
[ 1.174117] Rockchip WiFi SYS interface (V1.00) ...
[ 1.174214] Initializing USB Mass Storage driver...
[ 1.174323] usbcore: registered new interface driver usb-storage
[ 1.174381] USB Mass Storage support registered.
[ 1.397321] DWC_OTG: ^^^^^^^^^^^^^^^^^^Host Mode
[ 1.397369] usb20_otg usb20_otg: DWC OTG Controller
[ 1.397498] usb20_otg usb20_otg: new USB bus registered, assigned bus number 1
[ 1.397571] usb20_otg usb20_otg: irq 48, io mem 0x00000000
[ 1.397629] DWC_OTG: Init: Port Power? op_state=1
[ 1.397663] DWC_OTG: Init: Power Port (0)
[ 1.397722] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.397770] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.397821] usb usb1: Product: DWC OTG Controller
[ 1.397854] usb usb1: Manufacturer: Linux 3.0.36+ dwc_otg_hcd
[ 1.397894] usb usb1: SerialNumber: usb20_otg
[ 1.398206] hub 1-0:1.0: USB hub found
[ 1.398245] hub 1-0:1.0: 1 port detected
[ 1.400819] DWC_OTG: host20_driver_probe host2.0 reg addr: 0x101c0000 remap:0xdf180000
[ 1.611691] DWC_OTG: ^^^^^^^^^^^^^^^^^^Host Mode
[ 1.611737] usb20_host usb20_host: DWC OTG Controller
[ 1.611821] usb20_host usb20_host: new USB bus registered, assigned bus number 2
[ 1.611889] usb20_host usb20_host: irq 49, io mem 0x00000000
[ 1.611962] DWC_OTG: Init: Port Power? op_state=1
[ 1.611995] DWC_OTG: Init: Power Port (0)
[ 1.612052] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.612100] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.612150] usb usb2: Product: DWC OTG Controller
[ 1.612183] usb usb2: Manufacturer: Linux 3.0.36+ host20_hcd
[ 1.612224] usb usb2: SerialNumber: usb20_host
[ 1.612508] hub 2-0:1.0: USB hub found
[ 1.612544] hub 2-0:1.0: 1 port detected
[ 1.612908] g_mass_storage gadget: Mass Storage Function, version: 2009/09/11
[ 1.612962] g_mass_storage gadget: Number of LUNs=1
[ 1.612998] lun0: LUN: removable file: (no medium)
[ 1.613037] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 1.613088] g_mass_storage gadget: userspace failed to provide iSerialNumber
[ 1.613139] g_mass_storage gadget: g_mass_storage ready
[ 1.613327] input: rk29-keypad as /devices/platform/rk29-keypad/input/input0
[ 1.613679] ===================================================
[ 1.613722] Rockchip IR remote controller driver. Version 1.0.0
[ 1.613761] ===================================================
[ 1.613800] ++++++++remotectl_init
[ 1.613959] using rtc device, tps65910, for alarms
[ 1.614093] i2c /dev entries driver
[ 1.614588] lirc_dev: IR Remote Control driver registered, major 251
[ 1.614635] IR NEC protocol handler initialized
[ 1.614666] IR RC5(x) protocol handler initialized
[ 1.614700] IR RC6 protocol handler initialized
[ 1.614731] IR JVC protocol handler initialized
[ 1.614763] IR Sony protocol handler initialized
[ 1.614796] IR RC5 (streamzap) protocol handler initialized
[ 1.614835] IR LIRC bridge handler initialized
[ 1.614865] Linux video capture interface: v2.00
[ 1.615050] def_ref_volt: 2500mV, curr_ref_volt: 2500mV
[ 1.615629] device-mapper: uevent: version 1.0.3
[ 1.615851] device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) initialised: [email protected]
[ 1.616086] cpuidle: using governor ladder
[ 1.616118] cpuidle: using governor menu
[ 1.661506]
[ 1.661508] drivers/mmc/core/core.c...2019.. ===== mmc_rescan Begin....[mmc0]
[ 1.661568]
[ 1.661571] =================
[ 1.661574] sdmmc_rescan..2026.. ====find no SDMMC host. [mmc0]
[ 1.661660] .Line4018..The End of SDMMC-probe Ver.6.07 The last modify date is 2013-12-20. [sd_mmc]
[ 1.661822] Registered led device: button-backlight
[ 1.662965] usbcore: registered new interface driver usbhid
[ 1.663008] usbhid: USB HID core driver
[ 1.663276] logger: created 256K log 'log_main'
[ 1.663367] logger: created 256K log 'log_events'
[ 1.663455] logger: created 256K log 'log_radio'
[ 1.663541] logger: created 256K log 'log_system'
[ 1.663816] zram: Created 1 device(s) ...
[ 1.664370] Enter::audio_card_init----293
[ 1.664950] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 2...
[ 1.665413] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 1...
[ 1.665870] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 0...
[ 1.665933] RT5631 0-001a: Failed to set private addr: -11
[ 1.666370] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 2...
[ 1.666826] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 1...
[ 1.667282] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 0...
[ 1.783703] Enter::rk29_rt5631_init----221
[ 1.784714] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 2...
[ 1.785285] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 1...
[ 1.785850] i2c i2c-0: No ack, Maybe slave(addr: 0x1a) not exist or abnormal power-on, retry 0...
[ 1.789695] asoc: RT5631 HiFi <-> rk29_i2s.0 mapping ok
[ 1.789924] asoc: rt5631-voice <-> rk29_i2s.0 mapping ok
[ 1.790387] ALSA device list:
[ 1.790413] #0: RK29_RT5631
[ 1.790498] GACT probability NOT on
[ 1.790531] Mirror/redirect action on
[ 1.790558] u32 classifier
[ 1.790577] Actions configured
[ 1.790601] Netfilter messages via NETLINK v0.30.
[ 1.790664] nf_conntrack version 0.5.0 (12504 buckets, 50016 max)
[ 1.790940] ctnetlink v0.93: registering with nfnetlink.
[ 1.790999] NF_TPROXY: Transparent proxy support initialized, version 4.1.0
[ 1.791044] NF_TPROXY: Copyright (c) 2006-2007 BalaBit IT Ltd.
[ 1.791311] xt_time: kernel timezone is -0000
[ 1.791445] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 1.791587] arp_tables: (C) 2002 David S. Miller
[ 1.791649] TCP cubic registered
[ 1.791675] Initializing XFRM netlink socket
[ 1.792044] NET: Registered protocol family 10
[ 1.792601] Mobile IPv6
[ 1.792641] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 1.792757] IPv6 over IPv4 tunneling driver
[ 1.793293] NET: Registered protocol family 17
[ 1.793343] NET: Registered protocol family 15
[ 1.803983] Bluetooth: RFCOMM TTY layer initialized
[ 1.804027] Bluetooth: RFCOMM socket layer initialized
[ 1.804061] Bluetooth: RFCOMM ver 1.11
[ 1.804088] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1.804123] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 1.804265] NET: Registered protocol family 35
[ 1.804358] [BT_RFKILL]: Enter rfkill_rk_init
[ 1.804470] [BT_RFKILL]: Request irq for bt wakeup host
[ 1.804517] [BT_RFKILL]: ** disable irq
[ 1.828337] [BT_RFKILL]: bt shut off power
[ 1.858328] [BT_RFKILL]: bt_default device registered.
[ 1.858408] Registering the dns_resolver key type
[ 1.858709] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 1.858781] Registering SWP/SWPB emulation handler
[ 1.859090] ddrfreq: verion 3.2 20131126
[ 1.859123] ddrfreq: fix cpu pause bug
[ 2.054412] FTL version: 5.0.18 20141015
[ 2.208678] usb 2-1: New USB device found, idVendor=0424, idProduct=2514
[ 2.208804] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.209249] hub 2-1:1.0: USB hub found
[ 2.209423] hub 2-1:1.0: 4 ports detected
[ 2.332314] gBootMedia = 1 gSdmmcFwPartOffset =0!
[ 2.332402] rknand_buffer.c version: 4.40 20130830!
[ 2.332620] 3 cmdlinepart partitions found on MTD device rk29xxnand
[ 2.332732] Creating 3 MTD partitions on "rk29xxnand":
[ 2.332823] 0x000000000000-0x000000400000 : "parameter"
[ 2.333431] 0x000000400000-0x000002400000 : "boot"
[ 2.333950] 0x000002400000-0x0000e9400000 : "rootfs"
[ 2.377602] udevd[99]: starting version 175
[ 2.488558] usb 2-1.1: new high speed USB device number 3 using usb20_host
[ 2.591061] usb 2-1.1: New USB device found, idVendor=0bda, idProduct=8179
[ 2.591100] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.593101] usb 2-1.1: Product: 802.11n NIC
[ 2.595037] usb 2-1.1: Manufacturer: Realtek
[ 2.596955] usb 2-1.1: SerialNumber: 00E04C0001
[ 2.728599] usb 2-1.2: new high speed USB device number 4 using usb20_host
[ 2.829337] usb 2-1.2: New USB device found, idVendor=1f75, idProduct=0903
[ 2.829375] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.831412] usb 2-1.2: Product: USB Disk
[ 2.833377] usb 2-1.2: Manufacturer: IS903
[ 2.835342] usb 2-1.2: SerialNumber: 000000000000000004
[ 2.860618] scsi0 : usb-storage 2-1.2:1.0
[ 2.938694] usb 2-1.4: new full speed USB device number 5 using usb20_host
[ 2.961035] EXT4-fs (mtdblock2): mounted filesystem with ordered data mode. Opts: (null)
[ 3.018554] usb 2-1.4: device descriptor read/64, error -32
[ 3.209038] usb 2-1.4: device descriptor read/64, error -32
[ 3.398462] usb 2-1.4: new full speed USB device number 6 using usb20_host
[ 3.478564] usb 2-1.4: device descriptor read/64, error -32
[ 3.627362] init: plymouth-upstart-bridge main process (216) terminated with status 1
[ 3.635402] init: plymouth-upstart-bridge main process ended, respawning
[ 3.668435] usb 2-1.4: device descriptor read/64, error -32
[ 3.688940] init: plymouth-upstart-bridge main process (226) terminated with status 1
[ 3.696948] init: plymouth-upstart-bridge main process ended, respawning
[ 3.708179] init: ureadahead main process (219) terminated with status 5
[ 3.757002] init: plymouth-upstart-bridge main process (228) terminated with status 1
[ 3.757098] init: plymouth-upstart-bridge main process ended, respawning
[ 3.858796] usb 2-1.4: new full speed USB device number 7 using usb20_host
[ 3.859345] scsi 0:0:0:0: Direct-Access Innostor IS903 1.00 PQ: 0 ANSI: 6
[ 3.862577] sd 0:0:0:0: [sda] 62411243 512-byte logical blocks: (31.9 GB/29.7 GiB)
[ 3.865326] sd 0:0:0:0: [sda] Write Protect is off
[ 3.867571] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 3.868376] sd 0:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
[ 3.874588] sda: sda1
[ 3.878806] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 3.982481] init: mounted-proc main process (243) terminated with status 1
[ 4.288360] usb 2-1.4: device not accepting address 7, error -32
[ 4.388832] usb 2-1.4: new full speed USB device number 8 using usb20_host
[ 4.801149] systemd-udevd[328]: starting version 204
[ 4.808394] usb 2-1.4: device not accepting address 8, error -32
[ 4.808929] hub 2-1:1.0: unable to enumerate USB device on port 4
[ 5.228454] Chip Version Info: CHIP_8188E_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0)
[ 5.301147] usbcore: registered new interface driver r8188eu
[ 5.788372] EXT4-fs (mtdblock2): re-mounted. Opts: (null)
[ 6.858254] init: gator-daemon main process (528) terminated with status 1
[ 7.410930] init: failsafe main process (504) killed by TERM signal
[ 12.283607] init: plymouth-upstart-bridge main process ended, respawning
[ 12.434966] init: tty1 main process (879) killed by TERM signal
查看系统基本信息:
root@marsboard:~# uname -a
Linux marsboard 3.0.36+ #68 SMP PREEMPT Mon Jan 18 01:44:46 PST 2016 armv7l armv7l armv7l GNU/Linux
root@marsboard:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mtdblock2 3.6G 567M 2.9G 17% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 389M 48K 389M 1% /dev
none 79M 224K 78M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 391M 0 391M 0% /run/shm
none 100M 0 100M 0% /run/user
root@marsboard:~# free -m
total used free shared buffers cached
Mem: 1024 363 660 5 4 50
-/+ buffers/cache: 309 714
Swap: 0 0 0
root@marsboard:~# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 0 (v7l)
processor : 0
BogoMIPS : 503.83
processor : 1
BogoMIPS : 503.83
Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc09
CPU revision : 0
Hardware : RK30board
Revision : 0000
Serial : 0000000000000000
root@marsboard:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00400000 00004000 "parameter"
mtd1: 02000000 00004000 "boot"
mtd2: e7000000 00004000 "rootfs"
折腾第二步
第一步中将这块机顶盒主板成功刷入了marsboard的Ubuntu固件,但是由于rk3066不再被瑞芯微官方支持,内核版本停留在3.0.36,尝试更新到Ubuntu最新的版本会提示内核版本过低,因此第二步的任务是刷入较新的内核。
第一步中所有的工作都是在大一刚买来这块板子时研究的,当时没有内核编译的经验,发现没有新内核可用以后,板子一直吃灰闲置。直到后来学习了相关知识后才进行第二次折腾。
Linux主线内核已经包含了对Marsboard的dts支持,但是没有RK3066的nand驱动,除非移植3.0.36内核源码中的nand驱动,否则只能将rootfs挂载到sd卡或者U盘中。为了快速移植,这里不对nand驱动进行折腾了,就把rootfs放在sd卡中。
现在要做的是编译内核+生成rootfs,其中生成rootfs是比较简单的操作,可以用debootstrap
轻松实现。
编译好的内核最终要刷入nand的boot分区,其打包流程为:
Linux 源码 ---gcc---> zImage(dtb) ---mkbootimg---> boot.img
首先,获取arm的工具链,这里选用linaro发行的gcc 5.4.1
wget http://releases.linaro.org/components/toolchain/binaries/5.4-2017.05/arm-linux-gnueabihf/gcc-linaro-5.4.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz
解压到任意目录,编辑/etc/bash.bashrc
,在末尾加入
export PATH="$PATH:<工具链下bin目录路径>"
接着下载4.4的内核源码
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.127.tar.xz
得益于主线内核的支持,我们并不需要做太多的修改,只需修改rk3066a-marsboard.dts
的mmc结点:
&mmc0 {
bus-width = <4>;
disable-wp;
num-slots = <1>;
pinctrl-names = "default";
pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
vmmc-supply = <&vcc_sd0>;
cap-mmc-highspeed;
cap-sd-highspeed;
status = "okay";
};
进入源码目录,导入环境变量
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
由于没有marsboard的defconfig,需要在multi_v7_defconfig的基础上修改 (github页提供了可用的defconfig)
执行menuconfig
make multi_v7_defconfig
make menuconfig
在System Type
中勾选Rockchip RK2928 and RK3xxx SOCs
移植早期,让人头疼的问题是串口不打印东西出来,为此要在Kernel hacking
菜单中打开Kernel low-level debugging functions
和Early printk
并指定正确的串口。这块主板引出来的串口是UART2,所以按照下图配置:
在Boot options -> Default kernel command string
中设置默认启动参数,启用earlyprintk并从SD卡加载rootfs:
earlyprintk console=ttyS2,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rw rootwait
打开Use appended device tree blob to zImage
和Support for the traditional ATAGS boot data passing
,在Kernel command line type
中选择Always use the default kernel command string
,让内核从紧接着的地址中寻找dtb文件且强制使用默认启动参数:
配置好以后,开始编译内核
make zImage -j4
编译dtb
make rk3066a-marsboard.dtb
将dtb追加到zImage后面
cat arch/arm/boot/zImage arch/arm/boot/dts/rk3066a-marsboard.dtb > arch/arm/boot/zImage-dtb
使用mkbootimg生成boot.img
mkbootimg --kernel zImage-dtb -o boot.img
现在用rkflashkit烧写boot.img
安装rkflashkit
apt-get install python-gtk2
wget https://raw.githubusercontent.com/hanwckf/rk3066a-box-4.4/master/rktools/rkflashkit_0.1.5_all.deb
sudo dpkg -i rkflashkit_0.1.5_all.deb
启动rkflashkit,按住板子复位键后通电,插入USB线。在rkflashkit中选择boot分区和boot.img,点击Flash image开始烧写
sudo rkflashkit
以上就是烧写内核的具体过程。经过反复试验,最终配置好了基本可用的内核,所用的config文件已经上传到github,也同时上传了已经追加了dtb的zImage
可以直接使用此zImage,只需要运行build.sh
即可生成boot.img。
接下来是制作rootfs,由于内核中没有nand驱动,因此将rootfs挂载到SD卡上。准备一张空白SD卡,格式化成ext4文件系统,用一键脚本生成debian 8的rootfs (sysv-init,不使用systemd)
apt-get install debootstrap qemu-user-static
git clone --depth=1 https://github.com/hanwckf/rk3066a-box-4.4.git
cd rk3066a-box-4.4/rootfs
sudo ./build-debian-armhf.sh
生成完成后,将debian-rootfs
内的所有东西复制到SD卡上,使用rsync的命令行如下,也可以用更简单的sudo cp -a
sudo rsync -axHAX --progress debian-rootfs/
板子插上SD卡,接通电源,启动日志如下:
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.127 (hanwckf@hanwckf-Aspire-VN7-592G) (gcc version 5.4.1 20170404 (Linaro GCC 5.4-2017.05) ) #1 SMP Tue Apr 10 23:42:07 CST 2018
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: MarsBoard RK3066
[ 0.000000] cma: Reserved 16 MiB at 0x9f000000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 262144
[ 0.000000] free_area_init_node: node 0, pgdat c0e8f8c0, node_mem_map ef7fa000
[ 0.000000] Normal zone: 1536 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 196608 pages, LIFO batch:31
[ 0.000000] HighMem zone: 65536 pages, LIFO batch:15
[ 0.000000] PERCPU: Embedded 13 pages/cpu @ef7c7000 s24256 r8192 d20800 u53248
[ 0.000000] pcpu-alloc: s24256 r8192 d20800 u53248 alloc=13*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260608
[ 0.000000] Kernel command line: console=ttyS2,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rw rootwait
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1008488K/1048576K available (8897K kernel code, 609K rwdata, 2372K rodata, 1024K init, 526K bss, 23704K reserved, 16384K cma-reserved, 245760K highmem)
[ 0.000000] Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0c0172c (12262 kB)
.init : 0xc0d00000 - 0xc0e00000 (1024 kB)
.data : 0xc0e00000 - 0xc0e985e0 ( 610 kB)
.bss : 0xc0e9b000 - 0xc0f1ea54 ( 527 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] L2C-310: enabling full line of zeros but not enabled in Cortex-A9
[ 0.000000] L2C-310 ID prefetch enabled, offset 15 lines
[ 0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[ 0.000000] L2C-310 cache controller enabled, 16 ways, 512 kB
[ 0.000000] L2C-310: CACHE_ID 0x4100c0c8, AUX_CTRL 0x76050001
[ 0.000015] sched_clock: 64 bits at 150MHz, resolution 6ns, wraps every 2199023255551ns
[ 0.000048] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x2298375bd0, max_idle_ns: 440795208267 ns
[ 0.000846] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.001503] Console: colour dummy device 80x30
[ 0.001544] Calibrating delay loop... 1196.85 BogoMIPS (lpj=5984256)
[ 0.090275] pid_max: default: 32768 minimum: 301
[ 0.090413] Security Framework initialized
[ 0.090429] Yama: becoming mindful.
[ 0.090517] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.090537] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.091594] Initializing cgroup subsys devices
[ 0.091625] Initializing cgroup subsys freezer
[ 0.091667] CPU: Testing write buffer coherency: ok
[ 0.091720] ftrace: allocating 30465 entries in 90 pages
[ 0.167835] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.168136] rockchip_smp_prepare_cpus: ncores 2
[ 0.168293] Setting up static identity map for 0x60100000 - 0x60100058
[ 0.210251] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.210390] Brought up 2 CPUs
[ 0.210418] SMP: Total of 2 processors activated (2393.70 BogoMIPS).
[ 0.210429] CPU: All CPU(s) started in SVC mode.
[ 0.211670] devtmpfs: initialized
[ 0.220272] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 0.220809] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.220852] futex hash table entries: 512 (order: 3, 32768 bytes)
[ 0.222526] pinctrl core: initialized pinctrl subsystem
[ 0.224035] NET: Registered protocol family 16
[ 0.226762] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.251060] cpuidle: using governor ladder
[ 0.271055] cpuidle: using governor menu
[ 0.271455] Failed to find PMU node
[ 0.278867] gpiochip_add: registered GPIOs 0 to 31 on device: gpio0
[ 0.279027] gpiochip_add: registered GPIOs 32 to 63 on device: gpio1
[ 0.279194] gpiochip_add: registered GPIOs 64 to 95 on device: gpio2
[ 0.279349] gpiochip_add: registered GPIOs 96 to 127 on device: gpio3
[ 0.279512] gpiochip_add: registered GPIOs 128 to 159 on device: gpio4
[ 0.279677] gpiochip_add: registered GPIOs 160 to 175 on device: gpio6
[ 0.284610] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[ 0.284628] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.322830] of_get_named_gpiod_flags: parsed 'gpio' property of node '/sdmmc-regulator[0]' - status (0)
[ 0.323274] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/vsys-regulator[0]'
[ 0.324610] SCSI subsystem initialized
[ 0.324995] usbcore: registered new interface driver usbfs
[ 0.325087] usbcore: registered new interface driver hub
[ 0.325241] usbcore: registered new device driver usb
[ 0.325600] media: Linux media interface: v0.10
[ 0.325693] Linux video capture interface: v2.00
[ 0.325761] pps_core: LinuxPPS API ver. 1 registered
[ 0.325774] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti
[ 0.325816] PTP clock support registered
[ 0.326580] Advanced Linux Sound Architecture Driver Initialized.
[ 0.328567] clocksource: Switched to clocksource arm_global_timer
[ 0.405267] NET: Registered protocol family 2
[ 0.406208] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.406339] TCP bind hash table entries: 8192 (order: 5, 163840 bytes)
[ 0.406730] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.406863] UDP hash table entries: 512 (order: 2, 24576 bytes)
[ 0.406935] UDP-Lite hash table entries: 512 (order: 2, 24576 bytes)
[ 0.407318] NET: Registered protocol family 1
[ 0.407952] RPC: Registered named UNIX socket transport module.
[ 0.407974] RPC: Registered udp transport module.
[ 0.407985] RPC: Registered tcp transport module.
[ 0.407996] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.411047] Initialise system trusted keyring
[ 0.425081] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.426746] NFS: Registering the id_resolver key type
[ 0.426827] Key type id_resolver registered
[ 0.426840] Key type id_legacy registered
[ 0.426877] Installing knfsd (copyright (C) 1996 [email protected]).
[ 0.428141] ntfs: driver 2.1.32 [Flags: R/O].
[ 0.428738] fuse init (API version 7.23)
[ 0.435753] NET: Registered protocol family 38
[ 0.435807] Key type asymmetric registered
[ 0.435831] Asymmetric key parser 'x509' registered
[ 0.435963] bounce: pool size: 64 pages
[ 0.436296] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[ 0.436330] io scheduler noop registered
[ 0.436353] io scheduler deadline registered
[ 0.436416] io scheduler cfq registered (default)
[ 0.439848] dma-pl330 20018000.dma-controller: Loaded driver for PL330 DMAC-241330
[ 0.439874] dma-pl330 20018000.dma-controller: DBUFF-32x8bytes Num_Chans-6 Num_Peri-12 Num_Events-12
[ 0.442962] dma-pl330 20078000.dma-controller: Loaded driver for PL330 DMAC-241330
[ 0.442986] dma-pl330 20078000.dma-controller: DBUFF-64x8bytes Num_Chans-7 Num_Peri-20 Num_Events-14
[ 0.443823] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[ 0.446588] 10124000.serial: ttyS0 at MMIO 0x10124000 (irq = 23, base_baud = 1500000) is a 16550A
[ 0.467709] 10126000.serial: ttyS1 at MMIO 0x10126000 (irq = 24, base_baud = 1500000) is a 16550A
[ 0.468871] console [ttyS2] disabled
[ 0.489158] 20064000.serial: ttyS2 at MMIO 0x20064000 (irq = 31, base_baud = 1500000) is a 16550A
[ 1.193996] console [ttyS2] enabled
[ 1.218827] 20068000.serial: ttyS3 at MMIO 0x20068000 (irq = 32, base_baud = 1500000) is a 16550A
[ 1.230488] brd: module loaded
[ 1.243468] loop: module loaded
[ 1.247736] zram: Added device: zram0
[ 1.251558] lkdtm: No crash points registered, enable through debugfs
[ 1.258737] tun: Universal TUN/TAP device driver, 1.6
[ 1.263795] tun: (C) 1999-2004 Max Krasnyansky
[ 1.271099] PPP generic driver version 2.4.2
[ 1.275989] dwc2 10180000.usb: Configuration mismatch. Forcing host mode
[ 1.282811] 10180000.usb supply vusb_d not found, using dummy regulator
[ 1.289538] 10180000.usb supply vusb_a not found, using dummy regulator
[ 2.156934] dwc2 10180000.usb: DWC OTG Controller
[ 2.161745] dwc2 10180000.usb: new USB bus registered, assigned bus number 1
[ 2.168864] dwc2 10180000.usb: irq 25, io mem 0x00000000
[ 2.174499] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 2.181326] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.188568] usb usb1: Product: DWC OTG Controller
[ 2.193276] usb usb1: Manufacturer: Linux 4.4.127 dwc2_hsotg
[ 2.198956] usb usb1: SerialNumber: 10180000.usb
[ 2.204601] hub 1-0:1.0: USB hub found
[ 2.208409] hub 1-0:1.0: 1 port detected
[ 2.213199] 101c0000.usb supply vusb_d not found, using dummy regulator
[ 2.219969] 101c0000.usb supply vusb_a not found, using dummy regulator
[ 3.078957] dwc2 101c0000.usb: DWC OTG Controller
[ 3.083711] dwc2 101c0000.usb: new USB bus registered, assigned bus number 2
[ 3.090842] dwc2 101c0000.usb: irq 26, io mem 0x00000000
[ 3.096475] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 3.103298] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 3.110540] usb usb2: Product: DWC OTG Controller
[ 3.115248] usb usb2: Manufacturer: Linux 4.4.127 dwc2_hsotg
[ 3.120927] usb usb2: SerialNumber: 101c0000.usb
[ 3.126551] hub 2-0:1.0: USB hub found
[ 3.130390] hub 2-0:1.0: 1 port detected
[ 3.135118] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 3.141706] ehci-platform: EHCI generic platform driver
[ 3.147129] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 3.153365] ohci-platform: OHCI generic platform driver
[ 3.158841] usbcore: registered new interface driver cdc_wdm
[ 3.164581] usbcore: registered new interface driver uas
[ 3.170078] usbcore: registered new interface driver usb-storage
[ 3.176187] usbcore: registered new interface driver ums-realtek
[ 3.182693] dummy_hcd dummy_hcd.0: USB Host+Gadget Emulator, driver 02 May 2005
[ 3.190047] dummy_hcd dummy_hcd.0: Dummy host controller
[ 3.195367] dummy_hcd dummy_hcd.0: new USB bus registered, assigned bus number 3
[ 3.203043] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002
[ 3.209877] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 3.217099] usb usb3: Product: Dummy host controller
[ 3.222088] usb usb3: Manufacturer: Linux 4.4.127 dummy_hcd
[ 3.227662] usb usb3: SerialNumber: dummy_hcd.0
[ 3.233287] hub 3-0:1.0: USB hub found
[ 3.237106] hub 3-0:1.0: 1 port detected
[ 3.244052] mousedev: PS/2 mouse device common for all mice
[ 3.250797] i2c /dev entries driver
[ 3.256930] tps65910-gpio tps65910-gpio: ti,en-gpio-sleep not specified
[ 3.256951] gpiochip_find_base: found new base at 282
[ 3.257125] gpiochip_add: registered GPIOs 282 to 287 on device: tps65910
[ 3.288861] tps65910-rtc tps65910-rtc: rtc core: registered tps65910-rtc as rtc0
[ 3.296508] rk3x-i2c 2002f000.i2c: Initialized RK3xxx I2C bus at f08aa000
[ 3.303769] usbcore: registered new interface driver uvcvideo
[ 3.309555] USB Video Class driver (1.1.1)
[ 3.315238] sdhci: Secure Digital Host Controller Interface driver
[ 3.320454] sdhci: Copyright(c) Pierre Ossman
[ 3.324114] Synopsys Designware Multimedia Card Interface Driver
[ 3.329726] dwmmc_rockchip 10214000.dwmmc: Using PIO mode.
[ 3.334336] dwmmc_rockchip 10214000.dwmmc: Version ID is 240a
[ 3.339291] dwmmc_rockchip 10214000.dwmmc: DW MMC controller at irq 28,32 bit host data width,256 deep fifo
[ 3.347555] vcc_io: supplied by vsys
[ 3.350645] sdmmc-supply: supplied by vcc_io
[ 3.354319] dwmmc_rockchip 10214000.dwmmc: No vqmmc regulator found
[ 3.359707] dwmmc_rockchip 10214000.dwmmc: GPIO lookup for consumer cd
[ 3.359717] dwmmc_rockchip 10214000.dwmmc: using device tree for GPIO lookup
[ 3.359726] of_get_named_gpiod_flags: can't parse 'cd-gpios' property of node '/dwmmc@10214000[0]'
[ 3.359734] of_get_named_gpiod_flags: can't parse 'cd-gpio' property of node '/dwmmc@10214000[0]'
[ 3.359742] dwmmc_rockchip 10214000.dwmmc: using lookup tables for GPIO lookup
[ 3.359750] dwmmc_rockchip 10214000.dwmmc: lookup for GPIO cd failed
[ 3.359758] dwmmc_rockchip 10214000.dwmmc: GPIO lookup for consumer wp
[ 3.359765] dwmmc_rockchip 10214000.dwmmc: using device tree for GPIO lookup
[ 3.359772] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/dwmmc@10214000[0]'
[ 3.359779] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/dwmmc@10214000[0]'
[ 3.359785] dwmmc_rockchip 10214000.dwmmc: using lookup tables for GPIO lookup
[ 3.359792] dwmmc_rockchip 10214000.dwmmc: lookup for GPIO wp failed
[ 3.488614] mmc_host mmc0: Bus speed (slot 0) = 5500000Hz (slot req 400000Hz, actual 392857HZ div = 7)
[ 3.508576] usb 2-1: new high-speed USB device number 2 using dwc2
[ 3.508647] dwmmc_rockchip 10214000.dwmmc: 1 slots initialized
[ 3.508741] sdhci-pltfm: SDHCI platform and OF driver helper
[ 3.508890] hidraw: raw HID events driver (C) Jiri Kosina
[ 3.509601] usbcore: registered new interface driver usbhid
[ 3.509604] usbhid: USB HID core driver
[ 3.510446] usbcore: registered new interface driver snd-usb-audio
[ 3.510557] u32 classifier
[ 3.510566] Netfilter messages via NETLINK v0.30.
[ 3.510631] nf_conntrack version 0.5.0 (16013 buckets, 64052 max)
[ 3.511036] ctnetlink v0.93: registering with nfnetlink.
[ 3.511181] ip_set: protocol 6
[ 3.511586] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 3.511798] arp_tables: (C) 2002 David S. Miller
[ 3.511840] Initializing XFRM netlink socket
[ 3.512512] NET: Registered protocol family 10
[ 3.513423] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 3.513649] sit: IPv6 over IPv4 tunneling driver
[ 3.514189] NET: Registered protocol family 17
[ 3.514214] NET: Registered protocol family 15
[ 3.514255] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 3.514293] Bridge firewalling registered
[ 3.514302] Ebtables v2.0 registered
[ 3.514468] 8021q: 802.1Q VLAN Support v1.8
[ 3.514513] Key type dns_resolver registered
[ 3.514642] ThumbEE CPU extension supported.
[ 3.514656] Registering SWP/SWPB emulation handler
[ 3.515261] Loading compiled-in X.509 certificates
[ 3.515980] vcc_rmii: supplied by vsys
[ 3.516106] rockchip_emac 10204000.ethernet: ARC EMAC detected with id: 0x7fd02
[ 3.516112] rockchip_emac 10204000.ethernet: IRQ is 27
[ 3.516164] rockchip_emac 10204000.ethernet: MAC address is now 76:4c:46:fe:1c:30
[ 3.516336] libphy: Synopsys MII Bus: probed
[ 3.708569] rockchip_emac 10204000.ethernet: connected to Generic PHY phy with id 0xffffc0f1
[ 3.718501] tps65910-rtc tps65910-rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
[ 3.732863] ALSA device list:
[ 3.735368] No soundcards found.
[ 3.738735] Waiting for root device /dev/mmcblk0p1...
[ 3.775986] mmc_host mmc0: Bus speed (slot 0) = 5500000Hz (slot req 50000000Hz, actual 5500000HZ div = 0)
[ 3.784119] mmc0: new high speed SDHC card at address 59b4
[ 3.789205] mmcblk0: mmc0:59b4 SD16G 14.7 GiB
[ 3.795356] mmcblk0: p1
[ 3.848838] usb 2-1: New USB device found, idVendor=0424, idProduct=2514
[ 3.854508] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.861142] hub 2-1:1.0: USB hub found
[ 3.864396] hub 2-1:1.0: 4 ports detected
[ 3.980876] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 3.987726] VFS: Mounted root (ext4 filesystem) on device 179:1.
[ 3.999938] devtmpfs: mounted
[ 4.003387] Freeing unused kernel memory: 1024K
[ 4.138610] usb 2-1.1: new high-speed USB device number 3 using dwc2
[ 4.249343] usb 2-1.1: New USB device found, idVendor=0bda, idProduct=8179
[ 4.255154] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4.261345] usb 2-1.1: Product: 802.11n NIC
[ 4.264886] usb 2-1.1: Manufacturer: Realtek
[ 4.268506] usb 2-1.1: SerialNumber: 00E04C0001
[ 4.348599] usb 2-1.2: new high-speed USB device number 4 using dwc2
[ 4.449554] usb 2-1.2: New USB device found, idVendor=1f75, idProduct=0903
[ 4.455368] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4.461554] usb 2-1.2: Product: USB Disk
[ 4.464878] usb 2-1.2: Manufacturer: IS903
[ 4.468348] usb 2-1.2: SerialNumber: 000000000000000004
[ 4.473571] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[ 4.479319] scsi host0: usb-storage 2-1.2:1.0
[ 4.558611] usb 2-1.4: new full-speed USB device number 5 using dwc2
[ 4.583819] random: nonblocking pool is initialized
[ 4.638589] usb 2-1.4: device descriptor read/64, error -32
[ 4.828607] usb 2-1.4: device descriptor read/64, error -32
[ 5.018608] usb 2-1.4: new full-speed USB device number 6 using dwc2
[ 5.098608] usb 2-1.4: device descriptor read/64, error -32
[ 5.288598] usb 2-1.4: device descriptor read/64, error -32
[ 5.398804] usb 2-1-port4: attempt power cycle
[ 5.479458] scsi 0:0:0:0: Direct-Access Innostor IS903 1.00 PQ: 0 ANSI: 6
[ 5.487551] sd 0:0:0:0: [sda] 62411243 512-byte logical blocks: (32.0 GB/29.8 GiB)
[ 5.494450] sd 0:0:0:0: [sda] Write Protect is off
[ 5.498514] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 5.498956] sd 0:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
[ 5.511892] sda: sda1
[ 5.516184] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 6.008675] usb 2-1.4: new full-speed USB device number 7 using dwc2
[ 6.066564] systemd-udevd[182]: starting version 215
[ 6.428638] usb 2-1.4: device not accepting address 7, error -32
[ 6.508669] usb 2-1.4: new full-speed USB device number 8 using dwc2
[ 6.928608] usb 2-1.4: device not accepting address 8, error -32
[ 6.934059] usb 2-1-port4: unable to enumerate USB device
[ 7.590811] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[ 10.908954] rockchip_emac 10204000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
系统信息:
root@RK3066:~# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 0 (v7l)
BogoMIPS : 2010.71
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc09
CPU revision : 0
processor : 1
model name : ARMv7 Processor rev 0 (v7l)
BogoMIPS : 2010.71
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc09
CPU revision : 0
Hardware : Rockchip (Device Tree)
Revision : 0000
Serial : 0000000000000000
root@RK3066:~# free
total used free shared buffers cached
Mem: 1.0G 40M 961M 280K 3.5M 14M
-/+ buffers/cache: 21M 979M
Swap: 0B 0B 0B
root@RK3066:~# df
Filesystem Type Size Used Avail Use% Mounted on
/dev/root ext4 15G 518M 14G 4% /
devtmpfs devtmpfs 493M 0 493M 0% /dev
tmpfs tmpfs 101M 148K 101M 1% /run
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 201M 0 201M 0% /run/shm
root@RK3066:~# lsusb -t
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=dummy_hcd/1p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 480M
|__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
root@RK3066:~# uname -a
Linux RK3066 4.4.127 #1 SMP Tue Apr 10 23:42:07 CST 2018 armv7l GNU/Linux
折腾第三步
第三步主要是解决bug。成功启动系统后,发现无法识别USB设备,但启动日志中有USB设备注册的相关字样,经过一番排查,从硬件上找到了问题。查阅hub芯片的pdf,其某个引脚需要拉高才能正常工作,由于不知道这个引脚连到了哪个GPIO上,因此直接用头发将此管脚接3.3V。
另外还有几个未能解决的问题:
- reboot有时候会失败,在结束所有进程后卡住不动。
- reboot后启动时在加载mmc驱动前卡住不动,如果是直接上电启动则不会出现这种情况。
- reboot后在bootrom加载内核后停住不动,看样子是内核没起来。
- dhclient有时不能获取ip地址。
问题1.2.3仅在reboot后才有可能发生,发生概率也不大,目前还没有解决思路。
2018-4-15 发现板子的时间总是不准确,经过仔细对比,每分钟会慢上十多秒,猜测与时钟配置有关。
观察dmesg输出,有这么一行:
sched_clock: 64 bits at 150MHz, resolution 6ns, wraps every 2199023255551ns
对比Marsboard原厂固件,其对应日志为:
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
经过排查,确认是global_timer的问题,只需在dts中禁用global_timer即可。
修改rk3066a-marsboard.dts
,末尾加入:
&global_timer {
status = "disable";
};
重新生成dtb,追加到zImage后,烧写内核,问题解决。
参考资料
https://blog.csdn.net/faithsws/article/details/17245699
https://gist.github.com/sarg/5028505
http://www.hotmcu.com/wiki/MarsBoard_RK3066
http://www.marsboard.com/marsboard_rk3066_download.html
http://www.haoyuelectronics.com/service/RK3066/
https://github.com/hanwckf/rk3066a-box-4.4