mirror of
https://github.com/timmypidashev/web.git
synced 2026-04-14 11:03:50 +00:00
keep working on coreboot guide
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 235 KiB |
@@ -4,6 +4,86 @@ import { Terminal, Copy, Check } from 'lucide-react';
|
||||
import { FaDebian, FaFedora } from 'react-icons/fa6';
|
||||
import { SiGentoo, SiNixos, SiArchlinux } from 'react-icons/si';
|
||||
|
||||
// Component for multi-line command sequences
|
||||
const CommandSequence = ({
|
||||
commands,
|
||||
description,
|
||||
shell = "bash"
|
||||
}) => {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
// Join the commands with newlines for copying
|
||||
const fullCommandText = Array.isArray(commands)
|
||||
? commands.join('\n')
|
||||
: commands;
|
||||
|
||||
const copyToClipboard = () => {
|
||||
navigator.clipboard.writeText(fullCommandText)
|
||||
.then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to copy: ', err);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full rounded-md overflow-hidden border border-foreground/20 bg-background my-4">
|
||||
{/* Header with Terminal Icon and Copy Button */}
|
||||
<div className="bg-background border-b border-foreground/20 text-foreground p-2 flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
<Terminal size={20} className="mr-2 text-yellow-bright" />
|
||||
<div className="text-sm font-comic-code">
|
||||
{description || "Terminal Commands"}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={copyToClipboard}
|
||||
className="bg-background hover:bg-foreground/10 text-foreground text-xs px-2 py-1 rounded flex items-center"
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
<Check size={14} className="mr-1 text-green-bright" />
|
||||
<span>Copied</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Copy size={14} className="mr-1 text-foreground/70" />
|
||||
<span>Copy All</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Command Display */}
|
||||
<div className="text-foreground p-3 overflow-x-auto">
|
||||
<div className="font-comic-code text-sm">
|
||||
{Array.isArray(commands)
|
||||
? commands.map((cmd, index) => (
|
||||
<div key={index} className="flex items-start mb-2 last:mb-0">
|
||||
<span className="text-orange-bright mr-2 flex-shrink-0">$</span>
|
||||
<span className="text-purple-bright overflow-x-auto whitespace-nowrap">
|
||||
{cmd}
|
||||
</span>
|
||||
</div>
|
||||
))
|
||||
: (
|
||||
<div className="flex items-start">
|
||||
<span className="text-orange-bright mr-2 flex-shrink-0">$</span>
|
||||
<span className="text-purple-bright overflow-x-auto whitespace-nowrap">
|
||||
{commands}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// Original Commands component with tabs for different distros
|
||||
const Commands = ({
|
||||
commandId,
|
||||
description,
|
||||
@@ -25,9 +105,9 @@ const Commands = ({
|
||||
},
|
||||
{
|
||||
id: 'debian',
|
||||
name: 'Debian',
|
||||
name: 'Debian/Ubuntu',
|
||||
icon: FaDebian,
|
||||
command: debianCommand || 'echo "No command specified for Debian"'
|
||||
command: debianCommand || 'echo "No command specified for Debian/Ubuntu"'
|
||||
},
|
||||
{
|
||||
id: 'fedora',
|
||||
@@ -113,7 +193,7 @@ const Commands = ({
|
||||
</div>
|
||||
|
||||
{/* Command Display with Horizontal Scrolling */}
|
||||
<div className="bg-[#282828] text-foreground p-3 overflow-x-auto">
|
||||
<div className="text-foreground p-3 overflow-x-auto">
|
||||
<div className="flex items-center font-comic-code text-sm whitespace-nowrap">
|
||||
<span className="text-orange-bright mr-2">$</span>
|
||||
<span className="text-purple-bright">
|
||||
@@ -125,7 +205,7 @@ const Commands = ({
|
||||
);
|
||||
};
|
||||
|
||||
// Also include a simpler command component for single commands
|
||||
// Single command component
|
||||
const Command = ({
|
||||
command,
|
||||
description,
|
||||
@@ -173,7 +253,7 @@ const Command = ({
|
||||
</div>
|
||||
|
||||
{/* Command Display with Horizontal Scrolling */}
|
||||
<div className="bg-[#282828] text-foreground p-3 overflow-x-auto">
|
||||
<div className="text-foreground p-3 overflow-x-auto">
|
||||
<div className="flex items-center font-comic-code text-sm whitespace-nowrap">
|
||||
<span className="text-orange-bright mr-2">$</span>
|
||||
<span className="text-purple-bright">
|
||||
@@ -185,4 +265,4 @@ const Command = ({
|
||||
);
|
||||
};
|
||||
|
||||
export { Commands, Command };
|
||||
export { Commands, Command, CommandSequence };
|
||||
|
||||
@@ -7,7 +7,7 @@ date: 2025-01-15
|
||||
image: "/blog/thinkpad-t440p-coreboot-guide/thumbnail.png"
|
||||
---
|
||||
|
||||
import { Commands, Command } from "@/components/mdx/command";
|
||||
import { Commands, Command, CommandSequence } from "@/components/mdx/command";
|
||||
|
||||
> **Interactive Script Available!**
|
||||
> Want to skip the manual steps in this guide?
|
||||
@@ -75,4 +75,230 @@ Flashrom should report that programmer initialization was a success.
|
||||
|
||||
## Extracting Original BIOS
|
||||
|
||||
To begin, first create a clean directory where all work to coreboot
|
||||
the T440p will be done.
|
||||
|
||||
<Command
|
||||
description="Create a directory where all work will be done"
|
||||
command="mkdir ~/t440p-coreboot"
|
||||
client:load
|
||||
/>
|
||||
|
||||
Next, extract the original rom from both EEPROM chips. This is
|
||||
done by attaching the programmer to the correct chip and running
|
||||
the subsequent commands. It may take longer than expected, and
|
||||
ensuring the bios was properly extracted is important before proceeding
|
||||
further.
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"sudo flashrom --programmer ch341a_spi -r 4mb_backup1.bin",
|
||||
"sudo flashrom --programmer ch341a_spi -r 4mb_backup2.bin",
|
||||
"diff 4mb_backup1.bin 4mb_backup2.bin"
|
||||
]}
|
||||
description="Backup and verify 4MB chip"
|
||||
client:load
|
||||
/>
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"sudo flashrom --programmer ch341a_spi -r 8mb_backup1.bin",
|
||||
"sudo flashrom --programmer ch341a_spi -r 8mb_backup2.bin",
|
||||
"diff 8mb_backup1.bin 8mb_backup2.bin"
|
||||
]}
|
||||
description="Backup and verify 8MB chip"
|
||||
client:load
|
||||
/>
|
||||
|
||||
If the diff checks pass, combine both files into one ROM.
|
||||
|
||||
<Command
|
||||
description="Combine 4MB & 8MB into one ROM"
|
||||
command="cat 8mb_backup_1.bin 4mb_backup1.bin > t440p-original.rom"
|
||||
client:load
|
||||
/>
|
||||
|
||||
## Building Required Tools
|
||||
|
||||
Now that the original bios has been successfuly extracted, it is time
|
||||
to clone the coreboot repository and build every tool needed to build
|
||||
a new bios image.
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"git clone https://review.coreboot.org/coreboot ~/t440p-coreboot/coreboot",
|
||||
"cd ~/t440p-coreboot/coreboot",
|
||||
"git checkout e1e762716cf925c621d58163133ed1c3e006a903",
|
||||
"git submodule update --init --checkout"
|
||||
]}
|
||||
description="Clone coreboot and checkout to the correct commit"
|
||||
client:load
|
||||
/>
|
||||
|
||||
We will need to build `idftool`, which will be used to export all necessary blobs
|
||||
from our original bios, and `cbfstool`, which will be used to extract __mrc.bin__(a blob
|
||||
from a haswell chromebook peppy image).
|
||||
|
||||
<Command
|
||||
description="Build util/ifdtool"
|
||||
command="cd ~/t440p-coreboot/coreboot/util/ifdtool && make"
|
||||
client:load
|
||||
/>
|
||||
|
||||
<Command
|
||||
description="Build util/cbfstool"
|
||||
command="cd ~/t440p-coreboot/coreboot/ && make -C util/cbfstool"
|
||||
client:load
|
||||
/>
|
||||
|
||||
## Exporting Firmware Blobs
|
||||
|
||||
Once the necessary tools have been built, we can export the
|
||||
3 flash regions from our original bios image.
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"cd ~/t440p-coreboot/coreboot/util/ifdtool",
|
||||
"./ifdtool -x ~/t440p-coreboot/t440p-original.rom",
|
||||
"mv flashregion_0_flashdescriptor.bin ~/t440p-coreboot/ifd.bin",
|
||||
"mv flashregion_2_intel_me.bin ~/t440p-coreboot/me.bin",
|
||||
"mv flashregion_3_gbe.bin ~/t440p-coreboot/gbe.bin"
|
||||
]}
|
||||
description="Export firmware blobs"
|
||||
client:load
|
||||
/>
|
||||
|
||||
## Obtaining mrc.bin
|
||||
|
||||
In order to obtain __mrc.bin__, we need the chromeos peppy image.
|
||||
This can be pulled by running the `crosfirmware.sh` script found in util/chromeos.
|
||||
|
||||
<Command
|
||||
description="Download peppy chromeos image"
|
||||
command="cd ~/t440p-coreboot/coreboot/util/chromeos && ./crosfirmware.sh peppy"
|
||||
client:load
|
||||
/>
|
||||
|
||||
|
||||
We can now obtain __mrc.bin__ using cbfstool to extract the blob from the image.
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"cd ~/t440p-coreboot/coreboot/util/chromeos",
|
||||
"../cbfstool/cbfstool coreboot-*.bin extract -f mrc.bin -n mrc.bin -r RO_SECTION",
|
||||
"mv mrc.bin ~/t440p-coreboot/mrc.bin"
|
||||
]}
|
||||
description="Extract mrc.bin using cbfstool"
|
||||
client:load
|
||||
/>
|
||||
|
||||
## Configuring Coreboot
|
||||
|
||||
Configuring coreboot is really where most of your time will be spent. To help out,
|
||||
I've created several handy configs that should suit most use cases, and can be easily
|
||||
tweaked to your liking. Here is a list of whats available:
|
||||
|
||||
1. GRUB2
|
||||
|
||||
This configuration features GRUB2 as the bootloader, and contains 3 secondary payloads,
|
||||
which the user can opt in/out of:
|
||||
|
||||
* memtest built in
|
||||
* nvramcui built in
|
||||
* coreinfo built in
|
||||
|
||||
This configuration also includes the dGPU option rom as well for T440p's featuring the gt730m on board.
|
||||
|
||||
2. SeaBIOS
|
||||
|
||||
3. edk2
|
||||
|
||||
> NOTE: Show the user how to choose the appropriate config, as well as building a custom config below.
|
||||
|
||||
## Building and Flashing
|
||||
|
||||
After configuring coreboot, it is time to build and flash it onto your unsuspecting T440p :D
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"cd ~/t440p-coreboot/coreboot",
|
||||
"make crossgcc-i386 CPUS=$(nproc)",
|
||||
"make"
|
||||
]}
|
||||
description="Build coreboot"
|
||||
client:load
|
||||
/>
|
||||
|
||||
Once the coreboot build has completed, split the built ROM for the 8MB(bottom) chip & 4MB(top) chip.
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"cd ~/t440p-coreboot/coreboot/build",
|
||||
"dd if=coreboot.rom of=bottom.rom bs=1M count=8",
|
||||
"dd if=coreboot.rom of=top.rom bs=1M skin=8"
|
||||
]}
|
||||
description="Split the built ROM for both EEPROM chips"
|
||||
client:load
|
||||
/>
|
||||
|
||||
Now flash the new bios onto your thinkpad!
|
||||
|
||||
<Command
|
||||
description="Flash the 4MB chip"
|
||||
command="sudo flashrom --programmer ch341a_spi -w top.rom"
|
||||
/>
|
||||
|
||||
<Command
|
||||
description="Flash the 8MB chip"
|
||||
command="sudo flashrom --programmer ch341a_spi -w bottom.rom"
|
||||
/>
|
||||
|
||||
Thats it! If done properly, your thinkpad should now boot!
|
||||
|
||||
## Reverting to Original
|
||||
|
||||
If for some reason you feel the need to revert back, or your T440p can't boot,
|
||||
here are the steps needed to flash the original image back.
|
||||
|
||||
### Can't Boot
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"cd ~/t440p-coreboot/",
|
||||
"dd if=t440p-original.rom of=bottom.rom bs=1M count=8",
|
||||
"dd if=t440p-original.rom of=top.rom bs=1M skip=8"
|
||||
]}
|
||||
description="Split original bios image for both EEPROM chips"
|
||||
client:load
|
||||
/>
|
||||
|
||||
<Command
|
||||
description="Flash the 4MB chip"
|
||||
command="sudo flashrom --programmer ch341a_spi -w top.rom"
|
||||
/>
|
||||
|
||||
<Command
|
||||
description="Flash the 8MB chip"
|
||||
command="sudo flashrom --programmer ch341a_spi -w bottom.rom"
|
||||
/>
|
||||
|
||||
### Can Boot
|
||||
|
||||
<CommandSequence
|
||||
commands={[
|
||||
"sudo sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/ s/\"/ iomem=relaxed\"/2' /etc/default/grub",
|
||||
"sudo grub-mkconfig -o /boot/grub/grub.cfg",
|
||||
]}
|
||||
description="Set kernel flag iomem=relaxed and update grub config"
|
||||
client:load
|
||||
/>
|
||||
|
||||
Reboot to apply `iomem=relaxed`
|
||||
|
||||
<Command
|
||||
description="Flash the original bios"
|
||||
command="sudo flashrom -p internal:laptop=force_I_want_a_brick -r ~/t440p-coreboot/t440p-original.rom"
|
||||
/>
|
||||
|
||||
And that about wraps it up! If you liked the guide, leave a reaction or comment any changes or fixes
|
||||
I should make below. Your feedback is greatly appreciated!
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
title: Thinkpad T440p Modification Guide
|
||||
description: You purchased a T440p, now what?
|
||||
author: Timothy Pidashev
|
||||
tags: [t440p, mods, coreboot, thinkpad]
|
||||
date: 2025-01-15
|
||||
image: "/blog/thinkpad-t440p-modification-guide/thumbnail.png"
|
||||
---
|
||||
|
||||
## The T440p
|
||||
|
||||
Whether for privacy related reasons, coreboot, or someones advice on the internet,
|
||||
you are now the proud owner of a T440p. Now what? Well, I have been daily driving
|
||||
this laptop for over two years now, and would like to share my knowledge on this
|
||||
lovely machine. If followed properly, this guide should help any privacy seeking
|
||||
individual or programmer how to setup the "reasonably" perfect T440p.
|
||||
|
||||
## Buying the Right Model
|
||||
|
||||
Although the T440p comes in various configurations and specs, when searching for
|
||||
one online there are two things to consider.
|
||||
|
||||
1. Online Marketplace
|
||||
* Purchasing from the right marketplace is important to consider, and while trusted
|
||||
vendors like Amazon might be preferred, consider Ebay or AliExpress.
|
||||
|
||||
* I personally have only purchased my thinkpad's on Ebay, as there are generally more listings
|
||||
available from companies reselling retired units, usually at a steep discount.
|
||||
|
||||
|
||||
2. Dedicated GPU
|
||||
* The T440p motherboard comes in two different varieties, one with
|
||||
a dGPU and the other without. There is only one dGPU model, which is the NVIDIA GT 730M.
|
||||
Featuring 2GB of VRAM, it will work, however if your looking for longer battery life and
|
||||
an easier coreboot config should you choose to coreboot, I would recommend sticking to
|
||||
a non dGPU variant.
|
||||
|
||||
* Finding a dGPU variant is quite difficult, as many online
|
||||
sellers don't always list the motherboard spec, making things quite the guessing game.
|
||||
When I was shopping for one, my strategy was to purchase the dGPU motherboard on its own,
|
||||
and then a T440p laptop listed with a dead motherboard, as I was going to swap it out anyways.
|
||||
|
||||
3. Quality
|
||||
* Finding the perfect T440p is hard, and you will likely end up purchasing one that looks ok
|
||||
in pictures, but comes with a cracked palmrest or front panel. Consider purchasing one which
|
||||
looks good, and then replacing any cracked or aged parts should you choose to do so in the future.
|
||||
|
||||
* T440p plastics are aged. Although this machine is an absolute brick, which can probably be thrown
|
||||
at the ground without any major damage, it will definitely chip and crack. I myself have replaced my
|
||||
palm rest/keyboard cover thrice, as every half a year or so I will open the laptop in the morning to
|
||||
find that my careless "throw it in the backpack" has finally cracked the palmrest yet again.
|
||||
|
||||
## Screen
|
||||
|
||||
When it comes to the screen, you really don't want to get one of poor quality, especially since the
|
||||
lousy 1366x768 panel is not great nowadays. Generally, I would recommend going for an ips 1080p panel,
|
||||
as this is generally most the most supported. I purchased this panel from amazon for ~$60USD and have
|
||||
never looked back.
|
||||
|
||||
## Keyboard
|
||||
|
||||
## Trackpad
|
||||
|
||||
## Battery
|
||||
|
||||
## CPU
|
||||
|
||||
The T440p has a trick up its sleeve. The processor can be swapped out and replaced, allowing for an upgrade!
|
||||
There are many models out there, however some aren't recommended due to thermal constraints, so finding the
|
||||
right balance can be tough.
|
||||
|
||||
## RAM
|
||||
|
||||
## Storage
|
||||
|
||||
## WLAN
|
||||
|
||||
## WAN
|
||||
|
||||
## MISC
|
||||
|
||||
1. Fingerprint Reader
|
||||
|
||||
2. Disc Reader
|
||||
|
||||
3. Webcam & Microphone
|
||||
Reference in New Issue
Block a user