mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-12 23:46:59 +02:00
make_image: Install u-boot scripts to ESP partition.
BUG=1150 TEST=Built image for tegra2_dev_board, and x86-generic Review URL: http://codereview.chromium.org/3109018
This commit is contained in:
parent
6944c5dd68
commit
eca76464c7
@ -199,18 +199,17 @@ make_image_bootable() {
|
|||||||
# Update the bootloaders. For legacy/efi x86, the EFI system partition
|
# Update the bootloaders. For legacy/efi x86, the EFI system partition
|
||||||
# will be updated and for arm, the mbr will be updated (for u-boot).
|
# will be updated and for arm, the mbr will be updated (for u-boot).
|
||||||
local kernel_part=
|
local kernel_part=
|
||||||
local bootloader_to=
|
|
||||||
local bootloader_to_flags=
|
|
||||||
local usb_disk="${FLAGS_usb_disk}"
|
local usb_disk="${FLAGS_usb_disk}"
|
||||||
|
|
||||||
if [[ "${FLAGS_arch}" = "x86" ]]; then
|
# We should update the esp in place in the image.
|
||||||
# x86 should update the esp in place in the image.
|
local bootloader_to="${image}"
|
||||||
bootloader_to="${image}"
|
|
||||||
local esp_offset="$(partoffset ${image} 12)"
|
local esp_offset="$(partoffset ${image} 12)"
|
||||||
esp_offset=$((esp_offset * 512)) # sectors to bytes
|
esp_offset=$((esp_offset * 512)) # sectors to bytes
|
||||||
local esp_size="$(partsize ${image} 12)"
|
local esp_size="$(partsize ${image} 12)"
|
||||||
esp_size=$((esp_size * 512)) # sectors to bytes
|
esp_size=$((esp_size * 512)) # sectors to bytes
|
||||||
bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}"
|
local bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}"
|
||||||
|
|
||||||
|
if [[ "${FLAGS_arch}" = "x86" ]]; then
|
||||||
# Use the kernel partition to acquire configuration flags.
|
# Use the kernel partition to acquire configuration flags.
|
||||||
kernel_part="--kernel_partition='${FLAGS_output_dir}/vmlinuz.image'"
|
kernel_part="--kernel_partition='${FLAGS_output_dir}/vmlinuz.image'"
|
||||||
# Install syslinux on the EFI System Partition.
|
# Install syslinux on the EFI System Partition.
|
||||||
@ -227,10 +226,9 @@ make_image_bootable() {
|
|||||||
kpart_size="${kpart_size}$(partsize ${image} 2)"
|
kpart_size="${kpart_size}$(partsize ${image} 2)"
|
||||||
kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
|
kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
|
||||||
info "Using addition bootloader arguments: ${kernel_part}"
|
info "Using addition bootloader arguments: ${kernel_part}"
|
||||||
bootloader_to="${FLAGS_output_dir}/arm.mbr"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update partition 12 / legacy bootloaders and arm.
|
# Update partition 12
|
||||||
${SCRIPTS_DIR}/update_bootloaders.sh \
|
${SCRIPTS_DIR}/update_bootloaders.sh \
|
||||||
--arch=${FLAGS_arch} \
|
--arch=${FLAGS_arch} \
|
||||||
--to="${bootloader_to}" \
|
--to="${bootloader_to}" \
|
||||||
@ -240,11 +238,6 @@ make_image_bootable() {
|
|||||||
${bootloader_to_flags} \
|
${bootloader_to_flags} \
|
||||||
$kernel_part
|
$kernel_part
|
||||||
|
|
||||||
if [[ "${FLAGS_arch}" == "arm" ]]; then
|
|
||||||
sudo dd bs=1 conv=notrunc if="${bootloader_to}" of="${image}"
|
|
||||||
sudo rm "${bootloader_to}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
trap - EXIT
|
trap - EXIT
|
||||||
${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \
|
${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \
|
||||||
-s "${FLAGS_statefulfs_mountpoint}"
|
-s "${FLAGS_statefulfs_mountpoint}"
|
||||||
|
@ -206,15 +206,9 @@ elif [[ "${FLAGS_arch}" = "arm" ]]; then
|
|||||||
warn "FIXME: cannot replace root= here for the arm bootloader yet."
|
warn "FIXME: cannot replace root= here for the arm bootloader yet."
|
||||||
dm_table="" # TODO(wad) Clear it until we can fix root=/dev/dm-0
|
dm_table="" # TODO(wad) Clear it until we can fix root=/dev/dm-0
|
||||||
|
|
||||||
device=1
|
# Copy u-boot script to ESP partition
|
||||||
MBR_SCRIPT_UIMG=$(make_arm_mbr \
|
sudo mkdir -p "${ESP_FS_DIR}/u-boot"
|
||||||
${FLAGS_kernel_partition_offset} \
|
sudo cp "${FLAGS_from}/boot-A.scr.uimg" "${ESP_FS_DIR}/u-boot/boot.scr.uimg"
|
||||||
${FLAGS_kernel_partition_sectors} \
|
|
||||||
${device} \
|
|
||||||
"'dm=\"${dm_table}\"'")
|
|
||||||
sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \
|
|
||||||
if="$MBR_SCRIPT_UIMG" of=${FLAGS_to}
|
|
||||||
info "Emitted new ARM MBR to ${FLAGS_to}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
Loading…
Reference in New Issue
Block a user