Creating bootable compact flash

13 views
Skip to first unread message

brich

unread,
Jan 14, 2009, 10:47:23 PM1/14/09
to pyramidlinux
I've inherited a Soekirs 4521 with Pyramid Linux on a 256MB compact
flash card. I'm trying to back up the existing image before starting
modifications.

I copied the image from the 256 MB compact flash card as follows:

# dd if=/dev/sdb1 of=image.img

I then copied the image to a new 512 MB compact flash card as follows:

# dd if=image256M.img of=/dev/sdb1 bs=512

All commands complete without errors. When attempting to boot off the
new 512 MB card, the following error occurs:

Non-System disk or disk error.
Replace and press any key when ready

Can some provide guidance on what I'm doing wrong?

Thanks in advance.

John Otto

unread,
Jan 14, 2009, 10:54:20 PM1/14/09
to pyrami...@googlegroups.com
/dev/sdb1 refers to the first partition on the card, while /dev/sdb
would give you access to the whole device.

If you want to make a backup, use /dev/sdb as the input file, and then
you'll backup the partition table, as well as the sdb1 partition.
Likewise, when copying to the new card, copy it to /dev/sdb--not
/dev/sdb1.

Hope this helps,
John

JohnC

unread,
Jan 15, 2009, 8:21:51 AM1/15/09
to pyramidlinux
This would be the correct way to write the image to the CF. dd
if=pyramid-1.0b1.img of=/dev/sdb bs=512
Then to resize the partition to use the full CF adjust the partition
size with parted
Then resize the files ystem with this command resize2fs -p /dev/sdb1

This s to be done with the card still installed in the system you dd'd
the image on.

Some CF cards have issues with being detected as master or slave, but
this is related to the 4801 and 550. I just thought I would add this
as a semi relatable piece of information. Here is a excerpt from the
original post on this issue.
"There has been reports of certain CF modules turns up as slave, or
don't work together with a HD, on Net4801's.

On the net4801, you can change the master/slave selection on the CF
module and harddrive using the cable select pin, as per ATA standard.

The net4801 do that by setting the pin status during post and then
issueing a hard reset by pulsing the ATA RESET pin to get the devices
to reinitialize and sample the cable select pin. Unfortunate some CF
module
do not sample the cable select pin when hard reset, and although the
CF specs are not specific on that, good practice is to reset
everything when reset.... On the net4801, the cable select pin to the
CF module is
pulled high until programmed to it's final value, and some CF modules
apperently only sample that pin during power up and therefore always
defaulting to slave.

Solutions:

CF modules that to not correctly sample the cable select pin during
hard reset should not be used on a net4801. I will make the cable
select pin defauling to low on power up on next revision, that way
those CF modules can still be used, but will then always be master
instead of slave."

Barry A Rich

unread,
Jan 15, 2009, 10:35:58 AM1/15/09
to pyrami...@googlegroups.com
I suspect the image read from the compact flash card is not in the right
format. I used:

# dd if=/dev/sdb1 of=image.img

A good test would be to try the latest Pyramid image file. Unfortunately,
http://dl.metrix.net/support/dist/ is off-line. Any idea when it will be
back on line?

Frank Knox

unread,
Jan 15, 2009, 10:40:50 AM1/15/09
to pyrami...@googlegroups.com
Barry take the 1 out of your dd

It should read

# dd if=/dev/sdb of=image.img

This well dd the whole disk not just the partition.

Barry A Rich

unread,
Jan 15, 2009, 11:05:38 AM1/15/09
to pyrami...@googlegroups.com
That fixed it. Thanks.

brich

unread,
Jan 15, 2009, 2:00:05 PM1/15/09
to pyramidlinux
Maybe this should be a new thread, but I also want to edit the image.
I followed the instructions on http://pyramid.metrix.net/trac/wiki/ModifyImageFile.
When I get to step 7, the contents of ~/metrix looks like this:

[].
boot[]o.[]
lost+fou.nd
rooti[][].[]
?[].var
?v.pro

[] is really a full box. I can't recreate that here.

Any idea why this isn't working?

Thanks.



On Jan 15, 11:05 am, "Barry A Rich" <bar...@trisectrix.com> wrote:
> That fixed it. Thanks.
>
>
>
> > -----Original Message-----
> > From: pyrami...@googlegroups.com [mailto:pyrami...@googlegroups.com]
> On
> > Behalf Of Frank Knox
> > Sent: Thursday, January 15, 2009 10:41 AM
> > To: pyrami...@googlegroups.com
> > Subject: RE: Creating bootable compact flash
>
> > Barry take the 1 out of your dd
>
> > It should read
>
> >            # dd if=/dev/sdb of=image.img
>
> > This well dd the whole disk not just the partition.
>
> > -----Original Message-----
> > From: pyrami...@googlegroups.com [mailto:pyrami...@googlegroups.com]
> > On Behalf Of Barry A Rich
> > Sent: Thursday, January 15, 2009 10:36 AM
> > To: pyrami...@googlegroups.com
> > Subject: RE: Creating bootable compact flash
>
> > I suspect the image read from the compact flash card is not in the right
> > format. I used:
>
> > # dd if=/dev/sdb1 of=image.img
>
> > A good test would be to try the latest Pyramid image file. Unfortunately,
> >http://dl.metrix.net/support/dist/is off-line. Any idea when it will be

Frank Knox

unread,
Jan 15, 2009, 7:03:09 PM1/15/09
to pyrami...@googlegroups.com
The instructions work fine,

Some crazy things might happen if your system automatically mounts the cf
card.

So you should umount /dev/sdb1 before you start, then do e2fsck /dev/sdb1

Follow the directions again.

You should see all the good stuff under /mnt/metrix

If you still have problems let me know.

Frank

brich

unread,
Jan 16, 2009, 5:16:10 AM1/16/09
to pyramidlinux
I'm a little confused. The instructions operate on the img file on the
PC (not on the compact flash card). The CF card is not mounted or used
by the instructions.


On Jan 15, 7:03 pm, "Frank Knox" <fk...@csspi.com> wrote:
> The instructions work fine,
>
> Some crazy things might happen if your system automatically mounts the cf
> card.
>
> So you should umount /dev/sdb1 before you start, then do e2fsck /dev/sdb1
>
> Follow the directions again.
>
> You should see all the good stuff under /mnt/metrix
>
> If you still have problems let me know.
>
> Frank
>
> -----Original Message-----
> From: pyrami...@googlegroups.com [mailto:pyrami...@googlegroups.com]
>
> On Behalf Of brich
> Sent: Thursday, January 15, 2009 2:00 PM
> To: pyramidlinux
> Subject: Re: Creating bootable compact flash
>
> Maybe this should be a new thread, but I also want to edit the image.
> I followed the instructions onhttp://pyramid.metrix.net/trac/wiki/ModifyImageFile.
> > >http://dl.metrix.net/support/dist/isoff-line. Any idea when it will be

Frank Knox

unread,
Jan 16, 2009, 10:08:18 AM1/16/09
to pyrami...@googlegroups.com
My bad,

This might help.

Make a directory /home/images
Make a directory /mnt/birch

Put your image.img into the /home/images directory
Now do

sudo losetup -o 16384 /dev/loop0 /home/images/image.img

then

sudo mount /dev/loop0 /mnt/birch

now cd to /mnt/birch and you should see everything.
(Just remember when copying files to your image that its /mnt/birch/"then
the file system")

To Unmount

sudo umount /mnt/birch

sudo losetup -d /dev/loop0

brich

unread,
Jan 16, 2009, 6:58:53 PM1/16/09
to pyramidlinux
Your instruction are pretty much what's described on:

http://pyramid.metrix.net/trac/wiki/ModifyImageFile

The results are the same:

brich@lws2:/home$ sudo mkdir images
brich@lws2:/home$ sudo chmod 777 images
brich@lws2:/home$ cd images
brich@lws2:/home/images$ cp /home/brich/temp/image256M.img .
brich@lws2:/home/images$ sudo mkdir /mnt/brich
brich@lws2:/home/images$ sudo chmod 777 /mnt/brich
brich@lws2:/home/images$ sudo losetup -o 16384 /dev/loop0 /home/images/
image256M.img
brich@lws2:/home/images$ sudo mount /dev/loop0 /mnt/brich
brich@lws2:/home/images$ cd /mnt/brich
brich@lws2:/mnt/brich$ ll
ls: cannot access ..: No such file or directory
ls: cannot access
.q/: No such file or directory
ls: cannot access
..: No such file or directory
total 155392
drwxr-xr-x 2 root root 16384 1969-12-31 19:00 .
drwxr-xr-x 3 root root 4096 2009-01-16 18:53 ..
-????????? ? ? ? ? ? ?..
-????????? ? ? ? ? ? ?..
-rwxr-xr-x 1 root root 7500661 1980-01-13 00:00 ?.?
-rwxr-xr-x 1 root root 40481 1902-01-27 17:47 boot?o.?
-rwxr-xr-x 1 root root 33816588 1991-01-25 00:03 lost+fou.nd
-????????? ? ? ? ? ? ?.q/
-rwxr-xr-x 1 root root 26313 2029-03-19 01:16 rooti?.?
-rwxr-xr-x 1 root root 0 1980-01-01 00:00 ??.var
-r-xr-xr-x 1 root root 117702668 1980-01-13 00:00 ?v.pro

Frank Knox

unread,
Jan 16, 2009, 7:42:28 PM1/16/09
to pyrami...@googlegroups.com
Looks like the image is corrupted.

Frank Knox

unread,
Jan 16, 2009, 8:00:31 PM1/16/09
to pyrami...@googlegroups.com
You can always use the script we use here (not really a script but it works)
Make a file call and call it what ever you want. Ours is called
getthatimage.sh

-------------------------------------
#!/bin/sh

#makeing image from cf-disk on /dev/sdb
/bin/umount /dev/sdb1
/sbin/e2fsck /dev/sdb1
/bin/mkdir /home/admin/images
/bin/mkdir /mnt/myimage
/bin/dd if=/dev/sdb of=/home/admin/images/image.img
#mounting the image for editing
/sbin/losetup -o 16384 /dev/loop0 /home/admin/images/image.img
/bin/mount /dev/loop0 /mnt/myimage
cd /mnt/myimage
/bin/ls


---------------------------------------
Make this executable and run the file, we run breezy


Hope this works for you

brich

unread,
Jan 17, 2009, 11:56:06 AM1/17/09
to pyramidlinux
The results are the same (below). The e2fsck did find a couple of
errors and fixed them.

Just to be sure, I tried booting the Soekris board with the CF card
after the errors were corrected. It worked fine.

Could this be a problem with kernel versions? I'm running Ubuntu
8.04.1 (2.6.24-22). The Pyramid kernel is 2.6.19.2.


root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# umount /dev/sdb1
umount: /dev/sdb1: not mounted
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# e2fsck /dev/sdb1
e2fsck 1.40.8 (13-Mar-2008)
/dev/sdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 8224, i_blocks is 20, should be 4. Fix<y>? yes

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(35598--35599)
Fix<y>? yes

Free blocks count wrong for group #4 (6864, counted=6866).
Fix<y>? yes

Free blocks count wrong (187773, counted=187775).
Fix<y>? yes


/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 2199/62744 files (0.6% non-contiguous), 62321/250096 blocks
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# mkdir /home/
admin
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# mkdir /home/
admin/images
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# mkdir /mnt/
myimage
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# dd if=/dev/sdb
of=/home/admin/images/image.img
1000944+0 records in
1000944+0 records out
512483328 bytes (512 MB) copied, 88.3145 s, 5.8 MB/s
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# losetup -o
16384 /dev/loop0 /home/admin/images/image.img
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# mount /dev/
loop0 /mnt/myimage
root@lws2:/home/brich/dev/AirLynx/Scripts/CF Scripts# cd /mnt/myimage
root@lws2:/mnt/myimage# ls
ls: cannot access ..: No such file or directory
ls: cannot access
.q/: No such file or directory
ls: cannot access
..: No such file or directory
?.. ?.. ?.? boot?o.? lost+fou.nd ?.q/ rooti?.? ??.var ?v.pro

brich

unread,
Jan 17, 2009, 3:30:10 PM1/17/09
to pyramidlinux
The Pyramid images are back on-line. I downloaded the latest and tried
it. The procedures work fine and the image can be modified.

Uncompressed, the downloaded image is about 61MB. The image read off
the CF is 256MB. Could that be causing the problem?

Thanks.
> ...
>
> read more »

Frank Knox

unread,
Jan 17, 2009, 3:52:13 PM1/17/09
to pyrami...@googlegroups.com
Was the original cf card gparted or resize2fs to fill the 256MB card?

IE did you use the whole 256MB with your last image?

If you decide to make a new cf card with the new image and you want to
expand the disk use gparted it is very easy and visually helpful.

brich

unread,
Jan 17, 2009, 4:00:09 PM1/17/09
to pyramidlinux
Let's call this one solved. I can work with the latest image.
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages