Platform and tools: Ubuntu 9.04
Step 1, Download the nios linux tallbal
wget http://www.niosftp.com/pub/linux/nios2-linux-20090929.tar
or use xunlei to fix it.
Step2,
tar xvf nios2-linux-20090929.tar
cd nios2-linux
./checkout
Step 3, Generate the fpga.h file
First, a nios processor should be constructed.
Use any one of examples in the DE2 cd. For instance, use E:/fpga/de2_70/DE2_70_demonstrations/DE2_70_NIOS_HOST_MOUSE_VGA
Then add a mmu as pics bellow. Remember to click the Auto-Assign Base Addresses, or it will sthick on the booting stage.
Click Generate, this takes a while.
Alfter above steps, we can get fpga.h file now.Open Nios II Command Shell, cd to this DE2...vga DIR, and key in the following commond
sopc-create-header-files --single fpga.h
start complication
copy ***VGA.sof to c:/
then copy the fpga.h file to /softs/nios2-linux/linux-2.6/arch/nios2/include/asm
Step 4 Building the linux kernel
Add "PATH=$PATH:~/nios2-linux/toolchain-mmu/x86-linux2/bin" to ~/.bashrc file
cd /softs/nios2-linux/uClinux-dist
make menuconfig
#Enable the dma9000 and mtd drivers
make
cd images
copy linux.initramfs.gz to windows xp c:/
Step 5 Flash Linux kelnel to DE2-70
Open Nios II Command Shell, cd to this DE2...vga DIR, and key in the following commonds
nios2-configure-sof ***.sof
nios2-download -g linux.initramfs.gz
nios2-terminal
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[NiosII EDS]$ nios2-terminal
nios2-terminal: connected to hardware target using JTAG UART on cable
nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)
Linux version 2.6.30-00494-g84a224b-dirty (root@ubuntu) (gcc version 4.1.2) #14
Mon May 24 03:24:02 PDT 2010
console [early0] enabled
Early printk initialized
Linux/Nios II-MMU
init_bootmem_node(?,0x42eb, 0x4000, 0x6000)
free_bootmem(0x42eb000, 0x1d15000)
reserve_bootmem(0x42eb000, 0x400)
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
Kernel command line:
NR_IRQS:32
PID hash table entries: 128 (order: 7, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
We have 24576 pages of RAM
Memory available: 29488k/2986k RAM, 0k/0k ROM (1562k kernel code, 1424k data)
Calibrating delay loop... 49.25 BogoMIPS (lpj=246272)
Mount-cache hash table entries: 512
net_namespace: 716 bytes
NET: Registered protocol family 16
init_BSP(): registering device resources
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
msgmni has been set to 57
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
ttyJ0 at MMIO 0x96095a8 (irq = 2) is a Altera JTAG UART
console handover: boot [early0] -> real [ttyJ0]
dm9000 Ethernet Driver, V1.31
mice: PS/2 mouse device common for all mice
TCP cubic registered
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ /| | | |/ // /
| |_| | |__| || | | | | |_| |/ /
| ___/____|_||_|_| |_|/____|/_//_/
| |
|_|
For further information check:
http://www.uclinux.org/
BusyBox v1.15.1 (2010-05-23 23:55:03 PDT) hush - the humble shell
Enter 'help' for a list of built-in commands.
/ # ls
bin etc init mnt root sys usr
dev home lib proc sbin tmp var
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Done