CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 12386|回复: 8

Cubieboard2 移植到最新内核 Linux 3.11+ 与ARM VIRTUALIZATION

[复制链接]
发表于 2013-9-9 10:52:36 | 显示全部楼层 |阅读模式
Cubieboard2 移植到最新内核 Linux 3.11+。1号拿到 Cubieboard2 板子, 5号移植成功DTS,7号移植成功EMAC,昨天基本搞到SMP,system_counter还有问题,争取这两天搞定后会提交patch,搞定后主要想在ARM A7上实现ARM VIRTUALIZATION,以前写了片VIRTUALIZATION文章:http://hi.baidu.com/cinifr/item/02dd23d5526d4c3ce3108f86 有同好的可以联系QQ:113074954.

回复

使用道具 举报

发表于 2013-9-9 12:42:19 | 显示全部楼层
不明觉厉
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-9-9 23:59:16 | 显示全部楼层
BOOT 3.11+ on Cubieboard2:
EMAC + SMP + arch_timer OK 不过使用arch_timer BogoMIPS不知道为什么不准确,貌似OMAP5使用ARCH_timer也有这个问题,明天希望能修复这个问题。当前Cubieboard2 kernel 运行在secure PL1的最高权限,呵呵可以尝试我的tiny hypervisor。
这个礼拜争取提交一个完整的patch到社区。


Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.11.0-next-20130903-dirty (root@cini-VirtualBox) (gcc version 4.7.3 (Sourcery CodeBench Lite 2013.05-24) ) #136 SMP Mon Sep 9 23:58:09 CST 2013
[    0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Allwinner A1X (Device Tree), model: Cubietech Cubieboard2
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] [sunxi7i_smp_init_cpus] ncores=2
[    0.000000] PERCPU: Embedded 7 pages/cpu @c0ef6000 s6464 r8192 d14016 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260624
[    0.000000] Kernel command line: console=ttyS0,115200
[    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: 1032396K/1048576K available (3439K kernel code, 179K rwdata, 984K rodata, 1966K init, 482K bss, 16180K reserved, 270336K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0459f4c   (4424 kB)
[    0.000000]       .init : 0xc045a000 - 0xc0645940   (1967 kB)
[    0.000000]       .data : 0xc0646000 - 0xc0672ec0   ( 180 kB)
[    0.000000]        .bss : 0xc0672ec8 - 0xc06eba54   ( 483 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[    0.000000] cini: arch_timer_init 000
[    0.000000] cini: arch_timer_detect_rate 000 arch_timer_rate=0
[    0.000000] cini: arch_timer_common_init
[    0.000000] Architected cp15 timer(s) running at 24.00MHz (virt).
[    0.000000] cini: arch_timer_common_init 111
[    0.000000] [read_scr] 0x0
[    0.000000] cini: arch_counter_register 000 type=0x1
[    0.000000] cini: arch_counter_register 111 start_count=0x1755ce2a arch_timer_rate=0x16e3600
[    0.000000] cini: arch_counter_register 111 vcount=0x5000017dbcf62 pcount=0x1755ced2 arch_timer_rate=0x16e3600 cntfrq=0x16e3600
[    0.000000] cini: arch_counter_register 222 vcount=0x5000017dbfd45 pcount=0x1755fcb5 arch_timer_rate=0x16e3600 cntfrq=0x16e3600
[    0.000000] cini: arch_timer_common_init 222
[    0.000000] cini: arch_timer_arch_init 000
[    0.000000] cini: arch_timer_arch_init 111
[    0.000000] Switching to timer-based delay loop
[    0.000000] cini: arch_timer_arch_init 222 arch_timer_rate=24000000
[    0.000000] cini: sunxi_timer_init
[    0.000000] Console: colour dummy device 80x30
[   16.052147] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[   16.052161] pid_max: default: 32768 minimum: 301
[   16.052309] Mount-cache hash table entries: 512
[   16.052982] CPU: Testing write buffer coherency: ok
[   16.053272] CPU0: update cpu_power 1024
[   16.053284] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[   16.053316] Setting up static identity map for 0xc0344198 - 0xc03441cc
[   16.054074] [sunxi7i_boot_secondary] enter cpu 1
[   16.054136] cc_base is f0020c00
[   16.065157] CPU1: Booted secondary processor
[   16.065189] CPU1: update cpu_power 1024
[   16.065194] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[   16.065301] Brought up 2 CPUs
[   16.065317] SMP: Total of 2 processors activated.
[   16.065322] CPU: All CPU(s) started in SVC mode.
[   16.065991] devtmpfs: initialized
[   16.069463] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[   16.069636] pinctrl core: initialized pinctrl subsystem
[   16.069787] regulator-dummy: no parameters
[   16.070761] NET: Registered protocol family 16
[   16.071010] DMA: preallocated 256 KiB pool for atomic coherent allocations
[   16.074662] bio: create slab <bio-0> at 0
[   16.075809] Switched to clocksource arch_sys_counter
[   16.080911] NET: Registered protocol family 2
[   16.081506] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[   16.081633] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[   16.081752] TCP: Hash tables configured (established 8192 bind 8192)
[   16.081834] TCP: reno registered
[   16.081847] UDP hash table entries: 512 (order: 2, 16384 bytes)
[   16.081904] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[   16.082455] RPC: Registered named UNIX socket transport module.
[   16.082466] RPC: Registered udp transport module.
[   16.082471] RPC: Registered tcp transport module.
[   16.082477] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   16.211521] bounce pool size: 64 pages
[   16.218663] NFS: Registering the id_resolver key type
[   16.218728] Key type id_resolver registered
[   16.218734] Key type id_legacy registered
[   16.218749] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[   16.219249] fuse init (API version 7.22)
[   16.220303] Key type asymmetric registered
[   16.220315] Asymmetric key parser 'x509' registered
[   16.220511] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[   16.220522] io scheduler noop registered
[   16.220528] io scheduler deadline registered
[   16.220666] io scheduler cfq registered (default)
[   16.222302] sunxi-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[   16.254590] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[   16.275717] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 33, base_baud = 1500000) is a U6_16550A
[   16.809110] console [ttyS0] enabled
[   16.817783] brd: module loaded
[   16.820924] sun4i-mdio 1c0b080.mdio: no regulator found
[   16.826101] cini sun4i_mdio_probe 111
[   16.829748] libphy: sun4i_mii_bus: probed
[   16.833695] cini of_mdiobus_register 000
[   16.837549] cini of_mdiobus_register 001
[   16.841401] cini of_mdiobus_register 002
[   16.845260] cini of_mdiobus_register 003
[   16.849114] cini get_phy_device 000 is_c45 is 0
[   16.853568] cini get_phy_id 000
[   16.856653] cini get_phy_id 111
[   16.859738] cini sun4i_mdio_read 000
[   16.863252] cini sun4i_mdio_read 111
[   16.866764] cini sun4i_mdio_read 222
[   16.870275] cini get_phy_id 222
[   16.873363] cini sun4i_mdio_read 000
[   16.876874] cini sun4i_mdio_read 111
[   16.880384] cini sun4i_mdio_read 222
[   16.883898] cini get_phy_id 333
[   16.886983] cini get_phy_device 111
[   16.892041] cini get_phy_device 222
[   16.895493] cini of_mdiobus_register 033
[   16.899347] cini of_mdiobus_register 004
[   16.903290] cini registered phy ethernet-phy at address 1
[   16.908595] cini of_mdiobus_register 111
[   16.912455] cini sun4i_mdio_probe 222
[   16.916356] cini:emac_probe
[   16.919243] sun4i-emac 1c0b000.ethernet: using random MAC address ae:b4:cc:f1:81:ec
[   16.928602] sun4i-emac 1c0b000.ethernet: eth0: at f006c000, IRQ 87 MAC: ae:b4:cc:f1:81:ec
[   16.936979] mousedev: PS/2 mouse device common for all mice
[   16.942744] sdhci: Secure Digital Host Controller Interface driver
[   16.948817] sdhci: Copyright(c) Pierre Ossman
[   16.953127] sdhci-pltfm: SDHCI platform and OF driver helper
[   16.959273] ipip: IPv4 over IPv4 tunneling driver
[   16.964478] TCP: cubic registered
[   16.967834] Key type dns_resolver registered
[   16.975307] Freeing unused kernel memory: 1964K (c045a000 - c0645000)

Fiddlesticks login: root
Password:
Login incorrect
Fiddlesticks login: root
Password:
login[46]: root login on 'ttyS0'
~ # ls
bin      etc      lib      mnt      root     sbin     tmp
dev      init     linuxrc  proc     rootfs   sys      usr
~ # uname  -a
Linux Fiddlesticks 3.11.0-next-20130903-dirty #136 SMP Mon Sep 9 23:58:09 CST 2013 armv7l GNU/Linux
~ # cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 4

Hardware        : Allwinner A1X (Device Tree)
Revision        : 0000
Serial          : 0000000000000000
~ #
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-9-10 23:29:00 | 显示全部楼层
[PATCH ] ARM: sunxi: Add Emac,SMP and Arch_timer support for sunxi A20;Add phy cnt arch timer for ARMv7 support.
It has been tested on a Cubieboard 2. To use SMP you must set ARM_ARCH_TIMER and ARM_ARCH_TIMER_USE_PHYCNT when make xconfig.
If you have any questions or comments please feel free to contact me.  Have a wonderful day!
移植最新的kernel 3.11+  到cubieboard2
1得到最新的主流kernel:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
2打上我的patch:
patch -p1 < ../linux-next/add_smp_emac_archtimer_forA20.patch
patch -p1 < ../linux-next/add_phy_archtimer.patch
3用我的CubieBoard2_config代替.config
cp CubieBoard2_config .config
4编译kernel
make zImage  ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4
5编译DTS
make dtbs ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4
6boot  kernel
新的kernel需要DTS来启动:
在uboot输入如下命令 需要tftp支持,tftp 0x48000000 uImage;tftp 0x42000000 sun7i-a20-cubieboard2.dtb;bootm 0x48000000 - 0x42000000
注意:bootm 后的第3个参数非常重要 它记录的是DTS的地址。
问题:目前3.11 kernel还不支持CB2 display,MMC等。希望以后有时间能搞定。







patch.zip

2.52 KB, 下载次数: 19, 下载积分: 金钱 -1

config.zip

11.28 KB, 下载次数: 12, 下载积分: 金钱 -1

回复 支持 反对

使用道具 举报

发表于 2013-9-19 12:38:47 来自手机 | 显示全部楼层
给力,等会回去在我的mele a100上试试楼主的patch。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-9-19 23:07:27 | 显示全部楼层
slackwareer 发表于 2013-9-19 12:38
给力,等会回去在我的mele a100上试试楼主的patch。

这里太冷清,而且我给的patch不全,几个新加的文件没有包括 我建议你直接加arm mail kernel list :http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 老外对这个比较热心, 而且以后的patch都会发在哪儿。
回复 支持 反对

使用道具 举报

发表于 2013-9-22 17:08:35 | 显示全部楼层
mailing list还是不方便追踪,为嘛不在github上维护的repo呢,有兴趣的就去pull,免得得自己翻mailing list.
回复 支持 反对

使用道具 举报

发表于 2013-11-10 12:21:11 | 显示全部楼层
大哥,请教你下,看了你 CB2最新3.12内核的文章,我按照做了,但是没法启动,我是 TF卡方式启动的
已经放了 u-boot 、spl/sunxi-spl.bin script.bin uEnv.txt

但是一直没有搞明白  DTBS要怎么设定,能详细告诉我一下么,是不是修改 boot.cmd 文件呢?


        setenv bootargs console=ttyS0,115200 noinitrd init=/init root=/dev/mmcblk0p2 rootfstype=ext4 rootwait panic=10 ${extra}
        fatload mmc 0 0x43000000 script.bin
        fatload mmc 0 0x48000000 uImage
        bootm 0x48000000

要怎么改才能启动呢,?,还是要自己移植DTD??
回复 支持 反对

使用道具 举报

发表于 2013-11-20 16:24:18 | 显示全部楼层
最新的内核是 3.12的, LZ能指点下,需要做哪些步骤呢?, 我好像启动的是单核,而且CPU的频率也不对,是不是要移植 arch/arm/mach_sun7i相关的东西呢?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-3 12:00 , Processed in 0.032611 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部