Flash full?

I’ve created a flash filesystem with mkefs. My build file contains:

[block_size=128k spare_blocks=1 mount=/flash min_size=16m max_size=16m]

Before I copy the image (along with the boot image) to the flash, I perform
a:

flashctl -p /dev/fs0 -e -l16M

Everything works as expected, except that I cannot add data to the flash
filesystem. The driver reports “disk full”. Any thoughts?

Best regards,
Mike Kadour

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

I’ve created a flash filesystem with mkefs. My build file contains:

[block_size=128k spare_blocks=1 mount=/flash min_size=16m max_size=16m]

Before I copy the image (along with the boot image) to the flash, I perform
a:

flashctl -p /dev/fs0 -e -l16M

Everything works as expected, except that I cannot add data to the flash
filesystem. The driver reports “disk full”. Any thoughts?

Best regards,
Mike Kadour

A couple of things; first of all, I notice that you’re making a 16M flash
filesystem image, but you mention that you also have an OS image, which you
are copying to the flash along with the filesystem image. Is your flash
exactly 16M in size? If so, you should be allowing for the size of your
OS image when you make your flash filesystem image. For example, if you
have an OS image which is slightly less than 1M in size, you should make
a 15M flash filesystem image, not a 16M image. Also, if your OS image is
sitting in flash before the flash filesystem image, then it should be
padded out so that the flash filesystem image starts on a multiple of
the flash block size. Finally, are you sure that the block size is 128k?
The flash part may have a 128k block size, but if your flash is two-way
interleaved, then your block size from the perspective of the flash
driver is 256k.

What is:

-the size of your OS image
-the overall size of your flash
-the placement of the OS image and filesystem image in the flash (which comes first?)

David Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com

-the size of your OS image

3.96MB

-the overall size of your flash

1x 16MB Intel 28F128J3A

-the placement of the OS image and filesystem image in the flash (which
comes first?)

0x00000000 IPL
0x00001000 IFS
next 128kb boundary after IFS: EFS

The EFS is 2.5Mb, and is created with (I had a type-o last post):

[block_size=128k spare_blocks=1 mount=/flash min_size=4m max_size=16m]

The three binaries are combined as follows:


mkrec -r -ffull -s4k ipl-tmp.bin > ipl.bin
cat ipl.bin ifs.bin > ipl-ifs.bin

mkimage -b 128k -o ipl-ifs-efs.bin ipl-ifs.bin efs.bin


I agree that the max_size is too large. It should be < 12Mb. But I thought
the extra 1.5Mb (min_size - actual_size) should be available for additional
files.

Cheers,
Mike

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

-the size of your OS image

3.96MB

-the overall size of your flash

1x 16MB Intel 28F128J3A

-the placement of the OS image and filesystem image in the flash (which
comes first?)

0x00000000 IPL
0x00001000 IFS
next 128kb boundary after IFS: EFS

The EFS is 2.5Mb, and is created with (I had a type-o last post):

[block_size=128k spare_blocks=1 mount=/flash min_size=4m max_size=16m]

I’m not sure how the efs wound up being 2.5M if the minimum size specified
was 4M…


The three binaries are combined as follows:



mkrec -r -ffull -s4k ipl-tmp.bin > ipl.bin
cat ipl.bin ifs.bin > ipl-ifs.bin

mkimage -b 128k -o ipl-ifs-efs.bin ipl-ifs.bin efs.bin

This should work (at least it put things in the right place for me…)

I agree that the max_size is too large. It should be < 12Mb. But I thought
the extra 1.5Mb (min_size - actual_size) should be available for additional
files.

Another way you might do this, if you want to maximize your flash filesystem
space but not have to transfer a full 16M image to the flash, is to:

-make an OS image which includes the flash driver and flashctl
-combine the IPL and OS image
-boot the board and start the flash driver

flashctl -p/dev/fs0p0 -o4M -l12M -ef (create and format a 12M flash filesystem,
starting at offset 4M of the flash)

Cheers,
Mike

David Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com

flashctl -p/dev/fs0p0 -o4M -l12M -ef (create and format a 12M flash
filesystem,
starting at offset 4M of the flash)

I understand (and hope) that would work. However, I’m looking for:

a single binary with my prepared filesystem
the ability to read/write all files
the ability to add beyond the existing size of the filesystem

I basically want to create a flash filesystem image that has been formatted
to 12Mb and includes a prepared set of files which are only 2.5Mb in size.

Is this even possible? or do I have to format to 12Mb using flashctl and
then copy the prepared set of files?

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

flashctl -p/dev/fs0p0 -o4M -l12M -ef (create and format a 12M flash
filesystem,
starting at offset 4M of the flash)

I understand (and hope) that would work. However, I’m looking for:

a single binary with my prepared filesystem
the ability to read/write all files
the ability to add beyond the existing size of the filesystem

I basically want to create a flash filesystem image that has been formatted
to 12Mb and includes a prepared set of files which are only 2.5Mb in size.

Is this even possible? or do I have to format to 12Mb using flashctl and
then copy the prepared set of files?

Yes, this is possible, but based on quick tests using devf-ram, I think you
need to specify: min_size=12M max_size=12M in your efs.build file. Hoever,
even with the min_size=4M that you previously had, you should still have been
able to copy files to the flash filesystem up to the 4M point…

David Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com

Yes, this is possible, but based on quick tests using devf-ram, I think
you
need to specify: min_size=12M max_size=12M in your efs.build file.
Hoever,
even with the min_size=4M that you previously had, you should still have
been
able to copy files to the flash filesystem up to the 4M point…

but I can’t… that was my original concern :wink: With 2.5Mb of files and a
min_size=4M, I still get “disk full” when I copy new files.

Mike

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

Yes, this is possible, but based on quick tests using devf-ram, I think
you
need to specify: min_size=12M max_size=12M in your efs.build file.
Hoever,
even with the min_size=4M that you previously had, you should still have
been
able to copy files to the flash filesystem up to the 4M point…

but I can’t… that was my original concern > :wink: > With 2.5Mb of files and a
min_size=4M, I still get “disk full” when I copy new files.

Mike

Hmmm… not sure what’s happening here. Can you replicate the scenario
using devf-ram, just for kicks?

efs.build (block size for devf-ram = 64k)

[block_size=64k spare_blocks=1 mount=/flash min_size=4m max_size=12m]
…/root

cd root
touch file
mkrec -r -ffull -s2560k file > 2.5m_file
rm file
ls -l
-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file



cd …
mkefs efs.build efs.image
ls -l efs.image
-rw-rw-r-- 1 dgreen 120 4194304 Nov 28 08:53 efs.image



devf-ram -s0,4M
cp -V efs.image /dev/fs0
ls -l /flash
total 5120

-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file

touch file
mkrec -r -ffull -s1M file > 1m_file
cp 1m_file /flash

ls -l /flash
total 7168

-rw-rw-r-- 1 root bin 1048576 Nov 28 08:54 1m_file
-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file


If this works for you with devf-ram, then for the flash driver,
next I’d try removing the mount=/flash from your efs.build file, and
just use the default mount point of /fs0p0.

You could also try changing max_size from 12M to 4M. Beyond that, I’m not
sure what the problem might be…

By the way, are you using devf-generic, or a custom flash driver? What’s
the output of devf-* -vvvvv ?

David Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com

dgreen@qnx.com wrote:

Mike Kadour <> mjkadour@uwaterloo.ca> > wrote:

Yes, this is possible, but based on quick tests using devf-ram, I think

you

need to specify: min_size=12M max_size=12M in your efs.build file.

Hoever,

even with the min_size=4M that you previously had, you should still have

been

able to copy files to the flash filesystem up to the 4M point…


but I can’t… that was my original concern > :wink: > With 2.5Mb of files and a
min_size=4M, I still get “disk full” when I copy new files.


Mike


Hmmm… not sure what’s happening here. Can you replicate the scenario
using devf-ram, just for kicks?

efs.build (block size for devf-ram = 64k)

[block_size=64k spare_blocks=1 mount=/flash min_size=4m max_size=12m]
./root



cd root
touch file
mkrec -r -ffull -s2560k file > 2.5m_file
rm file
ls -l

-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file


cd …
mkefs efs.build efs.image
ls -l efs.image

-rw-rw-r-- 1 dgreen 120 4194304 Nov 28 08:53 efs.image


devf-ram -s0,4M
cp -V efs.image /dev/fs0
ls -l /flash

total 5120
-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file

touch file
mkrec -r -ffull -s1M file > 1m_file
cp 1m_file /flash

cp: Ran out of disk space writing /flash/1m_file.

This is exactly the same symptoms as on my embedded system.


If this works for you with devf-ram, then for the flash driver,
next I’d try removing the mount=/flash from your efs.build file, and
just use the default mount point of /fs0p0.

You could also try changing max_size from 12M to 4M. Beyond that, I’m not
sure what the problem might be…

By the way, are you using devf-generic, or a custom flash driver? What’s
the output of devf-* -vvvvv ?

devf-sa1110-db

I’ll get the verbose output and post it here also. Did the above
actually work for your devf-ram ?

Cheers,
Mike

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

dgreen@qnx.com > wrote:
Mike Kadour <> mjkadour@uwaterloo.ca> > wrote:

Yes, this is possible, but based on quick tests using devf-ram, I think

you

need to specify: min_size=12M max_size=12M in your efs.build file.

Hoever,

even with the min_size=4M that you previously had, you should still have

been

able to copy files to the flash filesystem up to the 4M point…


but I can’t… that was my original concern > :wink: > With 2.5Mb of files and a
min_size=4M, I still get “disk full” when I copy new files.


Mike


Hmmm… not sure what’s happening here. Can you replicate the scenario
using devf-ram, just for kicks?

efs.build (block size for devf-ram = 64k)

[block_size=64k spare_blocks=1 mount=/flash min_size=4m max_size=12m]
./root



cd root
touch file
mkrec -r -ffull -s2560k file > 2.5m_file
rm file
ls -l

-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file


cd …
mkefs efs.build efs.image
ls -l efs.image

-rw-rw-r-- 1 dgreen 120 4194304 Nov 28 08:53 efs.image


devf-ram -s0,4M
cp -V efs.image /dev/fs0
ls -l /flash

total 5120
-rw-rw-r-- 1 dgreen 120 2621440 Nov 28 08:53 2.5m_file

touch file
mkrec -r -ffull -s1M file > 1m_file
cp 1m_file /flash

cp: Ran out of disk space writing /flash/1m_file.

This is exactly the same symptoms as on my embedded system.



If this works for you with devf-ram, then for the flash driver,
next I’d try removing the mount=/flash from your efs.build file, and
just use the default mount point of /fs0p0.

You could also try changing max_size from 12M to 4M. Beyond that, I’m not
sure what the problem might be…

By the way, are you using devf-generic, or a custom flash driver? What’s
the output of devf-* -vvvvv ?

devf-sa1110-db

I’ll get the verbose output and post it here also. Did the above
actually work for your devf-ram ?

Yes, I was able to create the 4M efs with an existing 2.5M file in
it, start devf-ram, copy the efs over to it, and then copy another
1M file to the filesystem, without problems.



Cheers,
Mike

David Green (dgreen@qnx.com)

QNX Software Systems Ltd.
http://www.qnx.com