[Gta04-owner] rationale behind having uImage on the first partition?
Johannes Schauer
j.schauer at email.de
Sun Oct 23 13:55:33 CEST 2011
Hi,
while I was researching and at the same time composing this email I got
more and more disappointed. I wanted to make a point for having uImage
on the second partition by default as I didnt see any advantages of
having it on the first but only disadvantages but even though some of my
reasons got moot after trying out if it works in practice let me
reiterate my initial reasoning anyways.
So what would the advantages of having uImage on the second ext2/3
partition be:
1. smaller boot partition - the first partition can be very minimal as
one doesnt have to leave space for alternative kernels or very big
kernels but only for things that will never be changed anyways. MLO, and
u-boot occupy less than 2mb while the first partition is created with
70MB right now. Lots of space is just wasted and could be used better by
giving it to the second partition. Due to the 255 heads, 63 sectors
geometry restriction, the minimal possible size for the first partition
would be 7.8mb.
2. one would be able to use symlinks. With many kernels to try out or
switch inbetween during development it is more comfortable for me to
change the target of a symlink instead of copying files from temporary
locations around. FAT doesnt allow symlinks.
3. Distributions might want to ship their own kernel and it is easier to
just extract the tarball they to the second partition and being done
in contrast to additionally having to put their kernel on the first
partition. Instead of having two downloads and copy operations (kernel
and rootfs) it would only be one and by that simplifying the process.
4. Reducing possible sources of error. When users dont have to play with
the first partition anymore to exchange the kernel one source of
failure is automatically eradicated.
5. Distributions can ship a simpler fstab that doesnt have to mount the
first partition as /boot to be able to access it. They would be able
to just ignore it which would further reduce complexity.
As a proof of concept that my idea works in practice I was editing
http://download.goldelico.com/gta04/unstable/src/boot.txt and converting
it to boot.scr by doing:
mkimage -T script -d boot.txt boot.scr
Simply enough one just needs to change
fatload mmc 0 0x82000000 uImage
into
ext2load mmc 0:2 0x82000000 /boot/uImage
After this was working fine I investigated how small one could make the
first partition and was very disappointed when I discovered that nothing
under a size of 7 cylinders was working with X-Loader. How can this be?
Why does the first partition have to be so big? FAT32 (or FAT16 which
should also work) support partitions much smaller than 55mb (at least
mkdosfs only complains at sizes much less than that).
I then investigated further. I created a first partition of 7 cylinders
(the smallest size that was still working), formatted it with mkdosfs,
copied all the files over and then created a new partition table with
the first partition only having 1 cylinder. According to a binary diff,
this change only affected a couple of bytes in the partition table (as
expected) but again booting didnt work again. So since this time I left
the fat partition untouched and only changed the partition sizes, I
suspect that X-Loader really fails because of the partition table
properties and not because some troubles with fat.
Is there any way to fix the issue and have X-Loader cope with smaller
partition sizes?
Sadly, due to this problem (if it can't be fixed easily) my main point
(less space wasted) isnt of so much importance anymore.
But even if this can't (easily) be fixed, I still want to ask: what is
your reasoning behind putting uImage on the first partition? I only see
disadvantages of that and only (even if albeit small) advantages of
doing otherwise.
But even if there is a good reason for putting uImage on the first
partition, how about implementing a fallback mechanism in boot.scr so
that the kernel is loaded from the ext2/3 fs on the second partition if
it is not found on the first. Or the other way round, that the kernel is
loaded from the first fat partition if not found in the ext2/3 one. If
there is an advantage of having uImage on the first partition, then such
a solution would allow the user to choose whatever he deems best for
himself without him having to touch boot.scr.
So what do you think?
cheers, josch
More information about the Gta04-owner
mailing list