This page is about building the kernel and apps using uClinux-dist sources.
If you have any problems, please post over on the Nios forum.
(This is different from the very old buildroot guide approach. DO NOT MIX UP)
Before you begin:
Follow instructions at InstallNios2Linux to download nios2-linux-20090730.tar and check out the source code.
tar -C your_path -xvf nios2-linux-20090730.tar
The releases from uclinux.org does not apply to the procedures described here.
In uClinux-dist dir, perform the menuconfig. DO NOT cd linux-2.6.x
cd uClinux-dist make menuconfig
In the menuconfig, make sure it is selected as follows:
Vendor/Product Selection ---> # select
--- Select the Vendor you wish to target Vendor (Altera) ---> # should have default to Altera
--- Select the Product you wish to target Altera Products (nios2) ---> # should have defaulted to 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>
DO NOT change any other setting until first successful boot.
You will need to select the hardware using the sopc builder generated PTF file. For the first try, you can use the PTF files attached in the TryOutuClinux page. Run vendor_hwselect to setup the memory and io port address map of your Nios II board (see LinuxHwselect for details) . Select the nios2 cpu and sdram.
(still in uClinux-dist dir, DO NOT cd linux-2.6.x)
# You must give the absolute path to ptf, no spaces allowed in the path. make vendor_hwselect SYSPTF=/path_to_your_hardware_project/your_system.ptf
Compile kernel and apps,
make (this will take a while)
If you have errors, you can get cleaner messages by building in searial instead of in parallel:
NON_SMP_BUILD=1 make
The compressed kernel is stored in the images folder, it is called zImage and is in ELF format. You can follow TryOutuClinux to run the new zImage.
In case you want a real clean restart, use "git clean",
git clean -f -x -d
Still in uClinux-dist dir, DO NOT cd linux-2.6.x
make menuconfig
Kernel/Library/Defaults Selection --->
(linux-2.6.x) Kernel Version
(None) Libc Version
[ ] Default all settings (lose changes)
[*] Customize Kernel Settings <== to change kernel config
[*] Customize Vendor/User Settings <== to change user apps config
[ ] Update Default Vendor Settings
Then <exit> <exit> <yes> .
It will enter kernel config first, then it will enter user apps config, you can select more apps.
After you change config,
make
Here is more usage about uClinux,
/> ifconfig eth0 192.168.1.85 # staic ip
/> route add default gw 192.168.1.254 # gateway
/> ifconfig
eth0 Link encap:Ethernet HWaddr 00:07:ED:00:00:00
inet addr:192.168.1.85 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2260 (2.2 KiB) TX bytes:2854 (2.7 KiB)
Interrupt:8
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
/> inetd & # start inetd to invoke telnetd and ftpd services
[22]
/> boa -d & # start httpd with cgi-demo
[23]
/> netstat -a # show network services
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 *:telnet *:* LISTEN
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
/> free
MemTotal: 6520 kB
MemFree: 4340 kB
Buffers: 0 kB
/> ps
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 147K 0K 2.8 /init
2 S 0K 0K 0.0 ksoftirqd/0
3 S 0K 0K 0.0 events/0
4 S 0K 0K 0.0 khelper
5 S 0K 0K 0.0 kthread
6 S 0K 0K 0.0 kblockd/0
7 S 0K 0K 0.0 pdflush
8 S 0K 0K 0.0 pdflush
9 S 0K 0K 0.0 kswapd0
10 S 0K 0K 0.0 aio/0
17 R 147K 0K 0.3 -/bin/sh
19 S 147K 0K 0.2 dhcpcd
22 S 95K 0K 0.1 inetd
23 S 275K 0K 0.4 boa
/>
ftpd usage, user : ftp, password: <anything> , dir : /home/ftp
boa and cgi usage, dir : /home/httpd
You can check what is in busybox, by running "busybox" on uClinux.
You can check what is in sash, by "help" .
We use initramfs instead of the default romfs . The initramfs is generated from romfs dir and the dev file in vendors/Altera/nios2/romfs_list . See InitramfsUpdate .
The simplified "init" program will run etc/rc and etc/inittab during startup.
If you want to customize startup, eg inet servers and eth config, you should update the files vendors/Altera/nios2/ rc and inittab.
We arrange to minimize the memory usage. We use sash as default shell, it is smaller than busybox and take less memory. We include some standalone networking servers, such as inetd and telnetd. We build some networking utility into busybox, such as ifconfig,route,netstat,telnet,wget..etc. We don't use sh in busybox, and don't use servers in busybox as it takes a lot of memory.
You may use the simple history in sash. Use "h" to list history. Use "!<d>" , d=1..20, to recall one of the history, eg "!3" for the 3rd cmd line.
Retrieved from "http://www.nioswiki.com/OperatingSystems/UClinux/UClinuxDist"
Viewing Details:
