Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Current unstable-nios2mmu (v2.6.38) running on Nios2 without MMU

[this is a "cross-post" from the nios2-dev mailing list. Sorry for the noise to anyone following both.]

Hi all

With today's release of Linux Kernel 2.6.38 I thought it might be a

good idea to put the final few bits together, needed to get the current

Nios2 Linux Kernel port running on Nios2 without MMU too and as you can

see below I was successful :-)

root:/> cat /proc/version

uClinux version 2.6.38-01035-g22583a7-dirty (tklauser@fermion) (gcc version 3.4.6)# 9 Tue Mar 15 15:40:49 CET 2011

root:/> cat /proc/cpuinfo

CPU: Nios II/fast

MMU: none

FPU: none

Clocking: 50.00 MHz

BogoMips: 23.04

Calibration: 11520000 loops

HW:

MUL: yes

MULX: no

DIV: yes

Icache: 4kB, line length: 32

Dcache: 2kB, line length: 32

root:/>

There are a few caveats though:

- Due to a bug in the handling of the __builtin_constant_p builtin in

the GCC version used for Nios2 NOMMU, a patch to kernel/sched.c is

needed [0].

[0]

http://distanz.ch/nios2-linux/0001-omit-use-of-ilog2-macro-in-kernel-sched.c-for-nios2-.patch

- Quite a few options from the kernel and the userspace configuration

needed to be disabled (e.g. the whole block layer, the boa

webserver and others). You can find the configuration I used at [1].

I used a linked in device tree, so you need to adjust the path in

CONFIG_DTB_SOURCE to where your dts file lies.

- I didn't really stress test the running system yet. I also wasn't

able to get a network connection yet due to the missing device tree

support in the altera_tse driver.

- As recently announced by Thomas, the kernel now only runs with device

tree (it might still with the old board layer, but I doubt it and

didn't test it). Though you still need to adjust a few values in

arch/nios2/boards/generic-dts/include/asm/nios2.h to the values from

your generated custom_fpga.h.

[1] http://distanz.ch/nios2-linux/nommu_defconfig/

So as you see there are still some odds and ends to it, but we'll

hopefully sort these out in the next few weeks. Also there is quite a

bit of potential to unify some parts of the code even more (e.g. the

whole cacheflushing)

I'd be glad for anyone interested in this to test the Kernel on their

designs/boards and let us know any problems (patches prefered of

course ;-). So here's what you need to do in order to get the NOMMU

kernel running:

1) Prepare a SOPC design with a Nios2 w/o MMU (I took the MMU reference

design from the wiki, adapted it to our board and additionaly added a

watchdog timer and a sysid component).

2) Generate a dts file from your design using the sopc2dts tool. See

the [2] in the Altera Wiki for reference.

3) Pull the latest unstable-nios2mmu from the linux-2.6 repository on

sopc.et.ntust.edu.tw (tagged as v2.6.38-nios2) and check it out to a

local branch. Check out the trunk branch of the uClinux-dist repo.

4) Apply the patch from [0] to your Linux kernel sources.

5) Download the config.linux-2.6.x and config.vendor-2.6.x from [1] and

put them to vendors/Altera/nios2nommu in your uClinux-dist.

6) Select Altera/nios2nommu in the vendor/product selection, select

"Default all settings (lose changes)"

7) Set CONFIG_DTB_SOURCE in the kernel configuration to the generated

dts file.

8) Optional: Change the console to the JTAG UART.

9) Build your kernel, download your design and kernel and hopefully see

it boot :-)

[2] http://www.alterawiki.com/wiki/devicetree

That should be it, I hope I didn't forget anything and sorry for the

lenghty email. I'll also post these instructions to the forum.

Cheers

Tobias
No RepliesBe the first to reply