170 likes | 297 Views
Turn Key Mini Project – SVN and Buildroot. TA: Shun-Lee Chang ( 張舜理 ) Important Dates: Demo and your 2-page report: 4/28 (Tue) 14:00 ~ 18:00 TA Office: EECS ( 電資大樓 ) 701 E-mail: changsl@cs.nctu.edu.tw Contact: #54850 / 0919-972660. Project Goals. Source control by SVN
E N D
Turn KeyMini Project – SVN and Buildroot TA: Shun-Lee Chang (張舜理) Important Dates: Demo and your 2-page report: 4/28 (Tue) 14:00 ~ 18:00 TA Office: EECS (電資大樓) 701 E-mail: changsl@cs.nctu.edu.tw Contact: #54850 / 0919-972660
Project Goals • Source control by SVN • Practice on your SVN repository • Team work using SVN • Root file system • Use “buildroot” to build your own root file system • Makefile
Development Prerequisite • OS • The mini-project was verified on Fedora 10 • Run upon VMWare shall be ok, but VERY SLOW • Packages • ssh, wget • Development related packages • gcc, automake • svn • Check its availability by “svn help”
SVN - Practice • Steps • Create your repository for “myproj3” • svnadmin create /home/userX/myproj3 # assume you have permission to access the above path • Check out it • svn co file:///home/userX/myproj3 src_myproj3 • Add some files to src_myproj3 • echo “welcome” > src_myproj3/hello • Add a new file (by doing so, you can also add a new directory and all files under them) • Under src_myproj3: svn add hello • Commit it • Under src_myproj3: svn commit –m “My first version” • Delete src_myproj3 • /bin/rm –rf src_myproj3 • Check out “myproj3” again • Modify an existing file • echo “bye” >> src_myproj3/hello • Commit it
SVN – Merge • Steps • svn co file:///home/userX/myproj3 a • svn co file:///home/userX/myproj3 b • Edit a/hello, and replace “welcome” with “welcome 1” • Edit b/hello, and replace “bye” with “bye 2” • under a: svn commit –m “v2” • under b: svn commit –m “v3” • under b: svn update • under b: svn commit –m “v3” • svn co file:///home/userX/myproj3 c • Please answer the following questions in the mini-project report • Q1: What happens in step 6 ? • Q2: What happens in step 7 ? • Q3: What is the content of the file “hello” under directories a, b, and c ?
SVN – Conflict • Steps • svn co file:///home/userX/myproj3 d • svn co file:///home/userX/myproj3 e • Edit d/hello, and replace “bye 2” with “good morning” • Edit e/hello, and replace “bye 2” with “bye bye” • under d: svn commit –m “v4” • under e: svn update # enter “p” (postpone) if any question arises • Check e/hello, e/hello.mine, and e/hello.r* • Edit e/hello, remove all lines except “welcome 1” and “bye bye” • under e: svn commit –m “v4” • Delete e/hello.mine, e/hello.mine, and e/hello.r* • under e: svn commit –m “v4” • svn co file:///home/userX/myproj3 f • Please answer the following questions in the mini-project report • Q4: What happens in step 6 ? Compare the result here and Q2. • Q5: List all files under directory e after step 6 • Q6: Try to explain the filename and content in files: e/hello.mine, e/hello.r* • Q7: What happens in step 9 ? • Q8: What is the content of “f/hello?”
SVN – Version • Steps • svn co file:///home/userX/myproj3 z -r 2 • Please answer the following questions in the mini-project report • Q9: What is the content of “z/hello?” • Q10: What does “-r 2” mean in the above command?
Team Work using SVN • Scenario • You join a team project, and share the source code with other members. • You have to “add a feature” for this project. • Steps (on your Linux) • Check out our team-work source • svn co svn+ssh://nsd2009@140.113.88.181/home/nsd2009/proj3 Password is “pwd2009” • Follow the instructions in Readme.txt • Show your results at demo time
(Optional) Bonus • Study “websvn,” • Install a websvn service • You might need to disable SELINUX if not familiar with it • Demo your websvn at the demo time • Your web server shall be accessible from 140.113.88.181 • Write the installation steps, any problem you met, and your solutions in the mini-project report
Buildroot – Control the Source Code • Steps • Download & decompress the buildroot source code • http://buildroot.uclibc.org/ • Control the original source code by svn • Be careful, don’t miss “.defconfig” Hint: Create an empty project, and then move exiting files into the svn-controlled directory • Answer the question in your mini-project report • Q11: Write the procedure of step 2
Buildroot – Compiling • Steps • Switch to the svn-controlled directory, e.g., buildroot/ • make menuconfig • In the “Package Selection for the target” menu, • Turn on “customize” • Turn on “thttpd” and “bash” in some sub-menu Hint: either brute-force search or search “thttpd” in package/Config.in first • Save the configuration (using Exit) • Answer the question in your mini-project report • Q12: How do you turn on “thttpd?”
Buildroot - Customization • Steps • Read package/customize/customize.mk • mkdir package/customize/source/a • Edit package/customize/source/a/intro.htm, and insert HTML content like the following text • Switch to buildroot/, and execute “make” • …(drink a cup of coffee) … • Answer the question in your mini-project report • Q13: Try to explain the logic in customize.mk <html><body> Hello, I am TA, Shun-Lee Chang <changsl@cs.nctu.edu.tw> </body></html>
Buildroot – Test Your File System • Output • Uncompressed FS • $buildroot/project_build_i686/uclibc/root • Image • $buildroot/binaries/uclibc/rootfs.i686.ext2 • Steps • ls / • Be superuser (root) • mount –t ext2 –o loop binaries/uclibc/rootfs.i686.ext2 /mnt • chroot /mnt • ls / • ls -al /a • Execute, “thttpd -p 48311 -dd /a” • Turn off your firewall (or allow Internet access to port 48311 ) • Browse http://your_ip:48311/intro.htm • Answer the following questions in your mini-project report • Q14: Which step cause the output difference in step 1 and 5? • Q15: List files of step 6 • Q16: Try to explain how buildroot generates the directory “/a”
Buildroot – Size of File System • Steps • umount /mnt • ls -l binaries/uclibc/rootfs.i686.ext2 • dd if=/dev/zero of=package/customize/source/a/bigfile count=4096 bs=1024 # It creates a 4MB file • rm build_i686/.customize • /bin/rm –rf project_build_i686/uclibc/root/a • make • ls -l binaries/uclibc/rootfs.i686.ext2 • Answer the following question in your mini-project report • Q17: Compare the results of step 2 and 7
Buildroot – Demo Time • Demo your running “thttpd” service • Demo environment • If your Linux has a public IP • It must be accessible from 140.113.88.181 • Demo through the browser on my PC • If your Linux is run upon VMWare on a notebook • Demo on your notebook • Otherwise, • Copy your buildroot’s image into a CF card or put it on a ftp/web site where I can access • Mount/Demo on my PC
Term Project • Build an embedded firewall (iptables) with transparent proxies (squid, dansguardian) by BuildRoot • (Bonus) Run your root file system on “PCM 7230” • The options “arm” + “xscale” does not work