From Fedora Project Wiki
@spevack | we're about ready to start. I'd like to re-introduce G__81, who is setting a Fedora Classroom record by teaching 3 classes in a row. He'll be starting in the next minute or two, whenever he's ready. Just a reminder that in 75 minutes, we'll have cwickert's class on RPM Packaging | 12:13 |
---|---|---|
* spevack hands the microphone to G__81 | 12:13 | |
... spevack changed the topic of #fedora-classroom to: Fedora Classroom -- Busybox & QEMU | 12:13 | |
... join!#fedora-classroom -> marek(n=mmahut@fedora/pyxel) | 12:13 | |
G__81 | thanks for the introduction spevack and we shall start off | 12:15 |
... signoff!#fedora-classroom -> kkolle(Read error: 110 (Connection timed out)) | 12:15 | |
G__81 | ok today's session focus would be more on how to use busybox and create a basic filesystem | 12:16 |
G__81 | and before we get into qemu we would use the created file system and test it with User Mode Linux :) which we had yesterday | 12:16 |
G__81 | ok now | 12:17 |
G__81 | how many of you know whats busybox | 12:17 |
dash123 | g__81: by creating a fs, you mean we'll be creating the same thing folks at nagios.co.uk did for us? | 12:17 |
dash123 | not me...did a wiki read of course | 12:18 |
G__81 | dash123, thats a fedora file system that we used which has many packages but lets say you just want a basic file system which would boot and you could play with it and which has basic utilities | 12:18 |
... join!#fedora-classroom -> Padhu(n=Padhu@117.97.180.178) | 12:18 | |
G__81 | so we are going to create a very basic file system and use it with user mode linux. Additions to it could be made later | 12:19 |
dash123 | ok | 12:19 |
G__81 | not sure whether we could cover everything today but i ll try my level best to cover whatever i could | 12:19 |
G__81 | ok busybox is an utility to create embedded file systems with basic utilities installed in the file system | 12:20 |
... join!#fedora-classroom -> xyzz(n=xyzz@norkia.v3.sk) | 12:20 | |
G__81 | these utilities could be some bash stuff but it basically does not include any compilers, or any other packages which come as additions | 12:21 |
G__81 | ok now let us download busybox and compile it | 12:21 |
jcapel | does busybox actually have binaries like /bin/ls, or are these interpreted by the shell? | 12:21 |
dash123 | can we jsut yum install busybox it....i saw it exists | 12:21 |
G__81 | jcapel, yes it does have | 12:22 |
G__81 | dash123, no let us not do that then you would not know how to customize it i am not sure what options you have by default | 12:22 |
G__81 | its quite similar to configuring the kernel :) | 12:22 |
dash123 | ok... | 12:22 |
G__81 | you could download the software from this link | 12:22 |
G__81 | http://busybox.net/downloads/busybox-1.13.3.tar.bz2 | 12:22 |
linuxguru | so we don't use the one already packaged in fedora ? | 12:23 |
G__81 | yes | 12:23 |
G__81 | you could its not that we shouldnt | 12:23 |
G__81 | but lets take the hard route so that we get to know the options what are available :) | 12:24 |
l0nwlf | busybox downloaded and extracted | 12:24 |
l0nwlf | now what ? | 12:24 |
G__81 | good | 12:25 |
... leave!#fedora-classroom -> so_solid_moo("Ex-Chat") | 12:25 | |
G__81 | now lets first create a raw file | 12:25 |
G__81 | an image file | 12:25 |
G__81 | you could use qemu img creator for this | 12:25 |
G__81 | do you all have qemu image creator installed ? | 12:25 |
lwh | yes | 12:26 |
jcapel | no, but I imagine dd wil also work? | 12:26 |
G__81 | yeah fine if you all know about dd fine then | 12:26 |
G__81 | lets go the dd way then | 12:27 |
... signoff!#fedora-classroom -> dash123("http://www.mibbit.com ajax IRC Client") | 12:27 | |
l0nwlf | no | 12:27 |
l0nwlf | qemu > I think I should get it via Yum | 12:27 |
G__81 | any problem ? | 12:27 |
G__81 | let me tell you both then :) | 12:27 |
l0nwlf | dd will work i hope ? | 12:27 |
G__81 | i ll tell you how to create it using dd and qemu too | 12:27 |
G__81 | lets create an empty file for 320k size | 12:28 |
G__81 | dd if=/dev/zero of=rootfs.img bs=320k count=1 | 12:28 |
G__81 | this would create an empty file | 12:28 |
G__81 | to know more about dd parameters you could do man dd | 12:29 |
l0nwlf | well inside the Busybox directory | 12:29 |
G__81 | no not necessary | 12:29 |
G__81 | you could do this inside your home dir | 12:29 |
G__81 | is it done? | 12:30 |
* G__81 waits | 12:30 | |
openpercept | yes | 12:30 |
lwh | yes | 12:30 |
jcapel | yes | 12:30 |
l0nwlf | yes | 12:30 |
G__81 | yeah fine | 12:30 |
G__81 | now parallely let me tell you what you would need to do if you want to use qemu image creator | 12:30 |
G__81 | example:qemu-img create rootfs.qcow 1G | 12:31 |
l0nwlf | qemu.i386 : QEMU is a FAST! processor emulator | 12:31 |
G__81 | the above command would create a rootfs.qcow file system of 1GB size | 12:31 |
G__81 | you could use anything you need | 12:32 |
... join!#fedora-classroom -> dash123(i=dce36163@gateway/web/ajax/mibbit.com/x-c69e252ac209cbe4) | 12:32 | |
G__81 | ok now you have created the rootfs.img | 12:32 |
G__81 | now lets format the file system | 12:32 |
... join!#fedora-classroom -> ideamonk(n=ideamonk@117.192.230.66) | 12:32 | |
G__81 | i mean format the file using ext2 or ext3 | 12:32 |
jcapel | the 320k one? | 12:33 |
G__81 | yes | 12:33 |
... signoff!#fedora-classroom -> Malformation(Remote closed the connection) | 12:33 | |
G__81 | mkfs.ext2 i | 12:34 |
G__81 | 1024 F | 12:34 |
G__81 | rootfs.img | 12:34 |
G__81 | sorry | 12:34 |
G__81 | "mkfs.ext2 -i | 12:34 |
G__81 | 1024 -F | 12:34 |
G__81 | rootfs.img" | 12:34 |
G__81 | this is the command for some reason i get line breaks :-o | 12:34 |
G__81 | you could either use ext2 or ext3 | 12:34 |
G__81 | if you want ext3 you could do mkfs.ext3 | 12:35 |
* G__81 wait | 12:35 | |
* G__81 waits | 12:35 | |
jcapel | is there any reason in particular for the -i 1024? | 12:35 |
jcapel | (done, btw) | 12:36 |
lwh | rootfs.img: Linux rev 1.0 ext2 filesystem data | 12:36 |
... join!#fedora-classroom -> mahesh(n=mahesh@116.75.194.100) | 12:36 | |
G__81 | ok yeah fine | 12:36 |
... join!#fedora-classroom -> Malformation(n=Malforma@tiesda1.lnk.telstra.net) | 12:37 | |
l0nwlf | well i do not understood 1 thing | 12:37 |
G__81 | as far as i know 1 node is every 1024 bytes and hence you give it but exact reason i could refer and let you know | 12:37 |
openpercept | done, does -i refers to the block size for FS? i guess | 12:37 |
G__81 | i am not ablee to recollect it | 12:38 |
l0nwlf | dd if=/dev/zero of=rootfs.img bs=320k count=1 => after this we need to make the FS | 12:38 |
G__81 | l0nwlf, yes | 12:38 |
G__81 | you need to format it and create a file system | 12:38 |
G__81 | the dd command creates an empty file | 12:38 |
l0nwlf | and the command will be "mkfs...." | 12:39 |
lwh | mkfs.ext3 or mkfs.ext2 | 12:39 |
G__81 | you could use either of those 2 | 12:39 |
l0nwlf | ok , i'll go with ext3 | 12:40 |
* G__81 waits | 12:40 | |
l0nwlf | well i got some odd outputs | 12:41 |
l0nwlf | pasting the log | 12:41 |
l0nwlf | http://www.mibbit.com/pb/mfnGNw | 12:41 |
G__81 | its done | 12:41 |
G__81 | its not odd thats how you get it | 12:42 |
G__81 | if you read through it it says what its doin :) | 12:42 |
... leave!#fedora-classroom -> xyzz() | 12:42 | |
l0nwlf | "Filesystem too small for a journal" -> why ? | 12:42 |
l0nwlf | and why will this FS be checked after every 30 mounts/180 days ? | 12:43 |
thomasj | l0nwlf, google will answer that for you, has nothing to do with the class right now. | 12:44 |
linuxguru | that's how ext3 works | 12:44 |
l0nwlf | ok | 12:44 |
G__81 | l0nwlf, the ext3 file system is a journalized file system and hence even if you use this mkfs.ext3 as far as i know it still gets you a ext2 file system i believe | 12:44 |
G__81 | if i am wrong someone can correct me | 12:44 |
G__81 | ok now | 12:45 |
Padhu | excuse me tutor, will you please give me an link of these logx | 12:45 |
G__81 | logs ? | 12:45 |
G__81 | what logs ? | 12:45 |
mahesh | it will be set in the fedoraproject.org/wiki/classroom later | 12:45 |
Padhu | fedora class room logs | 12:45 |
G__81 | yeah now | 12:46 |
G__81 | the above steps make sure you have a basic file system | 12:46 |
icarus-c | Padhu: it is on the classroom wiki page | 12:46 |
G__81 | now lets dive into Busybox and start playing with it | 12:46 |
icarus-c | Communicate/IRC/Classroom | 12:47 |
G__81 | so whats the advantage of busybox | 12:47 |
... nick!Marflow -> marflow_afk | 12:47 | |
G__81 | or rather why at all should i use busybox | 12:47 |
Padhu | ok thanks | 12:47 |
... nick!marflow_afk -> Marflow | 12:48 | |
G__81 | if the space requirements are so tight in an embedded device where each MB matters you would need to create a file system which is so light at the same time it has basic utilities and hence you need busybox | 12:48 |
... nick!Marflow -> Marflow_afk | 12:49 | |
G__81 | ok | 12:49 |
G__81 | now | 12:49 |
... nick!Marflow_afk -> marflow_afk | 12:49 | |
G__81 | let us configure busybox | 12:49 |
G__81 | type make menuconfig in the busybox dir | 12:49 |
Padhu | ok | 12:50 |
G__81 | you would get a window which is similar to the kernel configuration window | 12:50 |
G__81 | now in the window | 12:51 |
G__81 | you see lot of options to configure what you want | 12:51 |
G__81 | you see Archival utilities, Core Utils, Console Utils, Debian Utils and so on | 12:51 |
Padhu | yes. right now | 12:51 |
G__81 | you could select what you want | 12:51 |
jcapel | wow, that's cool :) | 12:52 |
G__81 | or you could just select save alternate configuration file option and save the config file as .config | 12:52 |
... signoff!#fedora-classroom -> Malformation(Read error: 104 (Connection reset by peer)) | 12:52 | |
* G__81 waits | 12:53 | |
jcapel | ok, I went for the defaults here :) | 12:53 |
l0nwlf | cat .config | 12:53 |
openpercept | saved to .config | 12:53 |
G__81 | ok fine | 12:53 |
G__81 | now | 12:54 |
G__81 | do make | 12:54 |
... join!#fedora-classroom -> grndplane(n=grndplan@66-215-66-17.dhcp.wsco.ca.charter.com) | 12:54 | |
G__81 | and let it compile | 12:54 |
* G__81 waits | 12:54 | |
Padhu | How can i use as alternate configuration file | 12:55 |
openpercept | Padhu, look at the bottom, there is an option | 12:55 |
l0nwlf | done | 12:56 |
... join!#fedora-classroom -> rjones(n=rjones@87.127.66.208) | 12:56 | |
... join!#fedora-classroom -> Malformation(n=Malforma@tiesda1.lnk.telstra.net) | 12:57 | |
openpercept | alright compilation done | 12:57 |
G__81 | ok | 12:57 |
G__81 | now | 12:57 |
G__81 | give make install | 12:57 |
Padhu | I got it | 12:58 |
G__81 | one sec | 12:58 |
l0nwlf | done : 'You will probably need to make your busybox binary setuid root to ensure all configured applets will work properly.' | 12:58 |
G__81 | now | 12:58 |
G__81 | after you do make | 12:58 |
G__81 | get into _install | 12:58 |
G__81 | dir | 12:58 |
jcapel | will make install overwrite the existing system utilities on my system? | 12:59 |
dash123 | we need to get into _install before issuing "make install"?? | 12:59 |
G__81 | no :) | 12:59 |
G__81 | jcapel, it will not overwrite | 12:59 |
jcapel | ok :) | 12:59 |
dash123 | jcapel:sorry for interrupting | 13:00 |
G__81 | dash123, give make and make install and then get into _install directory | 13:00 |
dash123 | g__81: ok | 13:00 |
G__81 | and now after make install is done get into _install directory and there should be a directory by name sbin | 13:00 |
G__81 | and get into it and see for your self what busybox has done for you :) | 13:00 |
* openpercept is already in _install and can see bin sbin linuxrc and usr | 13:00 | |
G__81 | get into sbin | 13:00 |
jcapel | so much nice tools included in busybox, I must say I'm impressed :) | 13:00 |
G__81 | and type ls | 13:01 |
jcapel | s/much/many >< | 13:01 |
jcapel | my resulting binary is 842K though, that probably won't fit on the 320K rootfs :P | 13:01 |
dash123 | jcapel: the resulting binary of? | 13:02 |
jcapel | make'ing busybox | 13:02 |
G__81 | good question | 13:03 |
G__81 | now the reason is | 13:03 |
G__81 | we just didnt configure busybox at all :) | 13:03 |
G__81 | we just took the default settings | 13:03 |
G__81 | you could reduce it | 13:03 |
G__81 | how ? | 13:03 |
G__81 | let us see | 13:03 |
jcapel | well it's still nice that pretty much all you need fits in under 1MB :) | 13:04 |
G__81 | or rather i would take it a little later | 13:05 |
G__81 | on reducing the size further | 13:05 |
G__81 | i dont want to confuse too much :) | 13:05 |
dash123 | mine is 660Kb(busybox binary)? does it depend on system? | 13:05 |
... join!#fedora-classroom -> Padhu_X(i=7561b4b2@gateway/web/ajax/mibbit.com/x-722ed8d27d7b84e2) | 13:05 | |
G__81 | now let us populate the root file system that we created | 13:06 |
G__81 | log in as root in your machine and create a mount point | 13:06 |
G__81 | /mnt/rootfs | 13:06 |
G__81 | then mount your file system that we created using this | 13:07 |
jcapel | ok, I'll create a slightly bigger rootfs than 320KB then, this won't fit :) | 13:07 |
G__81 | you could for sure :) | 13:07 |
G__81 | i ll tell you the reason w | 13:07 |
G__81 | why we get it a little more is because we used glibc for compilation there is something called as uClibc and if we use that we can still reduce the size to half of what you got | 13:08 |
G__81 | we ll look into it separately | 13:08 |
jcapel | cool | 13:08 |
... join!#fedora-classroom -> maploin(n=mapleoin@fedora/maploin) | 13:08 | |
jcapel | ready, btw | 13:09 |
G__81 | you could probably create something for 3 MB to be on the safest side :) | 13:09 |
jcapel | got 8MB mounted on /mnt now | 13:09 |
G__81 | oh good | 13:09 |
G__81 | now lets populate the file system with busybox data | 13:09 |
G__81 | rsync a | 13:09 |
G__81 | busybox/_install/ /mnt/rootfs/ | 13:09 |
G__81 | chown R | 13:09 |
G__81 | root:root /mnt/rootfs/ | 13:09 |
G__81 | sorry again for some reason | 13:10 |
@spevack | G__81: about 10 minutes left, maybe 15. Next class starts at :30 w/ cwickert | 13:10 |
G__81 | the commands dont get pasted | 13:10 |
G__81 | "rsync -a | 13:10 |
G__81 | busybox/_install/ /mnt/rootfs/ | 13:10 |
G__81 | chown -R | 13:10 |
G__81 | root:root /mnt/rootfs/" | 13:10 |
G__81 | give this command | 13:10 |
jcapel | done | 13:11 |
G__81 | this will copy/sync the data from the busybox to the fs | 13:11 |
G__81 | now type sync to flush all the changes to the fs | 13:11 |
l0nwlf | mount: /mnt/rootfs is not a block device | 13:11 |
jcapel | l0nwlf: mount -o loop /root/rootfs.img /mnt/rootfs | 13:11 |
l0nwlf | oops ok | 13:12 |
G__81 | you have to mount it using loop | 13:12 |
G__81 | yes | 13:12 |
G__81 | now try using this file system for User Mode Linux | 13:12 |
jcapel | ok | 13:13 |
G__81 | we gave the Fedora file system as the parameter yesterday instead of that try giving this | 13:13 |
G__81 | also make sure you unmount it | 13:13 |
G__81 | before you start UML | 13:13 |
G__81 | because this file system would be mounted | 13:13 |
jcapel | Kernel panic - not syncing: No init found. Try passing init= option to kernel. | 13:13 |
... signoff!#fedora-classroom -> Padhu_X("http://www.mibbit.com ajax IRC Client") | 13:13 | |
G__81 | is it the User Mode Linux Kernel ? | 13:14 |
jcapel | yes | 13:14 |
G__81 | kernel version ? | 13:14 |
jcapel | ./linux ubd0=/root/fs.img mem=128M | 13:14 |
jcapel | 2.6.29.1 | 13:14 |
l0nwlf | [l0nwlf@l0nwlf-Arena sbin]$ sudo mount -o loop -t ext3 /mnt/rootfs ../../rootfs.img gives : "/mnt/rootfs: Is a directory" | 13:14 |
jcapel | but it's right, it does not have init, I can try init=/bin/sh I guess | 13:14 |
Padhu | jcapel: i think --loop | 13:15 |
linuxguru | l0nwlf, man mount , /mnt/rootfs comes at last | 13:15 |
jcapel | ok and that doesn't work either :p | 13:15 |
l0nwlf | ok | 13:15 |
G__81 | jcapel, it works here :o | 13:16 |
G__81 | i am on 2.6.28.1 | 13:16 |
jcapel | Failed to execute /bin/sh. Attempting defaults. -- using ldd, I see that it depends on ld-linux.so and a libc | 13:16 |
jcapel | my rootfs image doesn't have that | 13:16 |
... join!#fedora-classroom -> kkolle(n=klaus@89.249.9.231) | 13:16 | |
lwh | if we weren't here yesterday is there a one-liner to boot using UML? | 13:16 |
... join!#fedora-classroom -> ahmed-araby(n=ahmed@unaffiliated/ahmed-araby) | 13:16 | |
G__81 | you get the shell now jcapel ? | 13:16 |
jcapel | no, I think I'm missing some libraries | 13:16 |
... join!#fedora-classroom -> padhu_x(i=7561b4b2@gateway/web/ajax/mibbit.com/x-747f0c88c81780d1) | 13:17 | |
G__81 | anyone getting it ? | 13:17 |
G__81 | after its booted | 13:17 |
G__81 | the following should be done | 13:17 |
G__81 | execute "mkdir /mnt/rootfs/dev" | 13:18 |
G__81 | execute "mknod /mnt/rootfs/dev/console c 5 1 | 13:18 |
G__81 | mknod /" | 13:18 |
G__81 | execute "mknod /mnt/rootfs/dev/console c 5 1" | 13:18 |
G__81 | execute "mknod /mnt/rootfs/dev/null c 1 3" | 13:18 |
jcapel | I'll try building busybox as a static binary | 13:18 |
G__81 | hmmm... | 13:18 |
G__81 | but it should work | 13:18 |
jcapel | well it's linked against libc, and I don't have a libc in my rootfs | 13:19 |
G__81 | you dont need it | 13:19 |
l0nwlf | I can't mount even : 'mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error' | 13:19 |
l0nwlf | 'ext3: No journal on filesystem on loop0' -> dmesg output | 13:20 |
G__81 | why loop0? | 13:20 |
G__81 | the following is the command to mount | 13:20 |
jcapel | but it's fine, I get the idea and will google later; don't let me stall you :) | 13:20 |
G__81 | mount o | 13:21 |
G__81 | loop rootfs.img /mnt/rootfs | 13:21 |
G__81 | there are hyphens missing :o | 13:21 |
G__81 | again | 13:21 |
G__81 | now mount /proc in the busybox file system | 13:21 |
l0nwlf | ohh i gave '-t ext3' .. now it's fine | 13:21 |
G__81 | mount -t proc none /proc | 13:22 |
G__81 | and /sys | 13:22 |
G__81 | as | 13:22 |
G__81 | mount -t sysfs none /sys | 13:22 |
... join!#fedora-classroom -> sattam(n=sattam@unaffiliated/thtoh) | 13:22 | |
G__81 | and one last step is | 13:22 |
G__81 | to create an /etc/inittab file | 13:22 |
G__81 | which is the first script which would get executed | 13:23 |
G__81 | let me fpaste it | 13:23 |
... join!#fedora-classroom -> qwp0(n=qwp0@adsl-dyn217.78-98-136.t-com.sk) | 13:23 | |
G__81 | http://fpaste.org/paste/8010 | 13:23 |
G__81 | this should be the inittab script | 13:23 |
G__81 | and once this is done | 13:23 |
G__81 | you are all set to play with the busybox FS | 13:23 |
G__81 | the other things that could be done are many on top of it | 13:24 |
G__81 | you could configure IP addresses, add routes, do test ping etc.......... | 13:24 |
G__81 | i am not sure whether you all understood it :) | 13:24 |
G__81 | and not sure whether i ve conveyed what i wanted to | 13:24 |
G__81 | properly | 13:24 |
G__81 | :) | 13:24 |
jcapel | I understood :) doesn't work yet, but I'll figure that out later :) | 13:25 |
dash123 | g__81: you did say you'll create a wiki for us though:) | 13:25 |
G__81 | for busybox ? | 13:25 |
ahmed-araby | sattam:it seems that we came tooo late and missed alot | 13:25 |
... join!#fedora-classroom -> Fzza3a(i=29dd1066@gateway/web/ajax/mibbit.com/x-6ecf413d8a8c2284) | 13:25 | |
G__81 | ahmed-araby, i guess right time for the next session :D | 13:26 |
jcapel | G__81: thanks, again! | 13:26 |
@spevack | G__81: thanks for teaching this session! | 13:26 |
G__81 | yeah i shall create a wiki page too on this | 13:26 |
padhu_x | thank you tutor | 13:26 |
@spevack | we'll take a short break, and cwickert will begin the RPM Packaging session at :30 | 13:26 |
padhu_x | you teach me more | 13:26 |
G__81 | for busybox i guess it should be useful | 13:26 |
G__81 | thanks spevack | 13:26 |
grndplane | Thanks | 13:26 |
dash123 | please pass on the link in ML or wherever | 13:26 |
dash123 | thanks g__81 | 13:26 |
openpercept | thanks G__81 | 13:26 |
... leave!#fedora-classroom -> Fzza3a() | 13:27 | |
G__81 | and thanks to everyone for attending this session | 13:27 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!