< User:Az990tony
Revision as of 02:44, 19 August 2008 by Jpritikin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The following was based on information found in FedoraForum .

In the case of the XS School Server, the CD is designed to run in "batch mode" unattended. This may not be what you want. This can be fixed with some minor "squashfs surgery" as follows. Note: you need root authority to issue mount commands, so I found it easier to do the entire process logged in as root. I am sure that this can be done with appropriate sudo or su - commands.

1. Mount the source, in this case the old-XS-163.iso file. If you have the CD itself, you can unmount the physical CD (/media/OLPC_XS_163) and make the iso file using the "dd" command. Listing out the directory shows there are three items, a subdirectory called isolinux, a file called squashfs.img, and a subdirectory called sysroot.

[root ~]#  cd /root
[root ~]#  umount /media/OLPC_XS_163
[root ~]#  dd if=/dev/cdrom of=old-xs163.iso bs=2k
[root ~]#  mkdir /root/ISO
[root ~]#  mount -t iso9660 -o loop old-XS-163.iso ISO 
[root ~]#  ls ISO
isolinux   squashfs.img   sysroot

2. Unpack the file system "squashfs.img". This shows an os.img file, and another sysroot subdirectory. Note the -d squashfs-root is the default, but I include here for completeness.

[root ~]#  cd /root
[root ~]#  yum install squashfs-tools   (* if you have not yet installed it, now you can)
[root ~]#  modprobe squashfs            (* make sure it is loaded into the system)
[root ~]#  unsquash -d squashfs-root ISO/squashfs.img
[root ~]#  ls squashfs-root
os.img  sysroot

3. This is like peeling layers off an onion. We are now going to mount the os.img as a file system in rw=read/write mode so that we can modify it.

[root ~]#  cd /root
[root ~]#  mkdir LIVE
[root ~]#  mount -o loop,rw squashfs-root/os.img LIVE
[root ~]#  ls LIVE
bin   dev   fsroot.olpc lib     lost+found  mnt  proc  ...
boot  etc   home        library media       opt  root  ... 

4. Here you can edit files, install or uninstall RPMs, etc., by using the --root parameter. In my case, I just want to edit the kickstart file with one I made using the "kickstart configurator". You may prefer instead just to edit it with your favorite text editor, such as gedit or vi. If you comment out any lines in the anaconda-ks.cfg, make sure the "#" is in column one, and a space exists in column 2 for each line you want ignored.

[root ~]#  cd /root
[root ~]#  rpm -qa --root /root/LIVE | sort > xs-packages.lst
[root ~]#  cp LIVE/root/anaconda-ks.cfg old-anaconda-ks.cfg
[root ~]#  cp old-anaconda-ks.cfg new-anaconda-ks.cfg
[root ~]#  gedit new-anaconda-ks.cfg
[root ~]#  cp new-anaconda-ks.cfg LIVE/root/anaconda-ks.cfg
[root ~]#  cat LIVE/root/anaconda-ks.cfg
# Kickstart file for installing a school server
# Use text mode install interactive - modified by Tony Pearson
# lang en_US.UTF-8
# keyboard us
# xconfig --startxonboot
# Network information
network --device eth0 --bootproto dhcp --hostname schoolserver
firewall --enabled
authconfig --enableshadow --enablemd5
# selinux --permissive
selinux --disabled
timezone --utc America/New_York
# bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
bootloader --location=none 
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
# clearpart --linux --drives=sda
# part /boot --fstype ext3 --size=100 --ondisk=sda
# part / --fstype ext3 --size=8192 --ondisk=sda
# part pv.6 --size=0 --grow --ondisk=sda
# volgroup VolGroup00 --pesize=32768 pv.6
# logvol /library --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=200000 --grow
# logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=2048
clearpart --none  

5. When you are done with the edits, unmount LIVE and re-pack the contents. If you have a new-squash.img from a previous run, delete it first. The mksquashfs process can take a while, so now is a good time to get up and stretch or drink some coffee.

[root ~]#  cd /root
[root ~]#  umount LIVE
[root ~]#  rm new-squash.img
[root ~]#  mksquashfs squashfs-root new-squash.img
[root ~]#  mksquashfs squashfs-root new-squash.img  -no-sparse -b 64k   # if you have squashfs 3.3.x

6. We are now going to create a new folder that contains everything we need to burn a new CD. Note that the "/" (slash) after ISO is very important. The exclude copies all files except the original squashfs.img file, which we will replace with the new-squash.img we just made in step 5. Listing the BUILD directory shows that it is an exact match of what we had in step 1.

[root ~]#  cd /root
[root ~]#  mkdir BUILD
[root ~]#  rsync -av --exclude='squash.img' ISO/ BUILD
[root ~]#  cp new-squashfs.img BUILD/squashfs.img
[root ~]# ls BUILD
isolinux  squashfs.img  sysroot

7. Now we generate the "iso" file itself. Note, the mkisofs command must be run from within the BUILD directory. The final character "." is important, and means all files in the BUILD directory are included in the *.iso image. Make sure that the new ISO has the same "CDLABEL" as the original by specifying the "-V" parameter. Compare the size of the new-xs163.iso file just created with the old-xs163.iso that we made in step 1. They should be similar in size.

[root ~]#  cd /root/BUILD
[root BUILD]#  cat isolinux/isolinux.cfg | grep CDLABEL
 append initrd=initrd.img  ro quiet root=CDLABEL=OLPC_XS_163 rootfstype=iso9660 liveimg 
 append initrd=initrd.img  ro quiet root=CDLABEL=OLPC_XS_163 rootfstype=iso9660 liveimg live_ram
 append initrd=initrd.img  ro quiet root=CDLABEL=OLPC_XS_163 rootfstype=iso9660 liveimg check
[root BUILD]#  mkisofs -R -l -D -b isolinux/isolinux.bin -c isolinux/boot.catalog
                       -o /root/new-xs163.iso -allow-leading-dots -input-charset default
                       -no-emul-boot -boot-load-size 4 -boot-info-table -V "OLPC_XS_163"
[root BUILD]#  cd /root
[root ~]#  ls -l *.iso
-rw-r--r-- 1 root root 474998784 2008-06-17 07:10 new-xs163.iso
-rw-r--r-- 1 root root 475021312 2008-06-17 06:22 old-xs163.iso

8. We can test this "iso" file out with QEMU-KVM virtualization first, so that we don't burn any coasters. This step is optional, but can help reduce wasting blank CD media. First, we verify that our CPU has vmx or svm support, it has svm. Next we load the kvm module specific to the processor time, in this case AMD.

[root ~]#  cd /root
[root ~]#  cat /proc/cpuinfo | grep svm
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse  sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 
3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy misalignsse 
ts fid vid ttp tm stc 100mhzsteps
[root ~]#  yum install kvm qemu
[root ~]#  modprobe kvm-amd
[root ~]#  qemu-kvm -m 1024 -cdrom new-xs163.iso

9. Finally, we are ready to burn the ISO to a CD. You can use any graphical program, or use the wodim command line interface.

[root ~]#  wodim --devices
wodim: Overview of accessible drives (1 found) :
0  dev='/dev/scd0'     rwrw-- : 'ATAPI' 'DVD A  DH20A4H'
[root ~]#  cdrecord -v -dao -eject speed=4 dev=/dev/scd0 new-xs163.iso

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
OLPC wiki
In other languages