Subject: Re: Modifying BBC's
From: ascott <[email-masked]>
To: "Bruce Q. Simmons" <[email-masked]>
Cc: <[email-masked]>
Date: Wed, 27 Mar 2002 12:20:16 -0800 (PST)

On Tue, 26 Mar 2002, Bruce Q. Simmons wrote:

> OK oh great BBC Gods:
>
> I am looking to add some software to a linux-bbc.  Can anybody offer me
> some instructions on doing this (either online or offline at
> [email-masked]).  I have attempoted several other BBC's and they really
> are difficult and unpredictable.
>
> Any and ALL help would be appreciated!!!!
>
> -Bruce
>

Hi Bruce,

Let's see if I can make this clear and succinct.

If all you want to do is add already compiled binaries to BBC iso, then I
suggest first, booting a BBC, getting it onto the network, starting sshd
and then scping your binaries over to the running BBC and testing to see
if it will run.

If it runs and you want to incorporate it into your own image, here's what
to do.

#####################################################
# aquire an LNX-BBC iso image
mkdir EXPERIMENTING
cd EXPERIMENTING
wget http://xcssa.org/files/lnx-bbc-1.618.iso

# mount the iso as a loopback filesystem
mkdir tmp-cdrom
sudo mount -o loop lnx-bbc-1.618.iso tmp-cdrom/

# extract the big file called "singularity" using the
# "extract_compressed_fs" program provided
cd tmp-cdrom
./extract_compressed_fs singularity > ../UNCOMPRESSED_singularity

# mount that filesystem
cd ..
mkdir tmp-cloop
sudo mount -o loop UNCOMPRESSED_singularity tmp-cloop/

# copy those filesystems to your disk and discard the rest
rsync -plarv tmp-cloop/ cloop/
rsync -plarv tmp-cdrom/ cdrom/
sudo umount tmp-cloop
sudo umount tmp-cdrom
rm UNCOMPRESSED_singularity
rm -r tmp-cloop tmp-cdrom

# Doing an 'ls' in this directory will now look like:
# root@bosc:/home/ascott/EXPERIMENTING$# ls
# cdrom/  cloop/  lnx-bbc-1.618.iso
# root@bosc:/home/ascott/EXPERIMENTING$#
# "cdrom/" has all the contents of the actually iso, as if you copied the
# mounted cdrom itself to a directory (which we actually did)
# "cloop/" has the / of the compressed loop back filesystem

# NOW, go tweak in cloop.
# Put new binaries in bin and needed libs in lib, etc, oh and etc...
:::Insert your own magic here:::
echo "MAGIC HAPPENS!!"

# When you are done tweaking cloop, adding your binaries and suchness,
# generate a new file of approx. 3 times the size of your media (50meg
# media, make a 150meg filesystem, mount *it* in loopback and then rsync
# your contents of cloop onto

# create 150meg file
dd if=/dev/zero of=new-filesystem bs=1024k count=150
# generate a filesystem on the 150meg file
/sbin/mke2fs -i 1024 -m 0 -b 4096 new-filesystem
# mount and copy stuff
mkdir tmp
sudo mount -o loop -t ext2 new-filesystem tmp/
rsync -plarv cloop/ tmp/
sudo umount tmp/
rm -rf tmp/

# Some more magic happens next:
# Rusty Russle originally wrote this utility that Klaus Knopper has been
# taking care of late, that you will need to download and install.
# It includes the programs "create_compressed_fs" and
# "extract_compressed_fs", as well as the cloop.o module (which gets
# loaded into the kernel while the disk is booting).  You'll need it
# to compress the filesystem for the BBC

# download and compile cloop sources
wget http://www.knopper.net/download/knoppix/cloop_0.63-2.tar.gz
tar -xvzf cloop_0.63-2.tar.gz && cd cloop-0.63
make KERNEL_DIR=/usr/src/linux # (or wherever you keep your kernel source)

# note: there are more instructions here for installing the resulting
# cloop.o module to your local system or bootable image, but this is not
# needed for the intent of these instructions.

# You should now have a copy create_compressed_fs available

# compress your filesystem
cp create_compressed_fs ../
cd ../
./create_compressed_fs new-filesystem 16384 2>&1 > new-singularity
# 16384 is blocksize in bytes
cp -f new-singularity cdrom/singularity
chmod a+x cdrom/singularity

# Now make a new bootable iso out of your "cdrom/" directory
/sbin/mkisofs -v -d -N -D -R -T -c boot.catalog -b lnx.img -A "Linux" -V
"LNX" -P "version_1.618_modified" -o new_bbc.iso
###################################

The process above is only one way to go about generating a custom iso.  I
do nothing to mention all the various scripts that have been created to
simplify this process.  Nor, do I pretend to go into all the very
interesting and valid discussions about how to make more efficient isos by
changing blocksizes, inode counts, using different filesystems, etc...

If you don't know what all the commands are and the options (especially
that bizarro mkisofs (not bizarro to me) command that I ganked from the
"create_iso" script that the early developers had pioneered years ago),
please spend some time looking them up in man pages, because doing so will
be a very quick way to learn what is going on and why certain things are
done the way they are done!  You can learn a lot from a man page.

I hope this is useful to someone.  Let me know if you have any questions.

-Andrew