Appendix C: Hiding CD Shell Files OUTDATED INFORMATION! site map

Introduction
CD Shell requires a lot of files to be placed on a CD. These files, which are only required during boot-time, can clutter up an otherwise neat file layout. This guide will show you how to hide these files so that they are available to boot the disc, and virtually unnoticable afterwards. This technique requires CD Shell 2.0.8 or newer, the command-line tool mkisofs, a hex-editor, and some basic math ability.

Two Separate File Systems
We will have to make two separate ISOs for this to work: a Main ISO containing the files you want to be able to access, and a Boot ISO containing CD Shell and its support files. (ie. scripts, images, etc...)

Main ISO
You can create your main ISO using any tool: mkisofs, CDImage, Nero, or whatever. Just make it bootable as usual using the CD Shell loader. The only difference we will make on this ISO is to leave out the /boot folder. We will include that folder in the Boot ISO. An example mkisofs command line for this step follows. It assumes you have loader.bin in the root of the filesystem, and that filesystem lies in a folder called 'main_files'.

mkisofs -b loader.bin -hide loader.bin -no-emul-boot -boot-load-size 4 -l -o main.iso main_files

Get the exact byte-granular size of the produced ISO file and divide it by 2048. Write the result down and save it for the next step.


Boot ISO
Now we will need to create the Boot ISO. For this we will need to use mkisofs. This ISO will contain the /boot folder, and all the files needed at boot-time. Note that these will be the only files visible to CD Shell during booting, and they will be invisible at any other time. Below is an example mkisofs command line. It assumes that your filesystem lies in a folder called 'boot_files'. The number "80" should be replaced with the result you got from the previous step (ISO_size / 2048).

mkisofs -l -C 0,80 -o boot.iso boot_files

Patching the Main ISO
Now we need to patch the Main ISO. You will need to find the start of the CD Shell loader.bin file. Using a hex editor, try searching for "cdsh.bin" from the start of the iso image. From the start of the string "cdsh.bin", advance 32 bytes (you should be at the start of a line, two lines down from "cdsh.bin").

In this example, you would modify bytes 19FF0-19FF3:

19F80: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19F90: 2F 62 6F 6F 74 00 00 00  00 00 00 00 00 00 00 00 /boot...........
19FA0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FB0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FC0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FD0: 63 64 73 68 2E 62 69 6E  00 00 00 00 00 00 00 00 cdsh.bin........
19FE0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FF0: 10 00 00 00 00 00 00 10  00 00 00 10 00 05 00 00 ................

Now the next four bytes, which should be 10 00 00 00, need to be patched with the location of the Primary Volume Descriptor of the Boot ISO. This is typically the 16th sector into the ISO, so add 16 to the result you obtained above (to follow the example: 80 + 16 = 96). Now convert this number into 32-bit hexadecimal, and use it to patch the four bytes. Be sure to observe little-endian-ness. Here is an example of a large number being converted:

(The size of main.iso for this example is 614,400,000 bytes)
614,400,000 bytes / 2048 bytes-per-sector = 300,000 sectors
300,000 sectors + 16 sectors = 300,016
300,016 -> Hex = 0x000493F0
0x000493F0 -> Little Endian = F0 93 04 00

After patching:

19F80: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19F90: 2F 62 6F 6F 74 00 00 00  00 00 00 00 00 00 00 00 /boot...........
19FA0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FB0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FC0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FD0: 63 64 73 68 2E 62 69 6E  00 00 00 00 00 00 00 00 cdsh.bin........
19FE0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ................
19FF0: F0 93 04 00 00 00 00 10  00 00 00 10 00 05 00 00 ð“ .............

Finally, we will merge the two ISOs together. In DOS/Windows this can be achieved by using the following command:

copy /B main.iso + /B boot.iso /B full.iso

Now test full.iso if you want to using BOCHS, Virtual PC, or VMware to make sure it works. If so then burn your CD or DVD and off you go.


- Previous - - Next -