OpenCores
no use no use 1/1 no use no use
Linux kernel port on simulation.
by avamsi on Apr 24, 2012
avamsi
Posts: 54
Joined: Apr 16, 2012
Last seen: Jul 30, 2014
Hi,

I checked out the uClibc and linux from the opencore SVN. I built and installed the or1ksim with target=or32-linux option. And I built the GNU tool chain with uClibc alone(not with newlib). It installed the binaries for simulator(or32-linux) and tool chain(with uClibc only). Now I want to compile the linux kernel with simple user mode c-app, port it on simulation environment. Which complier chain we need to use to build the linux kernel(newlib tool chain or uclibc tool chain) and which simulator chain we need to give(or1ksim built with target as or32-elf or or32-linux). One more doubt is that, do we need to build the linux kernel for simulator and real HW separately.

Please furnish the exact details that we need to choose in building linux kernel for simulation).

Thanks,
A.Vamsi.
RE: Linux kernel port on simulation.
by olof on Apr 24, 2012
olof
Posts: 218
Joined: Feb 10, 2010
Last seen: Dec 17, 2018
Hi,

You need to use the or32-elf- toolchain (the one with newlib) to compile a linux kernel. You also need the or32-elf version of or1ksim to run the kernel. You should be able to use the same kernel in simulation and on hardware, but you should make sure that the hardware configuration matches your simulation config. For the linux kernel this is handled with the device tree files in arch/openrisc/boot/dts. There should be a dts file there for or1ksim, and I can provide you with one for the ordb2a board if that is the hardware you are using.

To build and simulate your linux userland C app you need the uClibc toolchain together with the or32-linux version of or1ksim. When you want to include your compiled program in your system, you can just copy it to arch/openrisc/support/initramfs/bin/ and recompile your kernel.

--
Olof Kindgren
______________________________________________
ORSoC
Website: www.orsoc.se
Email: olof.kindgren@orsoc.se
______________________________________________
FPGA, ASIC, DSP - embedded SoC design
RE: Linux kernel port on simulation.
by avamsi on Apr 24, 2012
avamsi
Posts: 54
Joined: Apr 16, 2012
Last seen: Jul 30, 2014
Hi Olof,
Thank you for your kind information.

I got the binaries for the tool chain in my PC. Like or1ksim for elf and linux, or32-gcc,gdb for elf and linux. As you mentioned, I built the linux kernel using or32-gcc for elf. When I tried to run it in simulator, after loading the kernel, when I gave run command, it is not running, it just halted, not showing any thing.

The same problem appeared when I tried to run a simple C-app for linux. I built this program using or32-linux-gcc. and tried to run using or1ksim for linux. the below is the log I am getting.

avamsi@avamsi01:~/OpenRISC/linuxbinaries/testing$ or32-linux-gcc -muclibc -mboard=or1ksim hello.c -o hello.elf
avamsi@avamsi01:~/OpenRISC/linuxbinaries/testing$ ls
hello.c hello.elf
avamsi@avamsi01:~/OpenRISC/linuxbinaries/testing$ or32-linux-gdb hello.elf
Building automata... done, num uncovered: 0/216.
Parsing operands data... done.
GNU gdb (OpenRISC 32-bit toolchain for or32-linux (built 20120424)) 7.2-or32-1.0rc3
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later " target="_blank">http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=or32-linux".
For bug reporting instructions, please see:
..." target="_blank">http://bugzilla.opencores.org/>...
Reading symbols from /home/avamsi/OpenRISC/linuxbinaries/testing/hello.elf...(no debugging symbols found)...done.
(gdb) target sim
Seeding random generator with value 0xcee004aa
Connected to the simulator.
(gdb) load
Loading section .init, size 0x28 vma 0x0
Loading section .text, size 0x1ab0 vma 0x28
Loading section .fini, size 0x1c vma 0x1ad8
Loading section .rodata, size 0x79 vma 0x1af4
Loading section .eh_frame, size 0x4 vma 0x1b70
Loading section .ctors, size 0x8 vma 0x3b74
Loading section .dtors, size 0x8 vma 0x3b7c
Loading section .jcr, size 0x4 vma 0x3b84
Loading section .data, size 0x130 vma 0x3b88
Start address 0x28
Transfer rate: 58792 bits in (gdb) run
Starting program: /home/avamsi/OpenRISC/linuxbinaries/testing/hello.elf

q

ctrol+c
quit


Please look into the log and find where it is going wrong.

Thanks,
A.vamsi
RE: Linux kernel port on simulation.
by stekern on Apr 25, 2012
stekern
Posts: 84
Joined: Apr 28, 2009
Last seen: Nov 10, 2016
You need to use the or32-elf- toolchain (the one with newlib) to compile a linux kernel.


You can compile the kernel just fine with the or32-linux- toolchain.
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.