Upload
jonny
View
30
Download
0
Embed Size (px)
DESCRIPTION
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: [email protected] Contact: #54850 / 0919-972660. Project Goals. Source control by SVN - PowerPoint PPT Presentation
Citation preview
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: [email protected]: #54850 / 0919-972660
2
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 syst
em
• Makefile
3
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”
4
SVN - Practice• Steps
1. Create your repository for “myproj3”• svnadmin create /home/userX/myproj3 # assume you have permission to access the above path
2. Check out it• svn co file:///home/userX/myproj3 src_myproj3
3. Add some files to src_myproj3• echo “welcome” > src_myproj3/hello
4. 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
5. Commit it• Under src_myproj3: svn commit –m “My first version”
6. Delete src_myproj3• /bin/rm –rf src_myproj3
7. Check out “myproj3” again8. Modify an existing file
– echo “bye” >> src_myproj3/hello– Commit it
5
SVN – Merge
• Steps1. svn co file:///home/userX/myproj3 a2. svn co file:///home/userX/myproj3 b3. Edit a/hello, and replace “welcome” with “welcome 1”4. Edit b/hello, and replace “bye” with “bye 2”5. under a: svn commit –m “v2”6. under b: svn commit –m “v3”7. under b: svn update8. under b: svn commit –m “v3”9. 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 ?
6
SVN – Conflict • Steps
1. svn co file:///home/userX/myproj3 d2. svn co file:///home/userX/myproj3 e3. Edit d/hello, and replace “bye 2” with “good morning”4. Edit e/hello, and replace “bye 2” with “bye bye”5. under d: svn commit –m “v4”6. under e: svn update # enter “p” (postpone) if any question arises7. Check e/hello, e/hello.mine, and e/hello.r*8. Edit e/hello, remove all lines except “welcome 1” and “bye bye”9. under e: svn commit –m “v4”10. Delete e/hello.mine, e/hello.mine, and e/hello.r*11. under e: svn commit –m “v4”12. 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?”
7
SVN – Version
• Steps1. 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 co
mmand?
8
Team Work using SVN
• Scenario– You join a team project, and share the sourc
e code with other members.– You have to “add a feature” for this project.
• Steps (on your Linux)1. Check out our team-work source
• svn co svn+ssh://[email protected]/home/nsd2009/proj3 Password is “pwd2009”
2. Follow the instructions in Readme.txt
– Show your results at demo time
9
(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
10
11
Buildroot – Control the Source Code
• Steps1.Download & decompress the buildroot source code
• http://buildroot.uclibc.org/
2.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
12
Buildroot – Compiling
• Steps 1. Switch to the svn-controlled directory, e.g., buildroot
/2. make menuconfig
• In the “Package Selection for the target” menu,a. Turn on “customize”b. Turn on “thttpd” and “bash” in some sub-menu Hint: either brute-force search or search “thttpd” in package/Co
nfig.in first
3. Save the configuration (using Exit)
• Answer the question in your mini-project report– Q12: How do you turn on “thttpd?”
13
Buildroot - Customization
• Steps1. Read package/customize/customize.mk2. mkdir package/customize/source/a3. Edit package/customize/source/a/intro.htm, and ins
ert HTML content like the following text
4. Switch to buildroot/, and execute “make”5. …(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 <[email protected]></body></html>
14
Buildroot – Test Your File System• Output
– Uncompressed FS• $buildroot/project_build_i686/uclibc/root
– Image• $buildroot/binaries/uclibc/rootfs.i686.ext2
• Steps1. ls /2. Be superuser (root)3. mount –t ext2 –o loop binaries/uclibc/rootfs.i686.ext2 /mnt4. chroot /mnt5. ls /6. ls -al /a7. Execute, “thttpd -p 48311 -dd /a”8. Turn off your firewall (or allow Internet access to port 48311 )9. 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”
15
Buildroot – Size of File System
• Steps1. umount /mnt2. ls -l binaries/uclibc/rootfs.i686.ext23. dd if=/dev/zero of=package/customize/source/a/bigfile count=4
096 bs=1024 # It creates a 4MB file4. rm build_i686/.customize5. /bin/rm –rf project_build_i686/uclibc/root/a6. make7. 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
16
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
17
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