mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 06:26:57 +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
|
||||
# will be updated and for arm, the mbr will be updated (for u-boot).
|
||||
local kernel_part=
|
||||
local bootloader_to=
|
||||
local bootloader_to_flags=
|
||||
local usb_disk="${FLAGS_usb_disk}"
|
||||
|
||||
# We should update the esp in place in the image.
|
||||
local bootloader_to="${image}"
|
||||
local esp_offset="$(partoffset ${image} 12)"
|
||||
esp_offset=$((esp_offset * 512)) # sectors to bytes
|
||||
local esp_size="$(partsize ${image} 12)"
|
||||
esp_size=$((esp_size * 512)) # sectors to bytes
|
||||
local bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}"
|
||||
|
||||
if [[ "${FLAGS_arch}" = "x86" ]]; then
|
||||
# x86 should update the esp in place in the image.
|
||||
bootloader_to="${image}"
|
||||
local esp_offset="$(partoffset ${image} 12)"
|
||||
esp_offset=$((esp_offset * 512)) # sectors to bytes
|
||||
local esp_size="$(partsize ${image} 12)"
|
||||
esp_size=$((esp_size * 512)) # sectors to bytes
|
||||
bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}"
|
||||
# Use the kernel partition to acquire configuration flags.
|
||||
kernel_part="--kernel_partition='${FLAGS_output_dir}/vmlinuz.image'"
|
||||
# Install syslinux on the EFI System Partition.
|
||||
@ -227,10 +226,9 @@ make_image_bootable() {
|
||||
kpart_size="${kpart_size}$(partsize ${image} 2)"
|
||||
kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
|
||||
info "Using addition bootloader arguments: ${kernel_part}"
|
||||
bootloader_to="${FLAGS_output_dir}/arm.mbr"
|
||||
fi
|
||||
|
||||
# Update partition 12 / legacy bootloaders and arm.
|
||||
# Update partition 12
|
||||
${SCRIPTS_DIR}/update_bootloaders.sh \
|
||||
--arch=${FLAGS_arch} \
|
||||
--to="${bootloader_to}" \
|
||||
@ -240,11 +238,6 @@ make_image_bootable() {
|
||||
${bootloader_to_flags} \
|
||||
$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
|
||||
${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_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."
|
||||
dm_table="" # TODO(wad) Clear it until we can fix root=/dev/dm-0
|
||||
|
||||
device=1
|
||||
MBR_SCRIPT_UIMG=$(make_arm_mbr \
|
||||
${FLAGS_kernel_partition_offset} \
|
||||
${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}"
|
||||
# Copy u-boot script to ESP partition
|
||||
sudo mkdir -p "${ESP_FS_DIR}/u-boot"
|
||||
sudo cp "${FLAGS_from}/boot-A.scr.uimg" "${ESP_FS_DIR}/u-boot/boot.scr.uimg"
|
||||
fi
|
||||
|
||||
set +e
|
||||
|
Loading…
Reference in New Issue
Block a user