#topicpath
*Building my own LiveCD [#c44ace42]

#contents

**Requisites and Conditions [#u914b001]
-Requisites
--Normal OpenBSD Installation ... same version as target ISO
---extracted kernel source tree (in case of rebuild kernel)
--[[The build tool of FuguIta>http://mirror.ginzado.ne.jp/pub/FuguIta/tools/]]
--Whole OpenBSD file tree which will be burned in the ISO image.

-Conditions
--OpenBSD version of build and target environment must be the same.
--All operations should be done by root.

**Build instructions [#webf6052]
Following example takes working directory as ''/tools-5.8'' .

***Extracting build tools [#n3e483f1]
 # cd /root
 # ftp http://mirror.ginzado.ne.jp/pub/FuguIta/tools/tools-5.8.tar.xz
 Trying 110.92.1.251...
 Requesting http://mirror.ginzado.ne.jp/pub/FuguIta/tools/tools-5.8.tar.xz
 100% |**************************************************| 12091 KB    00:06    
 12381448 bytes received in 6.20 seconds (1.90 MB/s)
 # export PKG_PATH=ftp://ftp.jaist.ac.jp/pub/OpenBSD/5.8/packages/i386/
 # pkg_add xz
 quirks-2.54 signed on 2015-03-09T11:04:08Z
 quirks-2.54 (extracting)|*************************************************|100%
 quirks-2.54 (installing)|*************************************************|100%
    xz-5.2.0 (extracting)|*************************************************|100%
    xz-5.2.0 (installing)|*************************************************|100%
 # xz -dc tools-5.8.tar.xz  | tar xf -
 # mv tools-5.8  /tools-5.8
 # cd /tools-5.8
 # ls -l
 total 51264
 -rw-r--r--   1 root  wheel       5366 Apr  4 06:18 Makefile
 lrwxr-xr-x   1 root  1000          35 Oct 21  2013 bsd.mp.orig -> sys/arch/i386/compile/RDROOT.MP/bsd
 lrwxr-xr-x   1 root  1000          32 Oct 21  2013 bsd.orig -> sys/arch/i386/compile/RDROOT/bsd
 drwxr-xr-x   2 root  wheel        512 May  1 16:43 fuguita
 drwxr-xr-x   5 root  wheel        512 Apr  6 14:51 lib
 drwxr-xr-x   2 root  wheel        512 Sep 28  2012 media
 -rw-r--r--   1 root  wheel  734003200 May 11 17:57 media.img
 drwxr-xr-x   2 root  wheel        512 Oct  6  2010 rdroot
 -rw-r--r--   1 root  wheel    1945600 Apr 28 23:47 rdroot.img
 drwxr-xr-x  26 root  wheel        512 May 12 10:56 sys

***Rebuilding kenrel (optional) [#xd7008a5]
If you wish modify LiveCD's kernel, perform steps described in this section;

Extract and compile kernels (SP and MP)
 # cd /usr/src
 # ftp ftp://ftp.jaist.ac.jp/pub/OpenBSD/5.8/sys.tar.gz
 Connected to ftp.jaist.ac.jp.
 220 (vsFTPd 3.0.2)
 331 Please specify the password.
 230-Welcome to JAIST Public Mirror Service (ftp.jaist.ac.jp).
 230-If you have any problem, please contact ftp-admin@jaist.ac.jp.
 230 Login successful.
 Remote system type is UNIX.
 Using binary mode to transfer files.
 200 Switching to Binary mode.
 250 Directory successfully changed.
 Retrieving pub/OpenBSD/5.8/sys.tar.gz
 local: sys.tar.gz remote: sys.tar.gz
 150 Opening BINARY mode data connection for sys.tar.gz (20483072 bytes).
 100% |**************************************************| 20003 KB    00:05    
 226 Transfer complete.
 20483072 bytes received in 5.51 seconds (3.55 MB/s)
 221 Goodbye.
 # tar xzf sys.tar.gz
 # cd /tools-5.8/sys/arch/i386/conf
 # ls -l
 total 0
 lrwxr-xr-x  1 root  wheel  35 May 12 10:55 GENERIC -> /usr/src/sys/arch/i386/conf/GENERIC
 lrwxr-xr-x  1 root  wheel  38 May 12 10:55 GENERIC.MP -> /usr/src/sys/arch/i386/conf/GENERIC.MP
 lrwxr-xr-x  1 root  wheel  41 May 12 10:55 Makefile.i386 -> /usr/src/sys/arch/i386/conf/Makefile.i386
 lrwxr-xr-x  1 root  wheel  35 May 12 10:55 RAMDISK -> /usr/src/sys/arch/i386/conf/RAMDISK
 lrwxr-xr-x  1 root  wheel  38 May 12 10:55 RAMDISK_CD -> /usr/src/sys/arch/i386/conf/RAMDISK_CD
 lrwxr-xr-x  1 root  wheel  22 May 11 16:07 RDROOT -> ../../../../lib/RDROOT
 lrwxr-xr-x  1 root  wheel  25 May 11 16:07 RDROOT.MP -> ../../../../lib/RDROOT.MP
 lrwxr-xr-x  1 root  wheel  38 May 12 10:55 files.i386 -> /usr/src/sys/arch/i386/conf/files.i386
 # config RDROOT 
 Kernel options have changed -- you must run "make clean"
 # config RDROOT.MP  
 Kernel options have changed -- you must run "make clean"
 # cd ../compile/RDROOT 
 # make clean; make depend; make
 # cd ../RDROOT.MP
 # make clean; make depend; make

Merge mini root filesystem into compiled kernels
 # cd /tools-5.8
 # make open-media
 # make boot
 # make close-all

***Copy and setup all files and directories burned in [#o386a00d]
Note: For usbfadm utility, rsync and rlwrap might be package-added at them.
 # cd /tools-5.8
 # make open-media
 vnconfig vnd1 media.img
 mount /dev/vnd1a media
 # make open-fuguita
 vnconfig vnd2 media/fuguita.ffsimg
 mount /dev/vnd2a fuguita
 # df -h
 Filesystem     Size    Used   Avail Capacity  Mounted on
 /dev/wd0a     17.4G    703M   15.8G     4%    /
 /dev/vnd1a     700M    697M    2.7M   100%    /tools-5.8/media
 /dev/vnd2a     676M    512B    676M     0%    /tools-5.8/fuguita
 # cd TOP-OF-FILETREE-TO-BE-BURNED-IN
 # pax -rwpe . /tools-5.8/fuguita/.
 ./tools-5.8/fuguita/./.cshrc
 ./tools-5.8/fuguita/./.profile
 ./tools-5.8/fuguita/./altroot
 ./tools-5.8/fuguita/./bin
 ./tools-5.8/fuguita/./bin/[
       :
     (snip)
       :
 ./tools-5.8/fuguita/./var/cache/fontconfig/CACHEDIR.TAG
 ./tools-5.8/fuguita/./var/cache/fontconfig/a1a78d9c18cd095d3829c724810e6ffb-le32d8.cache-4
 ./tools-5.8/fuguita/./var/cache/fontconfig/ba022efc551c75e21c690774bbcf5304-le32d8.cache-4
 ./tools-5.8/fuguita/./var/cache/fontconfig/bc06c1eea3e636f72101cafc3fb39508-le32d8.cache-4
 ./tools-5.8/fuguita/./var/cache/fontconfig/c5f5d66d15c24edc3e863c27139db87e-le32d8.cache-4
 ./tools-5.8/fuguita/./var/cache/fontconfig/f22309b238134d3cca63435f528976cd-le32d8.cache-4
 # cd /tools-5.8/fuguita
 # ls -l
 total 56
 -rw-r--r--   1 root  wheel    578 Mar  9 01:51 .cshrc
 -rw-r--r--   1 root  wheel    468 Mar  9 01:51 .profile
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 altroot
 drwxr-xr-x   2 root  wheel   1024 Mar  9 01:52 bin
 drwxr-xr-x   3 root  wheel  19456 Jun  3 00:27 dev
 drwxr-xr-x  22 root  wheel   1536 Jun  3 00:18 etc
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 home
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 mnt
 drwx------   2 root  wheel    512 Jun  3 00:37 root
 drwxr-xr-x   2 root  wheel   1536 Mar  9 01:52 sbin
 drwxrwxrwt   6 root  wheel    512 Jun  3 00:37 tmp
 drwxr-xr-x  16 root  wheel    512 Mar  7 20:04 usr
 drwxr-xr-x  21 root  wheel    512 Mar  7 20:04 var

Remove unused files
 # (remove stale files ... for example ... /tmp/*, /home/*, /var/run/*.pid, etc...)
 # (zeroed log files under /var/log/*)

Make /usr/fuguita/* directories ... They are required that FuguIta can detect himself.
 # mkdir -p /tools-5.8/fuguita/usr/fuguita/{bin,doc,include,lib,libexec,sbin,share,var}
 # cp -p /tools-5.8/lib/{compress_man.sh,gen_mode0sldir}  /tools-5.8/fuguita/usr/fuguita/sbin/.
 # ln -s /boottmp/usbfadm /tools-5.8/fuguita/usr/fuguita/sbin/usbfadm
 # ln -s /boottmp/fdadm /tools-5.8/fuguita/usr/fuguita/sbin/fdadm

***Create the ISO image [#vc16beaf]
 # cd /tools-5.8
 # ls -l
 total 1087485
 -rw-r--r--   1 root  wheel       5366 Apr  4 06:18 Makefile
 lrwxr-xr-x   1 root  1000          35 Oct 21  2013 bsd.mp.orig -> sys/arch/i386/compile/RDROOT.MP/bsd
 lrwxr-xr-x   1 root  1000          32 Oct 21  2013 bsd.orig -> sys/arch/i386/compile/RDROOT/bsd
 drwxr-xr-x  13 root  wheel        512 Jun  3 00:56 fuguita
 drwxr-xr-x   5 root  wheel        512 Apr  6 14:51 lib
 drwxr-xr-x   3 root  wheel        512 Apr 14  2012 media
 -rw-r--r--   1 root  wheel  734003200 Jun  3 00:59 media.img
 drwxr-xr-x   2 root  wheel        512 Oct  6  2010 rdroot
 -rw-r--r--   1 root  wheel    1945600 Apr 28 23:47 rdroot.img
 drwxr-xr-x  26 root  wheel        512 May 12 10:56 sys
 # ls -l /tools-5.8/media 
 total 1427752
 -r-xr-xr-x  1 root  bin        71452 Apr  4 09:52 boot
 -rwxr--r--  1 root  wheel       2048 May 11 02:08 boot.catalog
 -rw-r--r--  1 root  wheel    5605482 May  9 19:52 bsd-fi
 -rw-r--r--  1 root  wheel    5614117 May  9 19:53 bsd-fi.mp
 -r-xr-xr-x  1 root  wheel      72328 May  9 19:53 cdboot
 -r-xr-xr-x  1 root  wheel       2048 May  9 19:53 cdbr
 drwxr-xr-x  2 root  wheel        512 Apr 18  2014 etc
 -rw-r--r--  1 root  wheel  719388672 Jun  3 00:59 fuguita.ffsimg
 # cd /tools-5.8
 # ls -l fuguita
 total 56
 -rw-r--r--   1 root  wheel    578 Mar  9 01:51 .cshrc
 -rw-r--r--   1 root  wheel    468 Mar  9 01:51 .profile
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 altroot
 drwxr-xr-x   2 root  wheel   1024 Mar  9 01:52 bin
 drwxr-xr-x   3 root  wheel  19456 Jun  3 00:27 dev
 drwxr-xr-x  22 root  wheel   1536 Jun  3 00:18 etc
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 home
 drwxr-xr-x   2 root  wheel    512 Mar  9 01:51 mnt
 drwx------   2 root  wheel    512 Jun  3 00:57 root
 drwxr-xr-x   2 root  wheel   1536 Mar  9 01:52 sbin
 drwxrwxrwt   6 root  wheel    512 Jun  3 00:37 tmp
 drwxr-xr-x  16 root  wheel    512 Mar  7 20:04 usr
 drwxr-xr-x  21 root  wheel    512 Mar  7 20:04 var

Close filetree on FuguIta Live System
 # make close-fuguita
 umount fuguita
 vnconfig -u vnd2

Do mkhybrid
 # make hyb
 make open-fuguita
 vnconfig vnd2 media/fuguita.ffsimg
 mount /dev/vnd2a fuguita
 echo "5.8-20150603$((0+1))" > fuguita/usr/fuguita/version
 make close-fuguita
 umount fuguita
 vnconfig -u vnd2
 mkhybrid -a -R -L -l -d -D -N  -o livecd.iso  -v -v  -A "FuguIta - OpenBSD LiveCD"  -P "Copyright (c)
 `date +%Y` KAWAMATA Yoshihiro"  -p "KAWAMATA Yoshihiro, http://fuguita.org/?FuguIta"  -V "FuguIta-5.8
 -20150603$((0+1))"  -b cdbr  -c boot.catalog  media  && echo $((0+1)) > revcount_cdmaster
 mkhybrid 1.12b5.1
 Scanning media
 Scanning media/etc
   23  1202 
   24   456 etc
 Cache hit for /..
 26 60 media/boot
 61 61 media/boot.catalog
 62 2799 media/bsd-fi
 2800 5541 media/bsd-fi.mp
 5542 5577 media/cdboot
 5578 5578 media/cdbr
 5579 356842 media/fuguita.ffsimg
 Cache hit for etc/.
 Cache hit for etc/..
 356843 356843 media/etc/boot.conf
 356844 356844 media/etc/random.seed
 
 Size of boot image is 4 sectors -> No-emulation CD boot sector
 Total extents scheduled to be written = 356845
   1.40% done, estimate finish Wed Jun  3 01:10:36 2015
   2.81% done, estimate finish Wed Jun  3 01:08:14 2015
     :
   (snip)
     :
  98.08% done, estimate finish Wed Jun  3 01:14:35 2015
  99.48% done, estimate finish Wed Jun  3 01:14:27 2015
 Total translation table size: 0
 Total rockridge attributes bytes: 1101
 Total directory bytes: 2048
 Path table size(bytes): 22
 Max brk space used 0
 356845 extents written (696 Mb)

Close all image files
 # make close-all
 umount fuguita
 umount: fuguita: not currently mounted
 *** Error 1 in target 'close-fuguita' (ignored)
 vnconfig -u vnd2
 vnconfig: VNDIOCCLR: Device not configured
 *** Error 1 in target 'close-fuguita' (ignored)
 umount media
 vnconfig -u vnd1
 umount rdroot
 umount: rdroot: not currently mounted
 *** Error 1 in target 'close-rdroot' (ignored)
 vnconfig -u vnd0
 vnconfig: VNDIOCCLR: Device not configured
 *** Error 1 in target 'close-rdroot' (ignored)
 # ls -l
 total 2515268
 -rw-r--r--   1 root  wheel       5366 Apr  4 06:18 Makefile
 lrwxr-xr-x   1 root  1000          35 Oct 21  2013 bsd.mp.orig -> sys/arch/i386/compile/RDROOT.MP/bsd
 lrwxr-xr-x   1 root  1000          32 Oct 21  2013 bsd.orig -> sys/arch/i386/compile/RDROOT/bsd
 drwxr-xr-x   2 root  wheel        512 May  1 16:43 fuguita
 drwxr-xr-x   5 root  wheel        512 Apr  6 14:51 lib
 -rw-r--r--   1 root  wheel  730818560 Jun  3 01:14 livecd.iso
 drwxr-xr-x   2 root  wheel        512 Sep 28  2012 media
 -rw-r--r--   1 root  wheel  734003200 Jun  3 01:21 media.img
 drwxr-xr-x   2 root  wheel        512 Oct  6  2010 rdroot
 -rw-r--r--   1 root  wheel    1945600 Apr 28 23:47 rdroot.img
 -rw-r--r--   1 root  wheel          2 Jun  3 01:14 revcount_cdmaster
 drwxr-xr-x  26 root  wheel        512 May 12 10:56 sys

That's all. ~
''livecd.iso'' is the ISO image file.

----
#topicpath


Front page   New Page list Search Recent changes   Help   RSS of recent changes