diff --git a/build_image b/build_image index 14637906bd..1250996185 100755 --- a/build_image +++ b/build_image @@ -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 diff --git a/update_bootloaders.sh b/update_bootloaders.sh index 8919559a8f..5b216b7c56 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -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