Version157,changedbyhippo5329@/15/2008.Showversionhistory
ThisisaboutbuildingthekernelandappsusinguClinux-distsources.
Ifyougotanyproblems,pleasepostovertheniosforum.
()
Tobegin,youmusthavefollowedInstallNios2Linux,
InuClinux-distdir,
cduClinux-distmakemenuconfig
Inthemenuconfig,makesureitisselectedasfollows:
Vor/ProductSelection---shouldhavedefaulttoAltera---SelecttheProductyouwishtotargetAlteraProducts(nios2)---select()KernelVersionLibcVersion(None)---select[]CustomizeKernelSettings[]CustomizeVor/UserSettings[]UpdateDefaultVorSettings
Thenexitexityes
DONOTchangeanyothersettinguntilfirstsuccessfulboot.
Runvor_hwselecttosetupthememoryandioportaddressmapofyourNiosIIboard(seeLinuxHwselectfordetails).Selectthenios2cpuandsdram.
(stillinuClinux-distdir,)
makevor_hwselectSYSPTF=/path_to_your_hardware_project/your_/zImageUsingcable"USB-Blaster[]",device1,instance0x00Pausingtargetprocessor:OKInitializingCPUcache(ifpresent)(165.1KB/s)VerifiedOKStartingprocessorataddress0x005000002PREEMPTMonJun1614:30:09CST2008uClinux/NiosIIBuilt1zonelistsinZoneorder,:8128Kernelcommandline:PIDhashtableentries:128(order:7,512bytes)Dentrycachehashtableentries:4096(order:2,16384bytes)Inode-cachehashtableentries:2048(order:1,8192bytes)Memoryavailable:30136k/2333kRAM,0k/0kROM(1552kkernelcode,781kdata)Mount-cachehashtableentries:512net_namespace:180bytesNET:Registeredprotocolfamily16NET:Registeredprotocolfamily2IProutecachehashtableentries:1024(order:0,4096bytes)TCPestablishedhashtableentries:1024(order:1,8192bytes)TCPbindhashtableentries:1024(order:0,4096bytes)TCP:Hashtablesconfigured(established1024bind1024)TCPrenoregisteredNET:Registeredprotocolfamily1ioschedulernoopregisteredioschedulerdeadlineregistered(default)ttyJ0atMMIO0x8009340(irq=8)isaAlteraJTAGUARTconsole[ttyJ0]enabledttyS0atMMIO0x8008e00(irq=7)isaAlteraUARTdm9000EthernetDriver,:Registeredprotocolfamily17RPC:::572kfreed(0x1b8000-0x246000)Shellinvokedtorunfile:/etc/rcCommand:hostnameuClinuxCommand:mount-tprocproc/procCommand:mount-tsysfssysfs/sysCommand:mount-tusbfsnone/proc/bus/usbmount:mountingnoneon/proc/bus/usbfailed:NosuchfileordirectoryCommand:mkdir/var/tmpCommand:mkdir/var/logCommand:mkdir/var/runCommand:mkdir/var/lockCommand:mkdir/var/emptyCommand:::cat/etc/motdWelcometo______/__|||_|__||||_________|||||||||_\||||\\//||_|||__||||||||_||/|___\____|_||_|_||_|\____|\_/\_/|||_|Forfurtherinformationcheck:()/
Now,boardindefaultconfig,
StillinuClinux-distdir,
makemenuconfigKernel/Library/DefaultsSelection---()KernelVersion(None)LibcVersion[]Defaultallsettings(losechanges)[*]CustomizeKernelSettings==tochangekernelconfig[*]CustomizeVor/UserSettings==tochangeuserappsconfig[]UpdateDefaultVorSettings
Thenexitexityes.
Itwillenterkernelconfigfirst,thenitwillenteruserappsconfig,youcanselectmoreapps.
Afteryouchangeconfig,
make
YoumaywanttonowrunyourownprogramontheuClinuxsystem.
AnexampleHelloWorldprogramishere:CompileHello
TherearemoreexampleprogramslinkedunderThenMoreFunhere:?Clinux
HereismoreusageaboutuClinux,
//ifconfigeth0Linkencap:EthernetHWaddr00:07:ED:00:00:00inetaddr:192.168.1.85Bcast:192.168.1.255Mask:255.255.255.0UPBROADCASTNOTRAILERSRUNNINGMULTICASTMTU:1500Metric:1RXpackets:8errors:0dropped:0overruns:0frame:0TXpackets:7errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:2260(2.2KiB)TXbytes:2854(2.7KiB)Interrupt:8loLinkencap:LocalLoopbackinetaddr:127.0.0.1Mask:255.0.0.0UPLOOPBACKRUNNINGMTU:16436Metric:1RXpackets:0errors:0dropped:0overruns:0frame:0TXpackets:0errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:0RXbytes:0(0.0B)TXbytes:0(0.0B)/inetdstarthttpdwithcgi-demo[23]/netstat-a#shownetworkservicesActiveInternetconnections(serversandestablished)ProtoRecv-QS-QLocalAddressForeignAddressStatetcp00*:http*:*LISTENtcp00*:ftp*:*LISTENtcp00*:telnet*:*LISTENActiveUNIXdomainsockets(serversandestablished)ProtoRefCntFlagsTypeStateI-NodePath/freeMemTotal:6520kBMemFree:4340kBBuffers:0kB/psPIDPORTSTATSIZESHARED%//03/04/07/017/bin//
ftpdusage,user:ftp,password:,dir:/home/ftp
boaandcgiusage,dir:/home/httpd
Youcancheckwhatisinbusybox,byrunning"busybox"onuClinux.
Youcancheckwhatisinsash,by"help".
/Altera/nios2/romfs_
Thesimplified"init"programwillrunetc/rcandetc/inittabduringstartup.
Ifyouwanttocustomizestartup,eginetserversandethconfig,youshouldupdatethefilesvors/Altera/nios2/rcandinittab.
,,,suchasifconfig,route,netstat,telnet,wget..'tuseshinbusybox,anddon'tuseserversinbusyboxasittakesalotofmemory.
"h""!",d=1..20,torecalloneofthehistory,eg"!3"forthe3rdcmdline.
Usecontrol-Hforbackspace.
/h1:netstat-a2:date3::date5:boa6:inetd7:ifconfig8:dhcpcd9:free10:ps/!10PIDPORTSTATSIZESHARED%//03/04/07/011/bin//3.1updategittothelatest
Afteryouhavefirstsuccessfulboot,youmayuse"gitpull"
cduClinux-distgitpullcd...4.第四篇TryOutuClinux
Version54,/08/2008.Showversionhistory
Youmay,,otherwiseitwillnotrun.
,youcanbuildthekernelimagewiththeptffileofthesamehardwareproject.
,egc:downloadonWindowsor~/(cygwin),drivec:isnamedas/cygdrive/c/andc:downloadis/cygdrive/c/download.
OpenaNiosIIc,andchangetothedownloaddir.
cd/cygdrive/c/download
OropenashellterminalonLinuxandchangetothedownloaddir.
cd~/download
Note:Ifyoudon'uctionfromonecommandshellsoastoallowittokeeprunning.
4.1ForDE22C35devboard,
nios2-configure-sofDE2_NIOS_HOST_MOUSE_
,
nios2-download-gzImage_DE2_NIOS_HOST_MOUSE_VGA_
ThekernelimagewasbuiltwithDE2_NIOS_HOST_MOUSE_(wassystem_0.ptf)intheprojectDE2_System_/DE2_demonstrations/DE2_NIOS_HOST_MOUSE_
4.2ForDE2-70devboard,
nios2-configure-sofDE2_70_NIOS_HOST_MOUSE_
,
nios2-download-gzImage_DE2_70_NIOS_HOST_MOUSE_VGA_
ThekernelimagewasbuiltwithDE2_70_NIOS_HOST_MOUSE_(wasDE2_70_)intheprojectDE2_70_SYSTEM_cd_/DE2_70_demonstrations/DE2_70_NIOS_HOST_MOUSE_
4.3ForDE1devboard,
nios2-configure-sofDE1_SD_Card_
,
nios2-download-gzImage_DE1_SD_Card_Audio_
ThekernelimagewasbuiltwithDE1_SD_Card_(wassystem_0.ptf)intheprojectDE1_CD_/DE1_demonstrations/DE1_SD_Card_
4.4ForNiosIIEmbeddedEvaluationKit,CycloneIIIEdition,includingCycloneIIIstarterkit(akathe"NEEK")EasiestwaytorunLinuxontheNEEK:
step1:("uCLinux")intothe"Altera_EEK_Applications"directoryontheSD-cardprovidedwiththekit.
step2:WiththeApplicationSelectoryounowcanselectandstart"uCLinux"
()toseewhatitcandoandhowit'sdone.
AnotherApplicationSelectorApplicationisSLS_'sLCDscreenandopensashellthatisdisplayedontheLCDscreenandcanbeusedwithaPS2keyboardattachedtotheNEEK.
WithoutusingtheSD-Cardyoucandothis:
,
nios2-configure-sofcycloneIII_embedded_evaluation_kit_web_
,
nios2-download-gzImage_cycloneIII_embedded_evaluation_kit_web_server
nios2-terminal
ThekernelimagewasbuiltwithcycloneIII_embedded_evaluation_kit_web_server_
However,theTSEMACdriverisnotreadyyet,andtheethernetwon'twork.
4.5ForCycloneIIIstarterkitonly,
nios2-configure-sofcycloneIII_embedded_evaluation_kit_web_
,
nios2-download-gzImage_cycloneIII_embedded_evaluation_kit_web_server
nios2-terminal
ThekernelimagewasbuiltwithcycloneIII_embedded_evaluation_kit_web_server_
However,theethernetwon'tworkasthereisn'toneonthisboard.
Usefulwikipage:CycloneIII-NiosII-Starterboard
4.6ForAlteraNiosdevboard2C35edition(notDSPboard2C35),
nios2-configure-sofNiosII_cycloneII_2c35_full_
,
nios2-download-gzImage_NiosII_cycloneII_2c35_full_featured_
nios2-terminal
ThekernelimagewasbuiltwithNiosII_cycloneII_2c35_full_featured_,nios2eds/examples/verilog/niosII_cycloneII_2c35/full_featured.
4.7ForAlteraNiosdevboard1C20edition,
nios2-configure-sofNiosII_cyclone_1c20_full_
,
nios2-download-gzImage_NiosII_cyclone_1c20_full_featured_
nios2-terminal
ThekernelimagewasbuiltwithNiosII_cyclone_1c20_full_featured_,nios2eds/examples/verilog/niosII_cyclone_1c20/full_featured.
4.8ForAlteraNiosdevboard2S60ROHSedition,
nios2-configure-sofNiosII_stratixII_2s60_RoHS_full_
,
nios2-download-gzImage_NiosII_stratixII_2s60_RoHS_full_featured_
nios2-terminal
ThekernelimagewasbuiltwithNiosII_stratixII_2s60_RoHS_full_featured_,nios2eds/examples/verilog/niosII_stratixII_2s60_RoHS/full_featured.
Buttheethernetporton2S60maynotwork,
4.9ForAlteraNiosdevboard1S10edition,
nios2-configure-sofNiosII_stratix_1s10_full_
,
nios2-download-gzImage_NiosII_stratix_1s10_full_featured_
nios2-terminal
ThekernelimagewasbuiltwithNiosII_stratix_1s40_full_,nios2eds/examples/verilog/niosII_stratix_1s10/full_featured.
4.10ForAlteraNiosdevboard1S40edition,
nios2-configure-sofNiosII_stratix_1s40_full_
,
nios2-download-gzImage_NiosII_stratix_1s40_full_featured_
nios2-terminal
ThekernelimagewasbuiltwithNiosII_stratix_1s40_full_,nios2eds/examples/verilog/niosII_stratix_1s40/full_featured.
Ifyouareusingtime-limitedsof,readopencoreplus,
TetheredMode
TetheredmoderequiresanAlteraserialjointtestactionsgroup(JTAG)
cableconnectedbetweentheJTAGportonyourboardandthehost
computer,whichrunstheQuartusIIProgrammerforthedurationofthe
minimuminstallationoftheQuartusIIsoftware—nolicenseisrequired.