On Wed, 2003-10-29 at 20:11, Charles Steinkuehler wrote:
> Typically, you don't 'dd' an image onto a CF card.  You would normally 
> treat the CF card as a hard-disk.  Once you partition & format a 
> suitable area of the CF card, you can copy the syslinux boot-loader and 
> the files that make up the LEAF distribution you want to use.

 Hmm. But it's a lot handier to use 'dd' than anything else. I used to
work for a company called Antefacto; we did our own linux distro (based
on redhat 7.2, I think), that had a nice build script. Pretty much;

 dd if=/dev/zero of=$IMAGE_FILE bs=1024 count=62720 2> /dev/null
 echo "
x
c
245
h
16
s
32
r
n
p
1
                                                                                       
                                                
+2288k
n
p
2
                                                                                       
                                                
                                                                                       
                                                
w
" | fdisk $IMAGE_FILE 

mkdir /mnt/image
mkdir /mnt/image/rescue
echo "Making blank, formatted and tuned partitions"
dd if=/dev/zero of=/tmp/hda1 bs=1024 count=2288 2> /dev/null
dd if=/dev/zero of=/tmp/hda2 bs=1024 count=60416 2> /dev/null
mkfs -F -m0 /tmp/hda1 2> /dev/null > /dev/null
mkfs -F -m0 /tmp/hda2 2> /dev/null > /dev/null
tune2fs -c 0 /tmp/hda1 2> /dev/null > /dev/null
tune2fs -c 0 /tmp/hda2 2> /dev/null > /dev/null
mount -o loop /tmp/hda1 /mnt/image_hda1
mount -o loop /tmp/hda2 /mnt/image_hda2
MOUNT_POINT=/tmp/os_root
KERNEL_VERSION=`echo $MOUNT_POINT/boot/System.map-* | cut -d '-' -f 2-`
(cd $MOUNT_POINT && tar cf - . ) | (cd /mnt/image_hda2 && tar xf - ) 
export BUILD_DIR=`pwd`
(cd /mnt/image_hda1 && tar xzf ${BUILD_DIR}/rescue.tar.gz)
chroot /mnt/image_hda2 rpm --rebuilddb
umount /mnt/image_hda1
umount /mnt/image_hda2
fsck -p -f -y /tmp/hda1
fsck -p -f -y /tmp/hda2
# Put the two images into the IMAGE file
echo "Installing blank partitions into Flash Image"
hda1_offset_blocks="16"
hda2_offset_blocks="2304"
dd if=/tmp/hda1 of=$IMAGE_FILE seek=$hda1_offset_blocks bs=1024
dd if=/tmp/hda2 of=$IMAGE_FILE seek=$hda2_offset_blocks bs=1024
hda2_offset_bytes="2359296"
hda1_offset_bytes="16384"
losetup -o $hda2_offset_bytes /dev/loop6 $WORKING_FILE
losetup -o $hda1_offset_bytes /dev/loop7 $WORKING_FILE
mount -t ext2 /dev/loop6 /mnt/image_hda2
mount -t ext2 /dev/loop7 /mnt/image_hda2/mnt
losetup -d /dev/loop5  2> /dev/null
losetup /dev/loop5 $WORKING_FILE
lilo -C ./lilo.conf

 Where hda1 was to be a 2M "rescue" partition, with the kernel, and
enough smarts to download a new hda2 if stuff broke. Quite cute, really.
We had the OS changed to run the flash read-only (/var was tmpfs, synced
with an archive in / intermittently).

 And ta-da, you have a bootable 64MB image that can be put on a flash
card with "dd". No messing with tarballs etc. and it compresses really
well if there aren't 64MB of files on it. I'd like to something like
that for leaf, if there was interest. I need it for some quagga-based
routers I'm building anyway. I'm still hunting down the bits & pieces I
need, but if someone had a tarball of LEAF with working quagga binaries,
that would be a start.

> Normally, the main thing you'll need to tweak is the kernel command line 
> (to tell LEAF where to find it's packages, since you're not booting off 
> the floppy disk), and possibly load the proper drivers for your CF card 
> (typically just the IDE drivers, if they're not compiled into the 
> kernel).  The instruction for installing your chosen LEAF varient (I 
> suggest Bering) on a hard-disk are a good starting point, and you can 
> post to the list if you run into any problems.

 OK, will do. Thanks.

John



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to