Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xxx0 maximized (t400 x200) #953

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,26 @@ workflows:
requires:
- x230-hotp-maximized

- build:
name: t400-maximized
target: t400-maximized
subcommand: ""
requires:
- x230-hotp-maximized

- build:
name: t400-maximized-debug
target: t400-maximized-debug
subcommand: ""
requires:
- x230-hotp-maximized
- build:
name: x200-maximized
target: x200-maximized
subcommand: ""
requires:
- x230-hotp-maximized

- build:
name: librem_13v2
target: librem_13v2
Expand Down
39 changes: 39 additions & 0 deletions blobs/xxx0/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Coreboot supports generating modified ifd and gbe out of the box.
To replicate the blobs in this directory (based on coreboot 4.8.1 but simply replace version in paths):

make BOARDS=t400-maximized

This will create the ROM.

Then (considering you git clone heads under ~)

#To generate GBE and IFD
cd ~/heads/build/coreboot-4.8.1/util/bincfg
make gen-gbe-ich9m
make gen-ifd-x200
mv flashregion_0_fd.bin ../../../../blobs/xxx0/ifd.bin
mv flashregion_3_gbe.bin ../../../../blobs/xxx0/gbe.bin
Comment on lines +11 to +15
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fhvyhjriur as you can see, the ifd.bin and gbe.bin blobs were generated. If board is beeping on boot, it is most probably because something is wrong there.


#To unlock IFD, permitting to reflash whole flash internally
cd ~/heads/build/coreboot-4.8.1/util/ifdtool
make
cd ~/heads/blobs/xxx0/
~/heads/build/coreboot-4.8.1/util/ifdtool/ifdtool -u ifd.bin
mv ifd.bin.new ifd.bin

sha256sum -c hashes.txt

should output:
gbe.bin: OK
ifd.bin: OK

IFD contains regions that were outputed to layout.txt through ifdtool -f layout.txt ifd.bin
It defines a BIOS region of 007fffff – 00003000 = 7FCFFF
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This size is reflected under coreboot config. When boards are not booting (different then beeping), in the past it was because of a size mismatch between ifd defined regions and CBFS_SIZE defined under coreboot config.

Note that first boot after flash might take a couple of seconds more since memory init is done the first time and results need to be injected in CBFS as well.

Which 7FCFFF has been defined as CBFS_SIZE under coreboot config to use the whole region

DISCLAIMER: Considering neither gbe.bin nor ifd.bin are proprietary blobs (generated from specifications), those blobs are in tree to ease ROM reproducibility.

Note that MAC address is fixed under gbe-ich9m.spec to DE:AD:C0:FF:EE.
- If you want to keep your MAC, call extract.sh prior of building ROM.
- If you want to fixate your MAC to a custom address, change it under ~/heads/build/coreboot-4.8.1/util/bincfg/gbe-ich9m.spec prior of generating the gbe.bin above

52 changes: 52 additions & 0 deletions blobs/xxx0/extract.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

function printusage {
echo "Usage: $0 -f <romdump> -i <ifdtool>(optional)"
exit 0
}

BLOBDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$#" -eq 0 ]; then printusage; fi

while getopts ":f:m:i:" opt; do
case $opt in
f)
FILE="$OPTARG"
;;
i)
if [ -x "$OPTARG" ]; then
IFDTOOL="$OPTARG"
fi
;;
esac
done

if [ -z "$IFDTOOL" ]; then
IFDTOOL=`command -v $BLOBDIR/../../build/coreboot-*/util/ifdtool/ifdtool 2>&1|head -n1`
if [ -z "$IFDTOOL" ]; then
echo "ifdtool required but not found or specified with -m. Aborting."
exit 1;
fi
fi

echo "FILE: $FILE"
echo "IFD: $IFDTOOL"

bioscopy=$(mktemp)
extractdir=$(mktemp -d)

echo "###Copying $FILE under $bioscopy"
cp "$FILE" $bioscopy

cd "$extractdir"
echo "###Unlocking $bioscopy IFD..."
$IFDTOOL -u $bioscopy
echo "###Extracting regions from ROM..."
$IFDTOOL -x $bioscopy.new
echo "###Copying GBE region under $BLOBDIR/gbe.bin..."
cp "$extractdir/flashregion_3_gbe.bin" "$BLOBDIR/gbe.bin"

echo "###Cleaning up..."
rm "$bioscopy"
rm -r "$extractdir"
Binary file added blobs/xxx0/gbe.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions blobs/xxx0/hashes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
7917e0f0eb16c895da25d8acf01155e88ca189724c48a14cd1645d0d09f1cf5b gbe.bin
7415548cbe93b5543c6ccbf1b8d9d4f4ef794c4f376e46638a25f84378c19872 ifd.bin
Binary file added blobs/xxx0/ifd.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions blobs/xxx0/layout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
00000000:00000fff fd
00003000:007fffff bios
00001000:00002fff gbe
61 changes: 61 additions & 0 deletions boards/t400-maximized-debug/t400-maximized-debug.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Configuration for a t400 running non-Qubes OSes with USBDEBUG activated under coreboot config
#
# Deactivated to fit in coreboot's CONFIG_CBFS_SIZE=0x7FCFFF:
# dropbear support(ssh client/server)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be reactivated. When looking at output of builds, there is still of space for 8mb ROMs.
Note that really soon, bash will be included in roms, taking 150kb of CBFS space.

# e1000e (ethernet driver)
#
# Includes (read blobs/xxx0/README)
# - Generated IFD from bincfg
# - Forged 00:DE:AD:C0:FF:EE MAC address
# - Note that this MAC address can be modified under build/coreboot-VER/util/bincfg/ifd-x200.set

export CONFIG_COREBOOT=y
export CONFIG_COREBOOT_VERSION=4.13
export CONFIG_LINUX_VERSION=4.14.62

CONFIG_COREBOOT_CONFIG=config/coreboot-t400-maximized-debug.config
CONFIG_LINUX_CONFIG=config/linux-x230-legacy.config

CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
CONFIG_MBEDTLS=y
CONFIG_PCIUTILS=y

#Remote attestation support
#TPM based requirements
export CONFIG_TPM=n
CONFIG_POPT=y
CONFIG_QRENCODE=n
CONFIG_TPMTOTP=n
#HOTP based remote attestation for supported USB Security dongle
#With/Without TPM support
#CONFIG_HOTPKEY=n

#Nitrokey Storage admin tool
CONFIG_NKSTORECLI=n

#GUI Support
#Console based Whiptail support(Console based, no FB):
#CONFIG_SLANG=y
#CONFIG_NEWT=y
#FBWhiptail based (Graphical):
CONFIG_CAIRO=y
CONFIG_FBWHIPTAIL=y

#Additional tools:
#SSH server (requires ethernet drivers, eg: CONFIG_LINUX_E1000E)
CONFIG_DROPBEAR=n

export CONFIG_BOOTSCRIPT=/bin/gui-init
export CONFIG_BOOT_REQ_HASH=n
export CONFIG_BOOT_REQ_ROLLBACK=n
export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
export CONFIG_BOOT_DEV="/dev/sda1"
export CONFIG_BOARD_NAME="Thinkpad T400-maximized"
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal"
61 changes: 61 additions & 0 deletions boards/t400-maximized/t400-maximized.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Configuration for a t400 running non-Qubes OSes.
#
# Deactivated to fit in coreboot's CONFIG_CBFS_SIZE=0x7FCFFF:
# dropbear support(ssh client/server)
# e1000e (ethernet driver)
#
# Includes (read blobs/xxx0/README)
# - Generated IFD from bincfg
# - Forged 00:DE:AD:C0:FF:EE MAC address
# - Note that this MAC address can be modified under build/coreboot-VER/util/bincfg/ifd-x200.set

export CONFIG_COREBOOT=y
export CONFIG_COREBOOT_VERSION=4.13
export CONFIG_LINUX_VERSION=4.14.62

CONFIG_COREBOOT_CONFIG=config/coreboot-t400-maximized.config
CONFIG_LINUX_CONFIG=config/linux-x230-legacy.config

CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
CONFIG_MBEDTLS=y
CONFIG_PCIUTILS=y

#Remote attestation support
#TPM based requirements
export CONFIG_TPM=n
CONFIG_POPT=y
CONFIG_QRENCODE=n
CONFIG_TPMTOTP=n
#HOTP based remote attestation for supported USB Security dongle
#With/Without TPM support
#CONFIG_HOTPKEY=n

#Nitrokey Storage admin tool
CONFIG_NKSTORECLI=n

#GUI Support
#Console based Whiptail support(Console based, no FB):
#CONFIG_SLANG=y
#CONFIG_NEWT=y
#FBWhiptail based (Graphical):
CONFIG_CAIRO=y
CONFIG_FBWHIPTAIL=y

#Additional tools:
#SSH server (requires ethernet drivers, eg: CONFIG_LINUX_E1000E)
CONFIG_DROPBEAR=n

export CONFIG_BOOTSCRIPT=/bin/gui-init
export CONFIG_BOOT_REQ_HASH=n
export CONFIG_BOOT_REQ_ROLLBACK=n
export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
export CONFIG_BOOT_DEV="/dev/sda1"
export CONFIG_BOARD_NAME="Thinkpad T400-maximized"
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal"
61 changes: 61 additions & 0 deletions boards/x200-maximized/x200-maximized.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Configuration for a x200 running non-Qubes OSes.
#
# Deactivated to fit in coreboot's CONFIG_CBFS_SIZE=0x7FCFFF:
# dropbear support(ssh client/server)
# e1000e (ethernet driver)
#
# Includes (read blobs/xxx0/README)
# - Generated IFD from bincfg
# - Forged 00:DE:AD:C0:FF:EE MAC address
# - Note that this MAC address can be modified under build/coreboot-VER/util/bincfg/ifd-x200.set

export CONFIG_COREBOOT=y
export CONFIG_COREBOOT_VERSION=4.13
export CONFIG_LINUX_VERSION=4.14.62

CONFIG_COREBOOT_CONFIG=config/coreboot-x200-maximized.config
CONFIG_LINUX_CONFIG=config/linux-x230-legacy.config

CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
CONFIG_MBEDTLS=y
CONFIG_PCIUTILS=y

#Remote attestation support
#TPM based requirements
export CONFIG_TPM=n
CONFIG_POPT=y
CONFIG_QRENCODE=n
CONFIG_TPMTOTP=n
#HOTP based remote attestation for supported USB Security dongle
#With/Without TPM support
#CONFIG_HOTPKEY=n

#Nitrokey Storage admin tool
CONFIG_NKSTORECLI=n

#GUI Support
#Console based Whiptail support(Console based, no FB):
#CONFIG_SLANG=y
#CONFIG_NEWT=y
#FBWhiptail based (Graphical):
CONFIG_CAIRO=y
CONFIG_FBWHIPTAIL=y

#Additional tools:
#SSH server (requires ethernet drivers, eg: CONFIG_LINUX_E1000E)
CONFIG_DROPBEAR=n

export CONFIG_BOOTSCRIPT=/bin/gui-init
export CONFIG_BOOT_REQ_HASH=n
export CONFIG_BOOT_REQ_ROLLBACK=n
export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
export CONFIG_BOOT_DEV="/dev/sda1"
export CONFIG_BOARD_NAME="Thinkpad X200-maximized"
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal"
15 changes: 15 additions & 0 deletions config/coreboot-t400-maximized-debug.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CONFIG_VENDOR_LENOVO=y
CONFIG_CBFS_SIZE=0x7FCFFF
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From README notes, based on ifdtool -f output saved under layout.txt, where end-begin of BIOS REGION gives that value,.

CONFIG_IFD_BIN_PATH="@BLOB_DIR@/xxx0/ifd.bin"
CONFIG_GBE_BIN_PATH="@BLOB_DIR@/xxx0/gbe.bin"
CONFIG_HAVE_IFD_BIN=y
CONFIG_BOARD_LENOVO_T400=y
CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was different in past commit. I do not remember why different OS kernel tweaks were passed before.

CONFIG_HAVE_GBE_BIN=y
CONFIG_NO_GFX_INIT=y
CONFIG_USBDEBUG=y
CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x80000
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5=y
CONFIG_PAYLOAD_LINUX=y
CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage"
CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz"
14 changes: 14 additions & 0 deletions config/coreboot-t400-maximized.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CONFIG_VENDOR_LENOVO=y
CONFIG_CBFS_SIZE=0x7FCFFF
CONFIG_IFD_BIN_PATH="@BLOB_DIR@/xxx0/ifd.bin"
CONFIG_GBE_BIN_PATH="@BLOB_DIR@/xxx0/gbe.bin"
CONFIG_HAVE_IFD_BIN=y
CONFIG_BOARD_LENOVO_T400=y
CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet"
CONFIG_HAVE_GBE_BIN=y
CONFIG_NO_GFX_INIT=y
CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x80000
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5=y
CONFIG_PAYLOAD_LINUX=y
CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage"
CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz"
14 changes: 14 additions & 0 deletions config/coreboot-x200-maximized.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CONFIG_VENDOR_LENOVO=y
CONFIG_CBFS_SIZE=0x7FCFFF
CONFIG_IFD_BIN_PATH="@BLOB_DIR@/xxx0/ifd.bin"
CONFIG_GBE_BIN_PATH="@BLOB_DIR@/xxx0/gbe.bin"
CONFIG_HAVE_IFD_BIN=y
CONFIG_BOARD_LENOVO_X200=y
CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet"
Copy link
Collaborator Author

@tlaurion tlaurion Mar 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Heads kernel options passed from coreboot to the kernel Heads is booting.

As of now, nothing is tweaked here for i915/drm driver and coreboot boots without IGFX_INIT, meaning that the kernel is seldom responsible for graphic initialization.

linux config, as specified in board config, reuses linux-x230-legacy.conf, which includes i915 and i915 drm drivers. It should just work (tm).

CONFIG_HAVE_GBE_BIN=y
CONFIG_NO_GFX_INIT=y
CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x80000
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5=y
CONFIG_PAYLOAD_LINUX=y
CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage"
CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz"