Logo

SPOT  Spot's Perspective On Technology
Colorful talk in black and white shades of grey.

home
site map
admin

dynesdk

2004-05-23 20:13:47

What you will need for this bite-sized example

Overview

Dyne:bolic has lots of power, but you might have some special needs. For example, maybe you want to include some of your own media files so you can take your studio kit into the world with you. Maybe you need to make a few small tweaks to make your system or cluster perform at its best. Depending on your level of experience, reading the Dynebolic Hacker's Guide might be enough to scare you away before you even try. If you are not of the mind to start patching and compiling a new kernel just to get started, here is an idea for you.

Let's use dyne:bolic to build our own dyne:bolic!

This will only work for small changes, as this will not supply gcc or a full development environment. But for many personalizations needs, this is all that is required.

A Working Space

To start out we will need a directory to work in. The ideal situation is to borrow space on an existing Linux box, as you need a real Linux filesystem that handles links and permissions. A swap partition comes in handy, too. Lets create a directory 'sdk', just so we'll have a name to refer to. The sdk directory needs to have about 4 Gig of free space available. If that sounds like a lot, remember, we are going to be working with a 600+ Megabyte highly compressed iso, and to work on it, we need to uncompress it, and then build it back from its pieces.

On the d:b CD, there is a devel directory that contains a script file named dynesdk. Copy the script into your sdk directory. This script contains all the logic required to manipulate the d:b image, so we want it close at hand.

Copy your d:b 1.3 iso to the sdk directory, naming it dynebolic-dev.iso. This copy will be modified during the process. Remember that if you want to keep a pristine iso image.

Extra Tools

d:b already has most of the tools required, but there are two pieces missing, one trivial and one essential. The dnsdomainname command is used to include the building system's name in the CD image. A simple script that just prints a host name will keep dynesdk happy with minimal effort. The mksquashfs command builds the compressed image. Add these two commands to the richness already provided in d:b, and you have everything it takes to modify the image. You can find these in the downloads area. The sdktools.tar.gz file contains both tools. Just download it into your sdk directory, and untar it with:

tar xvzf sdktools.tar.gz

In recap, you should now have a sdk directory that looks like this:

[d:b] /vol/hd2/sdk #ls -l                                                                                     
total 646404
-rw-r--r--    1 root     root        15127 Jan 23  2003 LICENSE.txt
-rw-r--r--    1 root     root          717 May 30 18:26 README.txt
-rwxr--r--    1 root     root          101 Mar 27 22:56 dnsdomainname
-rw-r--r--    1 root     root     661127168 May 30 18:59 dynebolic-dev.iso
-rwxr-xr-x    1 root     root        13735 May 30 18:56 dynesdk
-rwxr--r--    1 root     root        59236 Jan 28 06:05 mksquashfs
-rw-------    1 root     root        32688 May 30 19:01 sdktools.tar.gz

Explode the iso image

Now we are ready to turn the compressed iso image into regular files we can work with. To do this, cd to the sdk directory and issue the command dynesdk expode. This will run for a while, pulling the pieces from the iso image and writing the individual pieces to disk.

[d:b] /vol/hd2/sdk #dynesdk explode                                                                                                                         19:15
[*] dyne:bolic SDK version 0.2 - software development kit
 .  Copyleft 2003 by jaromil - http://dynebolic.org
 .  $Id: dynesdk,v 1.8 2004/03/15 18:00:20 jaromil Exp $
[*] creating a dyne:bolic SDK in .
 .  copying iso contents into ./cdrom (please wait)
 .  generating initrd tree (please wait)
 .  generating home tree
 .  generating var tree
 .  generating usr tree (please wait, this takes long!)
[*] if you don't see errors above, the SDK has been generated!
[*] bye.
zsh: 1675 exit 1     dynesdk explode

Make your changes

The explode process created a set of directories like these:

cdromthe CD contents in file, not iso, form
initrdinitial ram disk image contents
homedefault home directory contents
vardefault var directory contents
tmpdefault empty tmp space
usrthe main dyne:bolic system contents

Make your changes within these directories. This section is intentionally devoid of details, as you are the expert here. You know what you want to accomplish. Explore the d:b tree, apply your Linux knowledge, and gain some more.

Put it back together

Once you have made your changes, you are ready to rebuild the compressed iso image. To do this, cd to the sdk directory and issue the command dynesdk implode. This will run for a long time, as the compression is a very resource intensive activity. Here is a lightly annotated implode session:

[d:b] /vol/hd2/sdk #dynesdk implode                                                                                                                         19:41
[*] dyne:bolic SDK version 0.2 - software development kit
 .  Copyleft 2003 by jaromil - http://dynebolic.org
 .  $Id: dynesdk,v 1.8 2004/03/15 18:00:20 jaromil Exp $
[*] imploding dyne:bolic SDK into a bootable ISO
[*] making the initrd compressed filesystem
 .  setup startup files
[!] no startup files present in ./../startup
 .  generate device file
6000+0 records in
6000+0 records out
 .  formatting filesystem
mke2fs 1.34 (25-Jul-2003)
cdrom/dyne/initrd is not a block special device.
Proceed anyway? (y,n) 

You will need to enter a 'y' here. This is not a block special device because it is a loopback we are building.

Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
6000 inodes, 6000 blocks
0 blocks (0.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
6000 inodes per group

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 .  populating initrd loopback device
 .  tuning filesystem
tune2fs 1.34 (25-Jul-2003)
Setting maximal mount count to -1
Setting interval between check 0 seconds
 .    File: `cdrom/dyne/initrd.gz'
  Size: 1974707         Blocks: 3872       IO Block: 4096   Regular File
Device: 306h/774d       Inode: 114079      Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2004-05-30 19:43:34.000000000 +0200
Modify: 2004-05-30 19:43:34.000000000 +0200
Change: 2004-05-30 19:43:47.000000000 +0200
[*] packaging /home
 .    File: `./cdrom/dyne/home.tgz'
  Size: 1573842         Blocks: 3088       IO Block: 4096   Regular File
Device: 306h/774d       Inode: 114078      Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2004-05-30 19:18:52.000000000 +0200
Modify: 2004-05-30 19:43:50.000000000 +0200
Change: 2004-05-30 19:43:50.000000000 +0200
[*] packaging /var
 .    File: `cdrom/dyne/var.tgz'
  Size: 120861          Blocks: 248        IO Block: 4096   Regular File
Device: 306h/774d       Inode: 114085      Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2004-05-30 19:18:52.000000000 +0200
Modify: 2004-05-30 19:43:51.000000000 +0200
Change: 2004-05-30 19:43:51.000000000 +0200
[*] making the /usr squashed filesystem (please wait, takes long!)
 .  setup startup files
[!] no startup files present in ./../startup
 .  start compressing: Sun May 30 19:43:53 CEST 2004
Creating little endian filesystem on ./cdrom/dyne/dynebol.sys, block size 32768.

Here is the long wait. Be patient, and find something else to do for a while.

 .  end: Sun May 30 20:24:02 CEST 2004
 .    File: `./cdrom/dyne/dynebol.sys'
  Size: 527945728       Blocks: 1032160    IO Block: 4096   Regular File
Device: 306h/774d       Inode: 114075      Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2004-05-30 20:24:01.000000000 +0200
Modify: 2004-05-30 20:24:01.000000000 +0200
Change: 2004-05-30 20:24:02.000000000 +0200
[*] making the dynebolic ISO
Forged on dynebolic00015381F1A9.localdomain the Sun May 30 20:24:02 CEST 2004 
using mkisofs 1.15a39 (i686-pc-linux-gnu) on Linux 2.4.22-dynebolic i686
system version 1.3
ramdisk version 1.3

The gpg section will change based on your own gpg setup. If you have a private gpg key established in your nest, you will be prompted for your passphrase (twice) to sign the system pieces you are building.

gpg: /home/.gnupg: directory created
gpg: new configuration file `/home/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/.gnupg/secring.gpg' created
gpg: keyring `/home/.gnupg/pubring.gpg' created
gpg: no default secret key: secret key not available
gpg: signing failed: secret key not available
gpg: no default secret key: secret key not available
gpg: signing failed: secret key not available
Using LIVE_000.TXT;1 for  ./cdrom/extras/live_in_makrolab.txt (live_in_wien.txt)
Using LIVE_000.MP3;1 for  ./cdrom/extras/live_in_makrolab.mp3 (live_in_wien.mp3)

Size of boot image is 4 sectors -> No emulation
  1.55% done, estimate finish Sun May 30 20:25:30 2004
  3.10% done, estimate finish Sun May 30 20:24:58 2004

<snip>

 97.59% done, estimate finish Sun May 30 20:25:37 2004
 99.13% done, estimate finish Sun May 30 20:25:37 2004
Total translation table size: 2048
Total rockridge attributes bytes: 5611
Total directory bytes: 12288
Path table size(bytes): 82
Max brk space used d000
322800 extents written (630 Mb)
 .    File: `./dynebolic-dev.iso'
  Size: 661094400       Blocks: 1292472    IO Block: 4096   Regular File
Device: 306h/774d       Inode: 619035      Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2004-05-30 19:18:36.000000000 +0200
Modify: 2004-05-30 20:25:37.000000000 +0200
Change: 2004-05-30 20:25:37.000000000 +0200
[*] bye.
zsh: 1725 exit 1     dynesdk implode

Burn the freshly created dynebolic-dev.iso to a CD, and try it out. d:b includes cdrecord and the gcombust interface, just remember to boot with the proper command to enable scsi emulation for your burner. For example: Linux hdc=ide-scsi

Here are a few cost and time saving tips. If your hardware supports booting from a CD-RW disk, you can save a stack full of one time use CD-R's when testing by using a CD-RW disk instead. A Smart Boot Manager floppy can usually convince even the most stuborn system to boot from any CD media. You can also do some testing without burning by using the dynesdk chroot command. You can also use a d:b dock setup booting directly with GRUB or LILO. There is also support in the docking mechanisms to use the sdk directory directly if it is placed in the dyne dock directory. Remember, though, changing the system files underneath a running system is a recipe for disaster, so work out your plan carefully. Depending on the nature of your changes, you might be able to reduce the amount of time required to build the iso. If your changes don't involve the usr directory, you can save lots of time by choosing other options to dynesdk. For example, if you are replacing some of the extras content with your own, you could use dynesdk mkiso to save lots of time to achive the same results. Or, if your changes are to a start up script, you can use dynesdk mkinitrd followed by dynesdk mkiso. Explore your options.

Too much?

Not everyone is ready for this kind of work. If you are, you are one of the few, and should consider yourself specially blessed. You should also consider offering the fruits of your labors back to the d:b community. If you are not of the programming, tinkering mindset, there are other options available. If you have the need for support and customization, consider contracting jaromil and the dyne:bolic team to provide it. They obviously do great work!

Now you've got power. Go create something wonderful!

Article 18 was last updated 2004-06-14 20:23:24

Want to look at how dyne:bolic is put together? Want to make some little tweaks to make it your d:b? This bite-sized example shows you how to get started with the dyne:bolic software developer kit.