More scripting:

This commit is contained in:
2026-04-14 11:14:40 -07:00
parent bc86aafd61
commit 0d01c3bf7c
6 changed files with 144 additions and 20 deletions
+20 -12
View File
@@ -12,18 +12,23 @@ step_clone_coreboot() {
info "Using existing coreboot directory."
cd "$COREBOOT_DIR" || return 1
_current=$(git rev-parse HEAD 2>/dev/null)
if [ "$_current" = "$COREBOOT_COMMIT" ]; then
success "Already on correct commit."
return 0
else
warn "Current commit ($_current) differs from expected ($COREBOOT_COMMIT)."
if prompt_yes_no "Checkout the correct commit?"; then
run_cmd "git checkout $COREBOOT_COMMIT" || return 1
run_cmd "git submodule update --init --checkout" || return 1
fi
# Resolve the target ref (may be a tag or a SHA) to a SHA for comparison.
run_cmd "git fetch --tags origin" || return 1
_target_sha=$(git rev-parse --verify "$COREBOOT_COMMIT^{commit}" 2>/dev/null)
_current_sha=$(git rev-parse HEAD 2>/dev/null)
if [ -n "$_target_sha" ] && [ "$_current_sha" = "$_target_sha" ]; then
success "Already on $COREBOOT_COMMIT."
return 0
fi
warn "Current HEAD ($_current_sha) differs from target ($COREBOOT_COMMIT)."
if prompt_yes_no "Checkout $COREBOOT_COMMIT?"; then
run_cmd "git checkout $COREBOOT_COMMIT" || return 1
run_cmd "git submodule update --init --checkout" || return 1
success "Checked out $COREBOOT_COMMIT."
fi
return 0
fi
fi
@@ -32,11 +37,14 @@ step_clone_coreboot() {
cd "$COREBOOT_DIR" || return 1
info "Checking out commit: $COREBOOT_COMMIT"
info "Fetching tags..."
run_cmd "git fetch --tags origin" || return 1
info "Checking out: $COREBOOT_COMMIT"
run_cmd "git checkout $COREBOOT_COMMIT" || return 1
info "Initializing submodules..."
run_cmd "git submodule update --init --checkout" || return 1
success "Coreboot repository ready."
success "Coreboot repository ready on $COREBOOT_COMMIT."
}
+12
View File
@@ -6,6 +6,18 @@ step_combine_bios() {
cd "$WORK_DIR" || return 1
# Short-circuit if the combined ROM already exists at the right size.
if [ -f t440p-original.rom ]; then
_existing=$(wc -c < t440p-original.rom)
if [ "$_existing" -eq "$SIZE_12MB" ]; then
info "Existing 12MB ROM found: $WORK_DIR/t440p-original.rom"
if prompt_yes_default "Use the existing combined ROM?"; then
success "Using existing t440p-original.rom."
return 0
fi
fi
fi
info "Combining 8MB (bottom) + 4MB (top) into a single 12MB ROM..."
run_cmd "cat 8mb_backup1.bin 4mb_backup1.bin > t440p-original.rom" || return 1
+19 -2
View File
@@ -134,6 +134,25 @@ _read_with_retry() {
step_extract_bios() {
section "Extract Original BIOS"
cd "$WORK_DIR" || return 1
# Short-circuit: if all four backups already exist and are the right size,
# assume the user already pulled them off the board and offer to skip.
if [ -f 4mb_backup1.bin ] && [ -f 4mb_backup2.bin ] \
&& [ -f 8mb_backup1.bin ] && [ -f 8mb_backup2.bin ]; then
_s1=$(wc -c < 4mb_backup1.bin)
_s2=$(wc -c < 8mb_backup1.bin)
if [ "$_s1" -eq "$SIZE_4MB" ] && [ "$_s2" -eq "$SIZE_8MB" ]; then
info "Existing backups found in $WORK_DIR:"
echo " 4mb_backup1.bin, 4mb_backup2.bin, 8mb_backup1.bin, 8mb_backup2.bin"
echo ""
if prompt_yes_default "Skip re-reading the chips and use the existing backups?"; then
success "Using existing backups. Skipping extraction."
return 0
fi
fi
fi
info "The T440p has two EEPROM chips beside the SODIMM slots:"
echo " - 4MB (top) — smaller SOIC-8, farther from CPU"
echo " - 8MB (bottom) — larger SOIC-8, closer to CPU (holds ME firmware)"
@@ -141,8 +160,6 @@ step_extract_bios() {
info "Each chip is read twice so we can diff the results and catch flaky reads."
echo ""
cd "$WORK_DIR" || return 1
# --- 4MB chip (do first: smaller = faster iteration on setup) ---
echo ""
show_image "eeprom_chip_4mb.webp" "Reference: 4MB (top) chip location on T440p"