http://www.denx.de/wiki/UBoot Das u-boot is a fancy bootloader with net support and scripting capabilities. The u-boot source is now include in the nios2 linux tar ball as described in the wiki InstallNios2Linux. Check out the branch that contains your board. ie, de2 branch for DE2, neek-c3 for NEEK, nios2 otherwise. For example, to build for the de2 board, You need to use mkimage to convert zImage,with compress none. To pass "bootargs" for kernel command line on NiosII uClinux, please apply the patch u-boot-1.1.5-nios2-01.diff.gz, attached at the end of this page. You have to use uClinux-dist-20060803 with uClinux-dist-20060803-nios2-02 patch ver 9, or later . Both vmlinux and compressed image are supported. tar jxf u-boot-1.1.5.tar.bz2 Then in kernel config, Files changed,
Manual
Get the source
> cd u-boot
> git fetch
> git branch -a
* nios2
origin/HEAD
origin/de2
origin/master
origin/neek_c3
origin/nios2 git checkout -b de2 origin/de2
Compile
To compile run:
make distclean
make <board>_config
make
where <board> should be replaced with the board you want to compile for (e.g. make EP1C20_config will compile for the EP1C20 board). You can see which boards are supported in the board/altera folder.
Test, store in flash
To test, just load u-boot with nios2-download -g u-boot
See manual for fun stuff to do.
To write to flash:
protect off 0 1ffff
erase 0 1ffff
tftp 5000000 u-boot.bin
cp.b 5000000 0 $filesize
In this example, flash starts at address 0 and the file u-boot.bin is stored temporarily at 500_0000 which is in sdram (this is for the EP2C35 board)
Starting uClinux from u-boot:
Find your uncompressed version of your uClinux kernel (vmlinux) and run the following commands:
nios2-elf-objcopy -O binary vmlinux vmlinux.bin
gzip -9 vmlinux.bin # Creates vmlinux.bin.gz
mkimage -A nios2 -O linux -T kernel -C none -a 0x4500000 -e 0x4500000 -n "Insert your name here" -d vmlinux.bin.gz vmlinux.img
where 0x450_0000 is the address you want the image to load too (again, 450_0000 is in the sdram for EP2C35 board). In my setup, I can find vmlinux.bin.gz under uClinux-dist/linux-2.6.x/arch/nios2nommu/boot/compressed/, so that I can skip the two first steps. The mkimage program is found under the tools folder of the u-boot source code. You might have to adjust some Makefiles to compile it.
In u-boot, tftp the image and bootm it:
tftp 5000000 vmlinux.img
bootm 5000000
Board not supported?
At the time of writing, only three boards are supported. If you're not among the lucky ones, you can start by modifying one of the existing boards (I will use EP1C20 as an example) to make it run on your board:
Once you get this working, you can do a real port (not covered here - yet).
Various bits and pieces
Use nios2-terminal
You should use serial uart as console in most cases. If you want to use nios2-terminal, you have to define "CONFIG_CONSOLE_JTAG" in include/configs/your_board.h to use jtag uart as console. But if you didn't connect nios2-terminal with this configuration, the nios2 will hang.
Default environment variables
You can change the default values of the environment values by adding them/modifying them in include/configs/<board>.h. The names of the defines doesn't always match, but a quick google search will usually give you what you need. Example, to set default values for bootdelay and bootcmd add the following lines:
#define CONFIG_BOOTDELAY 3
#define CONFIG_BOOTCOMMAND "tftp 5000000 zImage.img; bootm 5000000"
Compiling on linux
In the main Makefile change the CROSS_COMPILE for nios2 to this:
ifeq ($(ARCH),nios2)
CROSS_COMPILE = nios2-linux-uclibc-
You might also have to do the following if the compiler complains about srec and bin files:
In the examples/Makefile change
%.srec: %
to
%.srec: %.o
and
%.bin: %
to
%.bin: %.o
This is due to a syntax change in make and will probably be corrected in later versions of u-boot (see: https://dev.openwrt.org/ticket/1680).
Old stuff:
To boot nios2 uclinux, you need the load address of zImage, which is sdram base + boot link offset (in kernel config, may be 0x500000 or 0x800000) . You may find the load address of zImage with
nios2-linux-uclibc-objdump -h zImage
The load addres is the vma of .text .
kernel command line
cd u-boot-1.1.5
zcat u-boot-1.1.5-nios2-01.diff.gz | patch -p0
Processor type and features --->
() Default kernel command string
[*] Passed kernel command line from u-boot
u-boot-1.1.5/lib_nios2/nios_linux.c
linux-2.6.x/arch/nios2nommu/Kconfig
linux-2.6.x/arch/nios2nommu/kernel/setup.c
linux-2.6.x/arch/nios2nommu/kernel/head.S
linux-2.6.x/arch/nios2nommu/boot/compressed/head.S
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| Intel_P30 (2).c Flash file for Intel StrataFlash P30 found on EP3C25 Embedded Evaluation Kit | 8.12 kB | 12:31, 22 May 2009 | drazen | Actions | ||
| u-boot-1.1.5-nios2-01.diff.gz No description | 2.82 kB | 06:00, 6 Dec 2008 | Admin | Actions | ||
| u-boot-nios2-src-050811.zip No description | 1550.31 kB | 06:00, 6 Dec 2008 | Admin | Actions | ||
My presentation training website
nowGoogle.com adalah Multiple Search Engine Popular|intermezo