On Thu, Feb 17, 2011, Angus Ainslie wrote:
> The SMDKv310 code now follows the recommended boot (FAT) and rootfs
> (EXT) partition scheme. BL1 , u-boot, the kernel and the initrd all
> load from the raw mmc offsets currently. Once my MMC issues are
> resolved I'll be able to load some of these from the FAT partition.
So overall, the diff is much smaller and it's getting closer to being
mergeable, thanks for your work; some comments below
Why do we have root=/dev/mmcblk0p3 here and root=/dev/mmcblk0p2 in
extra_boot_args_options? Both seem incorrect as we use UUID for
booting. Same remark for init=/bin/bash.
console= should be inferred from a serialtty variable.
I don't think we should encode the default u-boot environment into
linaro-image-tools, but rather into u-boot. So things like
ethact=smc911x-0 should go into u-boot's config for the board.
ethaddr= seems broken; this should be read from an EEPROM or should be
generated by u-boot or by the kernel once, and recorded (see what IGEP
or beagle xM do in u-boot + linux)
> + @classmethod
> + def get_sfdisk_cmd(cls, should_align_boot_part=False):
> + # Create a fixed-offset bootloader data at
> + # the beginning of the image (size is 214080 512 byte sectors
> + # with the first sector for MBR).
> + loader_start, loader_end, loader_len = align_partition(
> + 1, 214080, 1, PART_ALIGN_S)
> +
> + boot_start, boot_end, boot_len = align_partition(
> + loader_end + 1, BOOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S)
> +
> + # we ignore _root_end / _root_len and return a sfdisk command to
> + # instruct the use of all remaining space; XXX if we had some root size
> + # config, we could do something more sensible
> + root_start, _root_end, _root_len = align_partition(
> + boot_end + 1, ROOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S)
> +
> + return '%s,%s,0xDA\n%s,%s,0x0C,*\n%s,,,-' % (
> + loader_start, loader_len, boot_start, boot_len, root_start)
you're creating this partition layout: <bootloader>
<boot>
<root>
but I understand that the layout of data on the MMC is essentially:
+0 <partition table>
various stuff at fixed offsets:
+1 u-boot
+X kernel
+Y initrd
+4MiB <rootfs>
It would seem more sensible to me to have just a bootloader partition
and a rootfs partition (as long as your u-boot can't read from a vfat): <bootloader>
<root>
The bootloader partition would have to be as big as the initrd end
offset.
I'm overall still unhappy that this is not using a vfat partition and
loading kernel and initrd from it, as well as boot script, I understand
this is just an u-boot bug. Which bug id is tracking this issue? I'd
like to make sure that it's not swept under the carpet :-)
the 16384 KiB are duplicated across:
a) partition size constraints
b) in this make_flashable_env() call
c) in install_smdkv310_boot_env() which has count=32
please use some constants to compute partition offsets, dd args etc.
from the same value
e.g.:
SMDK_V310_ENV_SECTORS = 32
KERNEL_OFFSET_SECTORS = X
KERNEL_SIZE_SECTORS = X2
INITRD_OFFSET_SECTORS = Y
INITRD__SIZE_SECTORS = Y2
assert Y > X+X2
and then make sure you align_partition() above Y+Y2 so that the rootfs
is guaranteed to start at the earliest aligned location after the
initrd
Guilherme mentioned that ttySAC1 should be a serialtty var instead,
like on the other boards
> + live_serial_opts = 'serialtty=ttyO2'
Does your board really have a ttyO2?
> + kernel_suffix = 's5pv310'
This kernel suffix is a bit suspicious; will you build a kernel which
only works on s5pv310? Did you consider building one which works on
multiple s5 SoCs? For instance, OMAP kernels can be built for OMAP2,
OMAP3 and OMAP4 in the same binary kernel which is just called -omap.
Linaro builds a -omap for all v7+ OMAPs, so OMAP3 and OMAP4 (and maybe
OMAP5 some day). We should be advocating this for Samsung SoCs as
well.
root=/dev/mmcblk0p2 is incorrect; we're using UUID= on all other boards
which is resolved by the UUID
init=/bin/bash is also incorrect; you might have issues booting a
regular userspace, but it seems really broken to encode these in the
image writing tool
also, don't ever hardcode /dev/mmcblk0p2 as we have:
> + mmc_part_offset = 1
make_flashable_env(), install_smdkv310_boot_env(),
install_smdkv310_uImage() are only called once from _make_boot_files();
maybe it would make more sense to have a single v310 specific functions
which does all these things? It would also ease testing
> - if should_format_bootfs:
> + if should_format_bootfs and board_config.uses_fat_boot_partition:
I think the flag should really be uses_boot_partition; you don't really
use a boot fs at all, it's just bootloader reserved space (concept of
the bootloader partition for mx5 boards)
Overall, the main things I'd like to see:
* u-boot / linux issues tracked as bugs and fixed in u-boot / linux
* no boot partition at all if you can't support it, just bootloader
partition
* no duplication of values which are dependent on each other like
rootfs partition offset, initrd size and offset, kernel size and
offset, u-boot size and offset, u-boot env size and offset...
* no duplication of root= console= data, should use UUID and mmc
numbering from linaro-image-tools
On Thu, Feb 17, 2011, Angus Ainslie wrote:
> The SMDKv310 code now follows the recommended boot (FAT) and rootfs
> (EXT) partition scheme. BL1 , u-boot, the kernel and the initrd all
> load from the raw mmc offsets currently. Once my MMC issues are
> resolved I'll be able to load some of these from the FAT partition.
So overall, the diff is much smaller and it's getting closer to being
mergeable, thanks for your work; some comments below
> === modified file 'linaro_ media_create/ boards. py' media_create/ boards. py 2011-02-14 16:26:08 +0000 media_create/ boards. py 2011-02-17 21:51:59 +0000 uboot_parts_ dir, cls.kernel_suffix, boot_dir) BoardConfig) : root=/dev/ mmcblk0p3 rootwait rw init=/bin/bash console= ttySAC1, 115200' , 00:40:5c: 26:0a:5b' ,
> --- linaro_
> +++ linaro_
> @@ -419,6 +422,67 @@
> cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir)
> make_uInitrd(
>
> +class SamsungConfig(
> + boot_env = [
> + 'bootargs=
> + 'bootcmd=movi read kernel 40007000; movi read rootfs 41000000 600000;'
> + 'bootm 40007000 41000000',
> + 'ethact=smc911x-0',
> + 'ethaddr=
> + ]
> +
Why do we have root=/dev/mmcblk0p3 here and root=/dev/mmcblk0p2 in boot_args_ options? Both seem incorrect as we use UUID for
extra_
booting. Same remark for init=/bin/bash.
console= should be inferred from a serialtty variable.
I don't think we should encode the default u-boot environment into image-tools, but rather into u-boot. So things like
linaro-
ethact=smc911x-0 should go into u-boot's config for the board.
ethaddr= seems broken; this should be read from an EEPROM or should be
generated by u-boot or by the kernel once, and recorded (see what IGEP
or beagle xM do in u-boot + linux)
> + @classmethod align_boot_ part=False) : 0xDA\n% s,%s,0x0C, *\n%s,, ,-' % (
> + def get_sfdisk_cmd(cls, should_
> + # Create a fixed-offset bootloader data at
> + # the beginning of the image (size is 214080 512 byte sectors
> + # with the first sector for MBR).
> + loader_start, loader_end, loader_len = align_partition(
> + 1, 214080, 1, PART_ALIGN_S)
> +
> + boot_start, boot_end, boot_len = align_partition(
> + loader_end + 1, BOOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S)
> +
> + # we ignore _root_end / _root_len and return a sfdisk command to
> + # instruct the use of all remaining space; XXX if we had some root size
> + # config, we could do something more sensible
> + root_start, _root_end, _root_len = align_partition(
> + boot_end + 1, ROOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S)
> +
> + return '%s,%s,
> + loader_start, loader_len, boot_start, boot_len, root_start)
you're creating this partition layout:
<bootloader >
<boot>
<root>
but I understand that the layout of data on the MMC is essentially:
+0 <partition table>
various stuff at fixed offsets:
+1 u-boot
+X kernel
+Y initrd
+4MiB <rootfs>
It would seem more sensible to me to have just a bootloader partition
<bootloader >
and a rootfs partition (as long as your u-boot can't read from a vfat):
<root>
The bootloader partition would have to be as big as the initrd end
offset.
I'm overall still unhappy that this is not using a vfat partition and
loading kernel and initrd from it, as well as boot script, I understand
this is just an u-boot bug. Which bug id is tracking this issue? I'd
like to make sure that it's not swept under the carpet :-)
> + @classmethod files(cls, uboot_parts_dir, boot_cmd, chroot_dir, or_file) :
> + def _make_boot_
> + boot_dir, boot_script, boot_device_
> + uboot_file = os.path.join(
> + chroot_dir, 'usr', 'lib', 'u-boot', 'smdkv310', 'u-boot.v310')
I know it's a weird question, but why is the file suffix u-boot.v310?
Is it a special format that only the v310 supports?
> + install_ smdkv310_ boot_loader( uboot_file, boot_device_ or_file) join(boot_ dir, 'boot_env.flash') env(cls. boot_env, 16384, env_file) smdkv310_ boot_env( env_file, boot_device_ or_file)
> +
> + env_file = os.path.
> + # SMDK v310 uses a 16K environment
> + make_flashable_
> + install_
the 16384 KiB are duplicated across: env() call smdkv310_ boot_env( ) which has count=32
a) partition size constraints
b) in this make_flashable_
c) in install_
please use some constants to compute partition offsets, dd args etc.
from the same value
e.g.: ENV_SECTORS = 32 OFFSET_ SECTORS = X SIZE_SECTORS = X2 OFFSET_ SECTORS = Y _SIZE_SECTORS = Y2
SMDK_V310_
KERNEL_
KERNEL_
INITRD_
INITRD_
assert Y > X+X2
and then make sure you align_partition() above Y+Y2 so that the rootfs
is guaranteed to start at the earliest aligned location after the
initrd
> +class SMDKV310Config( SamsungConfig) : ttySAC1, 115200'
> + extra_serial_opts = 'console=
Guilherme mentioned that ttySAC1 should be a serialtty var instead,
like on the other boards
> + live_serial_opts = 'serialtty=ttyO2'
Does your board really have a ttyO2?
> + kernel_suffix = 's5pv310'
This kernel suffix is a bit suspicious; will you build a kernel which
only works on s5pv310? Did you consider building one which works on
multiple s5 SoCs? For instance, OMAP kernels can be built for OMAP2,
OMAP3 and OMAP4 in the same binary kernel which is just called -omap.
Linaro builds a -omap for all v7+ OMAPs, so OMAP3 and OMAP4 (and maybe
OMAP5 some day). We should be advocating this for Samsung SoCs as
well.
> + boot_script = 'boot.scr' args_options = ( dev/mmcblk0p2 rootwait rw init=/bin/bash')
> + extra_boot_
> + 'root=/
root=/ dev/mmcblk0p2 is incorrect; we're using UUID= on all other boards
which is resolved by the UUID
init=/bin/bash is also incorrect; you might have issues booting a
regular userspace, but it seems really broken to encode these in the
image writing tool
also, don't ever hardcode /dev/mmcblk0p2 as we have:
> + mmc_part_offset = 1
> +def make_flashable_ env(boot_ env, env_size, env_file):
we need some test for this function, and for the other two functions
added by this patch
> + proc = cmd_runner.run([
> + "mv",
> + "%s" % tmpfile,
> + "%s" % env_file], as_root=True)
> + proc.wait()
Why move the file in place instead of generating it directly at the
right location?
> +def install_ smdkv310_ uImage( uImage_ file, boot_device_ or_file) : or_file,
> + # seek offset of 9281 is the MBR + BL1 + u-boot env + u-bbot
> + cmd = [
> + "dd",
> + "if=%s" % uImage_file,
> + "of=%s" % boot_device_
> + "bs=512",
> + "seek=1089",
> + "conv=notrunc"]
this seek= should be computed via constants
make_flashable _env(), install_ smdkv310_ boot_env( ), smdkv310_ uImage( ) are only called once from _make_boot_files();
install_
maybe it would make more sense to have a single v310 specific functions
which does all these things? It would also ease testing
> +def install_ smdkv310_ initrd( initrd_ file, boot_device_ or_file) : or_file,
> + # seek offset of 9281 is the MBR + BL1 + u-boot env + u-bbot + uImage
> + proc = cmd_runner.run([
> + "dd",
> + "if=%s" % initrd_file,
> + "of=%s" % boot_device_
> + "bs=512",
> + "seek=9281",
Again, seek= shouldn't be hardcoded
> +def install_ smdkv310_ boot_env( env_file, boot_device_ or_file) : or_file,
> + # seek offset of 65 is the MBR + BL1 + u-boot env
> + proc = cmd_runner.run([
> + "dd",
> + "if=%s" % env_file,
> + "of=%s" % boot_device_
> + "bs=512",
> + "seek=33",
> + "count=32",
same remark with seek=, count=...
You could also introduce a dd() function for all these dd cmd runs
> +def install_ smdkv310_ boot_loader( v310_file, boot_device_ or_file) : or_file,
> + # seek offset of 1 preserves the MBR
> + proc = cmd_runner.run([
> + "dd",
> + "if=%s" % v310_file,
> + "of=%s" % boot_device_
> + "bs=512",
> + "seek=1",
> + "count=32",
ditto
> + # seek offset of 65 is the MBR + BL2 + u-boot env or_file,
> + proc = cmd_runner.run([
> + "dd",
> + "if=%s" % v310_file,
> + "of=%s" % boot_device_
> + "bs=512",
> + "seek=65",
> + "skip=64",
ditto
> - if should_ format_ bootfs: format_ bootfs and board_config. uses_fat_ boot_partition:
> + if should_
I think the flag should really be uses_boot_ partition; you don't really
use a boot fs at all, it's just bootloader reserved space (concept of
the bootloader partition for mx5 boards)
Overall, the main things I'd like to see:
* u-boot / linux issues tracked as bugs and fixed in u-boot / linux
* no boot partition at all if you can't support it, just bootloader
partition
* no duplication of values which are dependent on each other like
rootfs partition offset, initrd size and offset, kernel size and
offset, u-boot size and offset, u-boot env size and offset...
* no duplication of root= console= data, should use UUID and mmc
numbering from linaro-image-tools
--
Loïc Minier