



Porting linux on openrisc
by a0000442 on Nov 5, 2015 |
a0000442
Posts: 2 Joined: Jan 16, 2009 Last seen: Nov 23, 2022 |
||
These days I try port linux kernel and busybox on openrisc.
1.First, I try linux kernel 3.4 and everything is ok on or32-elf-sim, MMU cache also seems ok. Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Warning: data cache nsets not a power of 2 Warning: instruction cache nsets not a power of 2 Ethernet TAP type Verbose on, simdebug on, interactive prompt off Machine initialization... Clock cycle: 10ns Data cache present. Insn cache tag present. BPB simulation off. BTIC simulation off. Or1ksim 2011-08-15 Building automata... done, num uncovered: 0/213. Parsing operands data... done. Warning: Failed to set TAP device tap0: Operation not permitted UART at 0x90000000 Resetting Tick Timer. Resetting Power Management. Resetting PIC. Starting at 0x00000000 loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000 Not COFF file format ELF type: 0x0002 ELF machine: 0x005c ELF version: 0x00000001 ELF sec = 30 Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x00215ab4 Section: .rodata, vaddr: 0xc0216000, paddr: 0x216000 offset: 0x00218000, size: 0x0001e010 Section: .eh_frame, vaddr: 0xc0234010, paddr: 0x234010 offset: 0x00236010, size: 0x00040660 Section: __ksymtab, vaddr: 0xc0274670, paddr: 0x274670 offset: 0x00276670, size: 0x00003c30 Section: __ksymtab_gpl, vaddr: 0xc02782a0, paddr: 0x2782a0 offset: 0x0027a2a0, size: 0x00001b90 Section: __ksymtab_strings, vaddr: 0xc0279e30, paddr: 0x279e30 offset: 0x0027be30, size: 0x0000bba4 Section: __param, vaddr: 0xc02859d4, paddr: 0x2859d4 offset: 0x002879d4, size: 0x000001f0 Section: .data, vaddr: 0xc0286000, paddr: 0x286000 offset: 0x00288000, size: 0x0001a5a0 Section: __ex_table, vaddr: 0xc02a05a0, paddr: 0x2a05a0 offset: 0x002a25a0, size: 0x000009f0 Section: .notes, vaddr: 0xc02a0f90, paddr: 0x2a0f90 offset: 0x002a2f90, size: 0x00000024 Section: .head.text, vaddr: 0xc02a2000, paddr: 0x2a2000 offset: 0x002a4000, size: 0x00004000 Section: .init.text, vaddr: 0xc02a6000, paddr: 0x2a6000 offset: 0x002a8000, size: 0x00012184 Section: .init.data, vaddr: 0xc02b81a0, paddr: 0x2b81a0 offset: 0x002ba1a0, size: 0x0014b0ac Section: .data..percpu, vaddr: 0xc0404000, paddr: 0x40324c offset: 0x0040524c, size: 0x00000000 ****************** counters reset ****************** cycles 73558, insn #59736 ****************** counters reset ****************** Compiled-in FDT at c02ba2e0 Linux version 3.4.0 (smpleong@ZBook-14) (gcc version 4.9.1 (GCC) ) #1 Sat Oct 24 22:09:27 CST 2015 CPU: OpenRISC-12 (revision 1) @50 MHz -- dcache: 32 bytes total, 32 bytes/line, 1 way(s) -- icache: 32 bytes total, 32 bytes/line, 1 way(s) -- dmmu: 64 entries, 1 way(s) -- immu: 64 entries, 1 way(s) -- additional features: -- PIC -- timer setup_memory: Memory: 0x0-0x8000000 Reserved - 0x07ffda90-0x00002570 Setting up paging and PTEs. map_ram: Memory: 0x0-0x8000000 On node 0 totalpages: 16384 free_area_init_node: node 0, pgdat c029f7f0, node_mem_map c0426000 Normal zone: 64 pages used for memmap Normal zone: 0 pages reserved Normal zone: 16320 pages, LIFO batch:3 dtlb_miss_handler c0002000 itlb_miss_handler c0002108 OpenRISC Linux -- http://openrisc.net pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 pcpu-alloc: [0] 0 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16320 Kernel command line: console=uart,mmio,0x90000000,115200 Early serial console at MMIO 0x90000000 (options '115200') bootconsole [uart0] enabled PID hash table entries: 512 (order: -2, 2048 bytes) Dentry cache hash table entries: 16384 (order: 3, 65536 bytes) Inode-cache hash table entries: 8192 (order: 2, 32768 bytes) Memory: 126136k/131072k available (2134k kernel code, 4936k reserved, 554k data, 1416k init, 0k highmem) mem_init_done ........................................... NR_IRQS:64 nr_irqs:32 0 100.00 BogoMIPS (lpj=500000) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 devtmpfs: initialized NET: Registered protocol family 16 Switching to clocksource openrisc_timer NET: Registered protocol family 2 IP route cache hash table entries: 2048 (order: 0, 8192 bytes) TCP established hash table entries: 4096 (order: 2, 32768 bytes) TCP bind hash table entries: 4096 (order: 1, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) TCP: reno registered UDP hash table entries: 512 (order: 0, 8192 bytes) UDP-Lite hash table entries: 512 (order: 0, 8192 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. Unpacking initramfs Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2) is a 16550A console [ttyS0] enabled, bootconsole disabled console [ttyS0] enabled, bootconsole disabled ethoc-mdio: probed NET: Registered protocol family 17 Freeing unused kernel memory: 1416k freed init started: BusyBox v1.19.0.git (2011-02-16 08:10:12 CET) udhcpc (v1.19.0.git) started ERROR: Failed to write Ethernet packet data: Bad file descriptor. Sending discover... ERROR: Failed to write Ethernet packet data: Bad file descriptor. Sending discover... ERROR: Failed to write Ethernet packet data: Bad file descriptor. Sending discover... No lease, failing Configuring loopback device Please press Enter to activate this console. # 2. Then, I updte linux form 3.4 to 3.8,but or32-elf-sim goes wrong: Seeding random generator with value 0xf2f79c4c Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Warning: data cache nsets not a power of 2 Warning: instruction cache nsets not a power of 2 Ethernet TAP type Verbose on, simdebug on, interactive prompt off Machine initialization... Clock cycle: 10ns Data cache present. Insn cache tag present. BPB simulation off. BTIC simulation off. Or1ksim 2011-08-15 Building automata... done, num uncovered: 0/213. Parsing operands data... done. Warning: Failed to set TAP device tap0: Operation not permitted UART at 0x90000000 Resetting Tick Timer. Resetting Power Management. Resetting PIC. Starting at 0x00000000 loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000 Not COFF file format ELF type: 0x0002 ELF machine: 0x005c ELF version: 0x00000001 ELF sec = 28 Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x002272bc Section: .rodata, vaddr: 0xc0228000, paddr: 0x228000 offset: 0x0022a000, size: 0x00023460 Section: __ksymtab, vaddr: 0xc024b460, paddr: 0x24b460 offset: 0x0024d460, size: 0x00003d90 Section: __ksymtab_gpl, vaddr: 0xc024f1f0, paddr: 0x24f1f0 offset: 0x002511f0, size: 0x00002318 Section: __ksymtab_strings, vaddr: 0xc0251508, paddr: 0x251508 offset: 0x00253508, size: 0x0000cfba Section: __param, vaddr: 0xc025e4c4, paddr: 0x25e4c4 offset: 0x002604c4, size: 0x00000200 Section: .data, vaddr: 0xc0260000, paddr: 0x260000 offset: 0x00262000, size: 0x0001b320 Section: __ex_table, vaddr: 0xc027b320, paddr: 0x27b320 offset: 0x0027d320, size: 0x00000a58 Section: .head.text, vaddr: 0xc027c000, paddr: 0x27c000 offset: 0x0027e000, size: 0x00004000 Section: .init.text, vaddr: 0xc0280000, paddr: 0x280000 offset: 0x00282000, size: 0x00011d9c Section: .init.data, vaddr: 0xc0291da0, paddr: 0x291da0 offset: 0x00293da0, size: 0x00002b1c ****************** counters reset ****************** cycles 78958, insn #64056 ****************** counters reset ****************** Compiled-in FDT at c0293f40 Linux version 3.8.0 (smpleong@ZBook-14) (gcc version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-linux (built 20111017)) ) #1 Thu Nov 5 10:44:50 CST 2015 CPU: OpenRISC-12 (revision 1) @50 MHz -- dcache: 32 bytes total, 32 bytes/line, 1 way(s) -- icache: 32 bytes total, 32 bytes/line, 1 way(s) -- dmmu: 64 entries, 1 way(s) -- immu: 64 entries, 1 way(s) -- additional features: -- PIC -- timer setup_memory: Memory: 0x0-0x8000000 Reserved - 0x07ffda90-0x00002570 Setting up paging and PTEs. map_ram: Memory: 0x0-0x8000000 dtlb_miss_handler c0002000 itlb_miss_handler c0002108 OpenRISC Linux -- http://openrisc.net Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16320 Kernel command line: earlycon=uart,mmio,0x90000000,115200 console=ttyS0,115200 Early serial console at MMIO 0x90000000 (options '115200') bootconsole [uart0] enabled PID hash table entries: 512 (order: -2, 2048 bytes) Dentry cache hash table entries: 16384 (order: 3, 65536 bytes) Inode-cache hash table entries: 8192 (order: 2, 32768 bytes) Memory: 127600k/131072k available (2204k kernel code, 3472k reserved, 336k data, 104k init, 0k highmem) mem_init_done ........................................... NR_IRQS:32 100.00 BogoMIPS (lpj=500000) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 devtmpfs: initialized NET: Registered protocol family 16 Switching to clocksource openrisc_timer NET: Registered protocol family 2 TCP established hash table entries: 1024 (order: 0, 8192 bytes) TCP bind hash table entries: 1024 (order: -1, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP: reno registered UDP hash table entries: 512 (order: 0, 8192 bytes) UDP-Lite hash table entries: 512 (order: 0, 8192 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2) is a 16550A then I search the forum and found that this is a bug in linux kernel,I follow the guide ,but problem still unsolved http://opencores.org/forum,OpenRISC,0,5268w finally, I update kernel to 4.2 but the or32-elf-sim crash Seeding random generator with value 0x59c5f8c8 Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Warning: data cache nsets not a power of 2 Warning: instruction cache nsets not a power of 2 Ethernet TAP type Verbose on, simdebug on, interactive prompt off Machine initialization... Clock cycle: 10ns Data cache present. Insn cache tag present. BPB simulation off. BTIC simulation off. Or1ksim 2011-08-15 Building automata... done, num uncovered: 0/213. Parsing operands data... done. Warning: Failed to set TAP device tap0: Operation not permitted UART at 0x90000000 Resetting Tick Timer. Resetting Power Management. Resetting PIC. Starting at 0x00000000 loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000 Not COFF file format ELF type: 0x0002 ELF machine: 0x005c ELF version: 0x00000001 ELF sec = 30 Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x002ad37c Section: .rodata, vaddr: 0xc02ae000, paddr: 0x2ae000 offset: 0x002b0000, size: 0x000312e0 Section: .eh_frame, vaddr: 0xc02df2e0, paddr: 0x2df2e0 offset: 0x002e12e0, size: 0x00053210 Section: __ksymtab, vaddr: 0xc03324f0, paddr: 0x3324f0 offset: 0x003344f0, size: 0x00004518 Section: __ksymtab_gpl, vaddr: 0xc0336a08, paddr: 0x336a08 offset: 0x00338a08, size: 0x00003200 Section: __ksymtab_strings, vaddr: 0xc0339c08, paddr: 0x339c08 offset: 0x0033bc08, size: 0x0001092b Section: __param, vaddr: 0xc034a534, paddr: 0x34a534 offset: 0x0034c534, size: 0x0000030c Section: __modver, vaddr: 0xc034a840, paddr: 0x34a840 offset: 0x0034c840, size: 0x000017c0 Section: .data, vaddr: 0xc034c000, paddr: 0x34c000 offset: 0x0034e000, size: 0x00016380 Section: __ex_table, vaddr: 0xc0362380, paddr: 0x362380 offset: 0x00364380, size: 0x00000ae0 Section: .notes, vaddr: 0xc0362e60, paddr: 0x362e60 offset: 0x00364e60, size: 0x00000024 Section: .head.text, vaddr: 0xc0364000, paddr: 0x364000 offset: 0x00366000, size: 0x00004000 Section: .init.text, vaddr: 0xc0368000, paddr: 0x368000 offset: 0x0036a000, size: 0x00018f10 Section: .init.data, vaddr: 0xc0380f20, paddr: 0x380f20 offset: 0x00382f20, size: 0x000bc574 Section: .data..percpu, vaddr: 0xc043e000, paddr: 0x43d494 offset: 0x0043f494, size: 0x00000000 ****************** counters reset ****************** cycles 112142, insn #88956 ****************** counters reset ****************** exit(34425) @reset : cycles 112142, insn #88956 @exit : cycles 6056030, insn #2549874 diff : cycles 5943888, insn #2460918 but I noticed that If I disable Dcache, or1ksim goes OK,is this a bug in kernel 4.x? Who can help me?Thanks Seeding random generator with value 0xf3420559 Data MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Insn MMU 0KB: 1 ways, 64 sets, entry size 1 bytes Warning: data cache nsets not a power of 2 Warning: instruction cache nsets not a power of 2 Ethernet TAP type Verbose on, simdebug off, interactive prompt off Machine initialization... Clock cycle: 10ns No data cache. Insn cache tag present. BPB simulation off. BTIC simulation off. Or1ksim 2011-08-15 Building automata... done, num uncovered: 0/213. Parsing operands data... done. Warning: Failed to set TAP device tap0: Operation not permitted UART at 0x90000000 Resetting Tick Timer. Resetting Power Management. Resetting PIC. Starting at 0x00000000 loadcode: filename vmlinux startaddr=00000000 virtphy_transl=00000000 Not COFF file format ELF type: 0x0002 ELF machine: 0x005c ELF version: 0x00000001 ELF sec = 30 Section: .text, vaddr: 0xc0000000, paddr: 0x0 offset: 0x00002000, size: 0x002924a0 Section: .rodata, vaddr: 0xc0294000, paddr: 0x294000 offset: 0x00296000, size: 0x0002ea48 Section: .eh_frame, vaddr: 0xc02c2a48, paddr: 0x2c2a48 offset: 0x002c4a48, size: 0x0004fa6c Section: __ksymtab, vaddr: 0xc03124b4, paddr: 0x3124b4 offset: 0x003144b4, size: 0x000044d8 Section: __ksymtab_gpl, vaddr: 0xc031698c, paddr: 0x31698c offset: 0x0031898c, size: 0x00002df8 Section: __ksymtab_strings, vaddr: 0xc0319784, paddr: 0x319784 offset: 0x0031b784, size: 0x0000fdeb Section: __param, vaddr: 0xc0329570, paddr: 0x329570 offset: 0x0032b570, size: 0x000002f8 Section: .data, vaddr: 0xc032a000, paddr: 0x32a000 offset: 0x0032c000, size: 0x00015f60 Section: __ex_table, vaddr: 0xc033ff60, paddr: 0x33ff60 offset: 0x00341f60, size: 0x00000ab0 Section: .notes, vaddr: 0xc0340a10, paddr: 0x340a10 offset: 0x00342a10, size: 0x00000024 Section: .head.text, vaddr: 0xc0342000, paddr: 0x342000 offset: 0x00344000, size: 0x00004000 Section: .init.text, vaddr: 0xc0346000, paddr: 0x346000 offset: 0x00348000, size: 0x000152bc Section: .init.data, vaddr: 0xc035b2c0, paddr: 0x35b2c0 offset: 0x0035d2c0, size: 0x00183ef4 Section: .data..percpu, vaddr: 0xc04e0000, paddr: 0x4df1b4 offset: 0x004e11b4, size: 0x00000000 ****************** counters reset ****************** cycles 112580, insn #88513 ****************** counters reset ****************** Compiled-in FDT at c035c2a0 Linux version 4.2.0-or1ksim (smpleong@ZBook-14) (gcc version 4.9.1 (GCC) ) #2 Thu Nov 5 15:18:26 CST 2015 CPU: OpenRISC-12 (revision 1) @50 MHz -- dcache disabled -- icache: 32 bytes total, 32 bytes/line, 1 way(s) -- dmmu: 64 entries, 1 way(s) -- immu: 64 entries, 1 way(s) -- additional features: -- power management -- timer setup_memory: Memory: 0x0-0x8000000 Reserved - 0x07fff270-0x00000d57 Setting up paging and PTEs. map_ram: Memory: 0x0-0x8000000 itlb_miss_handler c0002160 dtlb_miss_handler c0002000 OpenRISC Linux -- http://openrisc.net Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16320 Kernel command line: console=uart,mmio,0x90000000,115200 earlycon: Early serial console at MMIO 0x90000000 (options '115200') bootconsole [uart0] enabled PID hash table entries: 512 (order: -2, 2048 bytes) Dentry cache hash table entries: 16384 (order: 3, 65536 bytes) Inode-cache hash table entries: 8192 (order: 2, 32768 bytes) Sorting __ex_table... Memory: 125240K/131072K available (2633K kernel code, 94K rwdata, 600K rodata, 1656K init, 85K bss, 5832K reserved, 0K cma-reserved) mem_init_done ........................................... NR_IRQS:32 clocksource: openrisc_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 38225208935 ns 100.00 BogoMIPS (lpj=500000) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes) devtmpfs: initialized clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns NET: Registered protocol family 16 clocksource: Switched to clocksource openrisc_timer NET: Registered protocol family 2 TCP established hash table entries: 2048 (order: 0, 8192 bytes) TCP bind hash table entries: 2048 (order: 0, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) UDP hash table entries: 512 (order: 0, 8192 bytes) UDP-Lite hash table entries: 512 (order: 0, 8192 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. futex hash table entries: 256 (order: -2, 3072 bytes) Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2, base_baud = 3125000) is a 16550A console [ttyS0] enabled console [ttyS0] enabled bootconsole [uart0] disabled bootconsole [uart0] disabled libphy: ethoc-mdio: probed NET: Registered protocol family 17 Freeing unused kernel memory: 1656K (c0342000 - c04e0000) init started: BusyBox v1.23.0.git (2014-07-16 07:52:52 EEST) Configuring loopback device |



