mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
Fix up OEM partition during image build
BUG=chrome-os-partner:14340 BUG=chromium-os:34688 TEST=Build an image, verify OEM partition has filesystem Change-Id: Ie3e51427a36f5e8ea288abb7ac3ceeefb20cdb6f Reviewed-on: https://gerrit.chromium.org/gerrit/33866 Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org> Tested-by: Liam McLoughlin <lmcloughlin@chromium.org> Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
This commit is contained in:
parent
5b37c5443a
commit
aca5e1edfe
@ -23,6 +23,7 @@ cleanup_mounts() {
|
||||
safe_umount_tree "${root_fs_dir}"
|
||||
safe_umount_tree "${stateful_fs_dir}"
|
||||
safe_umount_tree "${esp_fs_dir}"
|
||||
safe_umount_tree "${oem_fs_dir}"
|
||||
|
||||
# Turn die on error back on.
|
||||
set -e
|
||||
@ -240,7 +241,8 @@ create_base_image() {
|
||||
build_gpt "${BUILD_DIR}/${image_name}" \
|
||||
"${root_fs_img}" \
|
||||
"${stateful_fs_img}" \
|
||||
"${esp_fs_img}"
|
||||
"${esp_fs_img}" \
|
||||
"${oem_fs_img}"
|
||||
|
||||
# Clean up temporary files.
|
||||
rm -f "${root_fs_img}" "${stateful_fs_img}" "${esp_fs_img}" "{oem_fs_img}"
|
||||
|
@ -172,6 +172,7 @@ build_gpt() {
|
||||
local rootfs_img="$2"
|
||||
local stateful_img="$3"
|
||||
local esp_img="$4"
|
||||
local oem_img="$5"
|
||||
|
||||
get_disk_layout_type
|
||||
run_partition_script "${outdev}" "${rootfs_img}"
|
||||
@ -195,6 +196,10 @@ build_gpt() {
|
||||
$sudo dd if="$esp_img" of="$outdev" conv=notrunc bs=512 \
|
||||
seek=$(partoffset ${outdev} 12)
|
||||
|
||||
info "Copying OEM partition..."
|
||||
$sudo dd if="$oem_img" of="$outdev" conv=notrunc bs=512 \
|
||||
seek=$(partoffset ${outdev} 8)
|
||||
|
||||
# Pre-set "sucessful" bit in gpt, so we will never mark-for-death
|
||||
# a partition on an SDCard/USB stick.
|
||||
cgpt add -i 2 -S 1 "$outdev"
|
||||
|
@ -117,6 +117,7 @@ popd >/dev/null
|
||||
|
||||
# Fix the kernel command line
|
||||
TEMP_ESP="${TEMP_DIR}"/part_12
|
||||
TEMP_OEM="${TEMP_DIR}"/part_8
|
||||
TEMP_ROOTFS="${TEMP_DIR}"/part_3
|
||||
TEMP_STATE="${TEMP_DIR}"/part_1
|
||||
TEMP_KERN="${TEMP_DIR}"/part_2
|
||||
@ -175,6 +176,8 @@ dd if="${TEMP_KERN}" of="${TEMP_IMG}" conv=notrunc bs=512 \
|
||||
seek=$(partoffset ${TEMP_IMG} 2)
|
||||
dd if="${TEMP_ESP}" of="${TEMP_IMG}" conv=notrunc bs=512 \
|
||||
seek=$(partoffset ${TEMP_IMG} 12)
|
||||
dd if="${TEMP_OEM}" of="${TEMP_IMG}" conv=notrunc bs=512 \
|
||||
seek=$(partoffset ${TEMP_IMG} 8)
|
||||
|
||||
# Make the built-image bootable and ensure that the legacy default usb boot
|
||||
# uses /dev/sda instead of /dev/sdb3.
|
||||
|
Loading…
x
Reference in New Issue
Block a user