BabbageRedbootToUboot

Differences between revisions 1 and 2
Revision 1 as of 2009-12-02 16:00:20
Size: 1909
Editor: p5098ed03
Comment:
Revision 2 as of 2009-12-02 17:42:43
Size: 4214
Editor: p5098ed03
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
 * '''Packages affected''': uboot-imx  * '''Packages affected''': uboot-imx, flash-kernel, partman-auto
Line 8: Line 8:
== Scope == Over the last two releases we used redboot-tools to create images for imx51. Freescale moves the imx51 architecture to the uboot bootloader by default now. Image build scripts, user space maintenance tools as well as the installer need to be moved to uboot to comply with this change.
Line 10: Line 10:
== Implementation == == Design ==
Line 12: Line 12:
== Proof of concept script == General changes:

The uboot-imx package will be promoted to main, the redboot-imx package will be demoted to universe.

For the Live image boot:

To support uboot on imx51 images we will need to package uboot-imx, change the tools/boot/lucid/post-boot-armel+imx51 script in debian-cd to create a uboot boot partition instead of a redboot one and make use of a vfat /boot partition for kernel and initramfs.

Installer changes:

Currently (with karmic) there is no way to access the flash devices on a babbage board from a running system (no mtdblock driver) until the vendor ships a pre-installed uboot in flash we need to keep the old behavior of abusing the SD card as a boot floppy.
Additionally we will provide wiki documentation to set up uboot manually through a serial console. It is not clear yet if it is possible to replace the pre-installed redboot with uboot when at the redboot serial prompt, this will be researched as part of the implementation.

Hope is that with the next Freescale BSP release of 2.6.31 patches a working mtd driver will be provided and enable write access to the builtin flash device, this will enable us to write uboot to flash in an automated way during the install process.

The default partition layout for the imx51 sub architecture will be modified in partman-auto to create a vfat /boot partition. Code for this already exists for the dove sub architecture and will be re-used.

The flash-kernel script will be adapted to properly configure and set up uboot instead of redboot. Partially this work will be based on the already existing implementation used for the dove sub architecture.

Unification:

Since there appears to be a lot overlap with the already existing dove sub architecture, scripts installer and partitioner work will be based on the existing dove work and code will be unified as much as possible so if later SoCs show up making use of uboot these will be able to easily hook into the existing uboot design.

== Proof of concept script for image creation ==

Rationale

Over the last two releases we used redboot-tools to create images for imx51. Freescale moves the imx51 architecture to the uboot bootloader by default now. Image build scripts, user space maintenance tools as well as the installer need to be moved to uboot to comply with this change.

Design

General changes:

The uboot-imx package will be promoted to main, the redboot-imx package will be demoted to universe.

For the Live image boot:

To support uboot on imx51 images we will need to package uboot-imx, change the tools/boot/lucid/post-boot-armel+imx51 script in debian-cd to create a uboot boot partition instead of a redboot one and make use of a vfat /boot partition for kernel and initramfs.

Installer changes:

Currently (with karmic) there is no way to access the flash devices on a babbage board from a running system (no mtdblock driver) until the vendor ships a pre-installed uboot in flash we need to keep the old behavior of abusing the SD card as a boot floppy. Additionally we will provide wiki documentation to set up uboot manually through a serial console. It is not clear yet if it is possible to replace the pre-installed redboot with uboot when at the redboot serial prompt, this will be researched as part of the implementation.

Hope is that with the next Freescale BSP release of 2.6.31 patches a working mtd driver will be provided and enable write access to the builtin flash device, this will enable us to write uboot to flash in an automated way during the install process.

The default partition layout for the imx51 sub architecture will be modified in partman-auto to create a vfat /boot partition. Code for this already exists for the dove sub architecture and will be re-used.

The flash-kernel script will be adapted to properly configure and set up uboot instead of redboot. Partially this work will be based on the already existing implementation used for the dove sub architecture.

Unification:

Since there appears to be a lot overlap with the already existing dove sub architecture, scripts installer and partitioner work will be based on the existing dove work and code will be unified as much as possible so if later SoCs show up making use of uboot these will be able to easily hook into the existing uboot design.

Proof of concept script for image creation

log() {
    echo "$*" >&2
}

hex2dec() {
    printf "%d\n" "$1"
}

IMAGE=$1
BOOT_SIZE="$((16 * 1024 * 1024))"

# create MBR
log "initializing disk label (MBR and partition table)..."
parted -s "$IMAGE" mklabel msdos

# create uboot partition
log "creating uboot partition..."
UBOOT_SIZE=$(wc -c uboot-imx51_to2.bin|cut -d ' ' -f1)
parted -s "$IMAGE" mkpart primary fat32 "512B" "$(($UBOOT_SIZE - 1))B"

# make partition1 be "Non-FS data"
PART1_ID_OFFSET="$(hex2dec 0x1c2)"
printf '\xda' | dd conv=notrunc bs="$PART1_ID_OFFSET" of="$IMAGE" seek=1 2>/dev/null

# outputs actual partition start offset, end offset, and length, suffixed with
# B
get_part_data() {
    local n="$1"

    LANG=C parted -s "$IMAGE" unit B print | awk "/^ $n / { print \$2 \" \" \$3 \" \" \$4 }"

    # safer version using parted -m; needs newer parted
    #LANG=C parted -m -s "$IMAGE" unit B print | grep "^$n:" | cut -d: -f 2,3,4 --output-delimiter=" "
}

PART1_END_B="`(set -- $(get_part_data 1); echo "$2")`"

# dump uboot in place
log "writing uboot to disk..."
dd conv=notrunc bs=1024 if=uboot-imx51_to2.bin of="$IMAGE" seek=1 skip=1

# create /boot
parted -s "$IMAGE" mkpart primary fat32 "$((${PART1_END_B%B} + 1))B" "${BOOT_SIZE}B"

PART2_START_B="`(set -- $(get_part_data 2); echo "$1")`"
dd if=/dev/zero of=./boot.img bs=1024 count=$(($BOOT_SIZE / 1024))
mkdosfs ./boot.img

# copy kernel and initramfs in place here
mcopy -i ./boot.img /boot/vmlinuz-2.6.31-14-generic-pae ::vmlinuz

dd conv=notrunc bs=${PART2_START_B%B} if=./boot.img of="$IMAGE" seek=1
rm ./boot.img

Specs/Mobile/ARM/BabbageRedbootToUboot (last edited 2009-12-03 11:13:10 by g229236203)