[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apparmor on SheevaPlug



* Christoph Pleger <Christoph.Pleger@cs.tu-dortmund.de> [2016-01-06 20:01]:
> But if I change bootcmd, how long will that be valid? The only way to
> connect to uboot is while booting, because I could not get the tools from
> package u-boot-tools to work. So, if I change bootcmd at boot time, will
> that survive another reboot (I guess that it will, with saveenv)? But even

Yes.

> if it does, how about installing a new kernel? Won't flash-kernel use the
> default u-boot values to create a new uImage file, thereby overwriting my
> own bootcmd?

No, flash-kernel doesn't read u-boot values nor change them.  Also,
the name flash-kernel is a misnomer on the SheevaPlug because it
doesn't write the kernel to flash.  Your SheevaPlug boots from SD card
(via that bootcmd_mmc).

On u-boot, you typically require an "uImage" file.  Instead of booting
a kernel directly (e.g. /boot/vmlinuz directly, as on e.g. x86), you
have to take that /boot/vmlinuz file and create an uImage file out of
it for u-boot.  This is basically just the vmlinuz file with a special
header that tells u-boot some stuff about the image.  The same is
required for the ramdisk.  (Newer u-boot versions don't require this,
btw; you can boot the kernel directly with 'bootz'.)

So when you install a new kernel, the kernel is installed (/boot/vml*
plus modules under /lib/modules) and then update-initramfs is run to
create a new initramfs (ramdisk) [this is basically a tiny Linux
system that you load to RAM and which then loads Debian].  And then
flash-kernel is run, which on the SheevaPlug only creates /boot/uImage
and /boot/uInitrd on your disk (not flash!).

And when you reboot, u-boot looks at the bootcmd variable to see which
commands to run.  In your case this is:

setenv bootargs ${bootargs_console}; run bootcmd_mmc; bootm 0x00800000 0x01100000

And bootcmd_mmc is: ext2load mmc 0:1 0x00800000 /uImage; ext2load mmc 0:1 0x01100000 /uInitrd

So:

1) Sets some environment variables. (Note it doesn't set root= since
flash-kernel puts that info in the initramfs)

2) Run bootcmd_mmc, which in turn loads the uImage and uInitrd file
from your SD card to memory

3) Executes the Linux kernel and ramdisk from memory

So when you change bootcmd to pass more arguments to the kernel, this
will persist (assuming you don't forget to run 'saveenv') until you
change it again yourself.

Here's a description of the boot process, btw:
http://www.cyrius.com/debian/kirkwood/sheevaplug/boot/

-- 
Martin Michlmayr
http://www.cyrius.com/


Reply to: