TBR: clean up arm

Right now, the created arm.mbr is the size of the ESP
partition. It should be truncated though to just the mbr size.

In addition, dm= doesnt do anything on arm yet so replacing use with a todo and adding a check if it isn't there.

TEST=manually ran
BUG=none
TBR=fes
This commit is contained in:
Will Drewry 2010-07-03 18:27:10 -07:00
parent 821d07cb42
commit 82780e5c37
2 changed files with 15 additions and 9 deletions

View File

@ -322,14 +322,14 @@ make_image_bootable() {
if [[ "${ARCH}" == "arm" ]]; then
# TODO(wad) mmcblk1p3 is hardcoded for arm for now!
usb_disk="/dev/mmcblk1p3"
kernel_part="--kernel_cmdline='"
kernel_part="${kernel_part}\
$(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')"
kernel_part="${kernel_part} ${FLAGS_arm_extra_bootargs}'"
kernel_part="--kernel_cmdline=\"${FLAGS_arm_extra_bootargs}\" "
# TODO(wad) Integrate dmtable extraction into the arm build
# E.g. $(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')"
local kpart_offset="--kernel_partition_offset=${koffset}"
local kpart_size="\
--kernel_partition_sectors=$(partsize ${OUTPUT_DIR}/${image_name} 2)"
local kpart_size="--kernel_partition_sectors="
kpart_size="${kpart_size}$(partsize ${OUTPUT_DIR}/${image_name} 2)"
kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
info "Using addition bootloader arguments: ${kernel_part}"
bootloader_to="${OUTPUT_DIR}/arm.mbr"
fi

View File

@ -54,7 +54,10 @@ if ! type -p update_x86_bootloaders; then
local template_dir="$4"
# Pull out the dm="" values
dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
dm_table=
if echo "$kernel_cmdline" | grep -q 'dm="'; then
dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
fi
# Rewrite grub table
grub_dm_table_a=${dm_table//${old_root}/\$linuxpartA}
@ -177,7 +180,10 @@ elif [[ "${FLAGS_arch}" = "arm" ]]; then
info "Extracting the kernel command line from ${FLAGS_kernel_partition}"
kernel_cfg=$(dump_kernel_config "${kernel_partition}")
fi
dm_table=$(echo "$kernel_cfg" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
dm_table=
if echo "$kernel_cfg" | grep -q 'dm="'; then
dm_table=$(echo "$kernel_cfg" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
fi
# TODO(wad) assume usb_disk contains the arm boot location for now.
new_root="${FLAGS_usb_disk}"
info "Replacing dm slave devices with /dev/${new_root}"
@ -194,7 +200,7 @@ elif [[ "${FLAGS_arch}" = "arm" ]]; then
${device} \
"'dm=\"${dm_table}\"'")
sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \
if="$MBR_SCRIPT_UIMG" of=${FLAGS_to} conv=notrunc
if="$MBR_SCRIPT_UIMG" of=${FLAGS_to}
info "Emitted new ARM MBR to ${FLAGS_to}"
fi