> You can find here the cfdisk result on the linux SD card, only the
> part3 (named disc3) is ext2 , and it's contains the linux not the
> initrd. I've the same on the eval kit sdcard with a 505.16MB for
the
> part3. The other part are raw data.
Correct. In your below listing, disc1 is the kernel zImage.
Updating the kernel would be the following command:
dd if=newzImage of=/dev/sdcard0/disc/part1
disc2 is the initrd image. This is a *compressed* ext2 filesystem,
not a normal ext2 filesystem. To update the initrd:
dd if=newinitrd.gz of=/dev/sdcard0/disc/part2
Note that if you want a Linux userspace application started "really
quick" on bootup, the best place would be to place it in that initrd
and modify the /linuxrc script to start it (or replace /linuxrc with
your application).
disc3 is the Debian root filesystem in ext2 format. The filesystem
is ext2 but mounted with sync and noatime. The sync option should
bring the probability of Linux fs corruption on unclean shutdown
down a couple orders of magnitude and noatime prevents superfluous
file access time update writes that wear down flash. Ext3 could
also be used here, but ext3 uses a journal that in effect writes
metadata updates twice as often as ext2-- thus contributing up to 2x
faster flash wearout.
The bootloader is the first 446 bytes of sector 0. Its the same
sector as the partition table (which occupies bytes 446-509 of
sector 0). Bytes 510 and 511 are the 0xaa55 magic number standard
for DOS style partition tables. The bootloader is contained fully
in this 446 byte MBR-- it is not partly contained in any other
partition, i.e. it is not a multistage bootloader. Considering that
the Linux kernel requires a 300 byte long magic data structure
("atags") be initialized and passed to the kernel before bootup,
fitting all this bootup logic in 446 bytes was quite a feat.
To make another SD image, copy the first 446 bytes to another SD.
dd if=/dev/sdcard0/disc0/disc of=mbrcode bs=446 count=1
fdisk /dev/sdcard1, mke2fs, etc...
dd if=mbrcode of=/dev/sdcard1/disc0/disc bs=446 count=1
The 446 byte bootloader looks through the partition table for up to
2 partitions with ID 0xda ('Non-FS data' according to fdisk) The
first one it finds it loads the partition verbatim at 0x218000 and
the second one loads (if found) at 0x1000000 as an initrd.
A side-effect of this very simple bootloader is that there is no way
to override the default kernel command line arguments. To do that,
you will have to compile another kernel with a different default
commandline. (CONFIG_CMDLINE in the .config file). I would imagine
it should be possible to make clever use of gdb or binutils to
actually modify the static char C constant in the kernel text
itself. In this design, RedBoot's behavior of using ctrl-C to
interrupt normal bootup and allow users to change kernel commandline
options would have been a security liability to the customer who
commissioned us to build this product. (e.g. using "init=/bin/sh"
to bypass the system login prompt)
//Jesse Off
>
> cfdisk 2.12p
> Disk Drive: /dev/sdcard0/disc0/disc
> Size: 255066112 bytes, 255 MB
> Heads: 16 Sectors per Track: 32 Cylinders: 973
> Name Flags Part Type FS Type [Label] Size (MB)
> -------------------------------------------------------------------
---------------------------------------------------------------------
-----------------
> Pri/Log Free Space
0.06
> disc1 Boot Primary Non-FS data
1.00
> disc2 Primary Non-FS
data
> 1.05
> disc3 Primary Linux ext2
250.88
>
> Pri/Log Free
Space
> 2.10
>
> If I try to make my sdcard, I think that's :
> first 60KB : free
> in disc1 : your mini Linux bootloader
> in disc2 : initrd
> in disc3 : linux
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|