Nios Community Wiki > DasUBoot

DasUBoot

http://www.denx.de/wiki/UBoot

Manual

http://www.psyent.com/download

Das u-boot is a fancy bootloader with net support and scripting capabilities. 

Get the source

  

The u-boot source is now include in the nios2 linux tar ball as described in the wiki InstallNios2Linux.

> cd u-boot
> git fetch
> git branch -a
* nios2
  origin/HEAD
  origin/de2
  origin/master
  origin/neek_c3
  origin/nios2

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,

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&apos;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:
  1. Modify include/configs/EP1C20.h to make it reflect the setup in your system. You should be able to find all the addresses you need from your .ptf file, but it might be easier to look some of it up in your Quartus project.
  2. Modify board/altera/ep1c20/config.mk and update TEXT_BASE to reflect your system. This should normally be the end of your sdram - 256k (e.g. EP2C35 sdram start at 0x400_0000 and has length 0x200_0000 = 0x600_0000, subtract 0x4_0000 (256k) = 0x5fc0000). This is were u-boot will be placed.
  3. Either find and use an appropriate flash.c file, or just modify flash_init to return a non-zero value without probing the actual flash. If you choose to modify, your flash utilities won&apos;t work. But you&apos;ll have everything else ;-) For EP2C35, read the following post: http://forum.niosforum.com/forum/lof...php/t4194.html 
  4. Compile
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&apos;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&apos;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"

Change environment variable from uClinux

Look at the program found under u-boot.git/tools/env

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 .

You need to use mkimage to convert zImage,with compress none.


kernel command line

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
cd u-boot-1.1.5
zcat u-boot-1.1.5-nios2-01.diff.gz  | patch -p0

Then in kernel config,
Processor type and features  ---> 
()  Default kernel command string
[*] Passed kernel command line from u-boot

Files changed,
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

Tag page

Files 3

FileSizeDateAttached by 
 Intel_P30 (2).c
Flash file for Intel StrataFlash P30 found on EP3C25 Embedded Evaluation Kit
8.12 kB12:31, 22 May 2009drazenActions
 u-boot-1.1.5-nios2-01.diff.gz
No description
2.82 kB06:00, 6 Dec 2008AdminActions
 u-boot-nios2-src-050811.zip
No description
1550.31 kB06:00, 6 Dec 2008AdminActions
Viewing 7 of 7 comments: view all
I am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.i found this informative and interesting blog so i think so its very useful and knowledge able.I would like to thank you for the efforts you have made in writing this article. club penguin cheats
Posted 04:17, 23 Jan 2010
I tried compiling on UNIX, can not get it to work. ifeq ($(ARCH),nios2) CROSS_COMPILE = nios2-linux-uclibc- Peter-electronics specialist. site map
Posted 15:25, 9 Feb 2010
This bootloader works very well. I have made some changes but works very well. palm beach general dentist
Posted 02:58, 16 Feb 2010
I tried compiling on UNIX and seems I have the same problem. ifeq ($(ARCH),nios2) CROSS_COMPILE = nios2-linux-uclibc- Peter-electronics specialist.
My presentation training website
Posted 14:54, 25 Feb 2010
Choosing discount eyeglass frames online should not sacrifice a wide selection. It is still a pleasure choice to trust an online store that offers different kinds of discount eyeglass frames. Compared with a site that offers only one or two kinds of discount frames, others providing a larger selection of similar products are more preferable. Online University AND Legal Studies degree AND Online Music degree Political Science Degrees AND Online cyber crime degree
Posted 09:55, 1 Mar 2010
nice to be here.... thanks for share

nowGoogle.com adalah Multiple Search Engine Popular|intermezo

Posted 05:28, 6 Mar 2010
The louis vuitton logo appeared only briefly in the ad on a basketball, the New York Daily News louis vuitton outlet.The ad, which was aired during Super Bowl XLIV, was a montage that louis vuitton wallet of images comparing a luxury lifestyle to a modest lifestyle. louis vuitton sale included working-class people eating lobster and lv eating caviar.Neither Hyundai nor louis vuitton replied to requests for comments, the News said.
Posted 01:25, 9 Mar 2010
Viewing 7 of 7 comments: view all
You must login to post a comment.
SourceForge.net