Linux Quick Start

From Altera Wiki
Jump to: navigation, search

QUICK START

1. add the binary toolchain to your PATH in, .bash_profile or .profile , like this,
PATH=$PATH:~/nios2-linux/toolchain-mmu/x86-linux2/bin

2. Build the Linux image in uClinux-dist dir,

  

cd nios2-linux/uClinux-dist
make menuconfig   # or make xconfig

With the newer version of make(3.82), you might get errors such as  [*** mixed implicit and normal rules. Stop.] either change those lines manually in the Makefiles that are affected or get make(3.81) and use to bypass the error. Replace temporarily by renaming existing make to make.3.82 and the new make as make.3.81. Then use "ln -s make.3.81 make".


In the menuconfig, make sure it is selected as follows:

Vendor/Product Selection --->               # select     --- Select the Vendor you wish to target
        Vendor (Altera)  --->               # select Altera     --- Select the Product you wish to target 
        Altera Products (nios2)   --->      # select nios2

Kernel/Library/Defaults Selection --->      # select
    --- Kernel is linux-2.6.x

        Libc Version (None)  --->           # should default to None - very important.

    [*] Default all settings (lose changes) # select
    [ ] Customize Kernel Settings 
    [ ] Customize Vendor/User Settings 

    [ ] Update Default Vendor Settings 

Then <exit> <exit> <yes>

(If you were asked option like this, "Build faac (LIB_FAAC) [N/y/?] (NEW)" just enter to use default. This will be fixed.)

  

Compile kernel and apps,

make

(this will take a while)


3. The images created are,

images/linux.initramfs.gz is the elf image with initramfs built-in

images/zImge.initramfs.gz is the compressed elf image with initramfs built-in

images/vmImage is compressed u-boot image

images/rootfs.jffs2 is jffs2 image, eg, cp rootfs.jffs2 /dev/mtd0. This is available when jffs2 is selected in kernel. Please note the flash erase sector size on 3c120 dev board is 128KB, you will have to specify "MKFS_JFFS2_FLAGS = -l -p -e 128" at the beginning of your product Makefile.


Connect USB Blaster cable to 3C120 dev board, download the sof and elf.

nios2-configure-sof ../3c120_default/nios2_linux_3c120_125mhz_top.sof
nios2-download -g images/linux.initramfs.gz

nios2-terminal



There is a prebuild linux.initramfs.gz elf image in the 3c120_default
dir, which you may try out first.

4. Get source updates from community server.

Normally you will use "git" protocol to get update from server if your PC
is directly connected to the Internet. Then you may skip to step 5.

Only if you are behind a proxy firewall and cannot use git protocol,
you can change the git to use ssh tunneling through port 443 to get updates
from community server with this command, "./use_ssh443_for_update" .

You should have ssh tunneling package installed, such as "corkscrew".
Add the following 3 lines to your ~/.ssh/config, which should have no
public access, "chmod og-rwx config". Replace <http_proxy_ip> <port>
to that of your http proxy server. Change the nios2-linux path to yours.

IdentityFile ~/.ssh/id_rsa
IdentityFile ~/nios2-linux/sshkey/id_rsa

ProxyCommand corkscrew <http_proxy_ip> <port> %h %p




If you failed to use ssh tunnling as above, you may try dumb http protocol
with this command, "./use_http_for_update" . But this is very slow and not
recommended.

You may revert to git protocol when there is no firewall blocking with this
command, "./use_git_for_update" .

5. Now You can fetch updates from server with, "./update".

  

Next step: Creating a Nios II design with a memory management unit (MMU)  
 

  

Personal tools