36

Flashing the BIOS on the PC Engines APU4c4

 6 years ago
source link: https://www.tuicool.com/articles/hit/RVjYj2F
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Flashing the BIOS on the PC Engines APU4c4

I absolutely love the PC Engines APU devices. I use them for testing HardenedBSD experimental features in more constrained 64-bit environments and firewalls.

Their USB and mSATA ports have a few quirks, and I bumped up against a major quirk that required flashing a different BIOS as a workaround. This article details the hacky way in which I went about doing that.

What prompted this article is that something in either the CAM or GEOM layer in FreeBSD 11.2 caused the mSATA to hang, preventing file writes. OPNsense 18.7 uses FreeBSD 11.1 whereas the recently-released OPNsense 19.1 uses HardenedBSD 11.2 (based on FreeBSD 11.2). I reached out to PC Engines directly, and they let me know that the issue is a known BIOS issue. Flashing the "legacy" BIOS series would provide me with a working system.

It also just so happens that a new "legacy" BIOS version was just released which turns on ECC mode for the RAM. So, I get a working OPNsense install AND ECC RAM! I'll have one bird for dinner, the other for dessert.

Though I'm using an APU4, these instructions should work for the other APU devices. The BIOS ROM download URLs should be changed to reflect the device you're targeting along with the BIOS version you wish to deploy.

SPECIAL NOTE: There be dragons! I'm primarily writing this article to document the procedure for my own purposes. My memory tends to be pretty faulty these days. So, if something goes wrong, please do not hold me responsible. You're the one at the keyboard. ;)

VERY SPECIAL NOTE: We'll use the mSATA drive for swap space, just in case. Should the swap space be used, it will destroy what ever is on the disk.

This post also assumes you know your way around a BSD system. You'll need to modify some commands to accomodate your setup.

Well, get on with it already!

So, you'll need a few things before we get started. You'll need to download a HardenedBSD installation image. Use the memstick image, since we're going to boot off of a USB thumbdrive.

The latest build of 12-STABLE/amd64 can be found here

Write that to your thumbdrive:

# dd if=HardenedBSD-12-STABLE-v1200058.2-amd64-mini-memstick.img \
    of=/dev/da0 bs=64k status=progress

Plug the memstick into your APU. Attach your serial cable to your system, and connect to it using cu(1) :

# cu -s 115200 -l /dev/cuaU0

When prompted, press F10 and boot from USB. You will see the HardenedBSD bootloader screen pop up. Select the third option, "Escape to Loader Prompt".

Type in the following commands for serial console access:

set comconsole_speed="115200"
set console="comconsole"
boot

You'll be prompted to select the terminal type. In my case, I enter "xterm". Next, you'll be selected with options to install HardenedBSD. Select LiveCD mode instead and login with the password-less root account.

We're going to set up swap first, in preparation for a ramdrive that will hold a chroot filesystem. We'll create a 3GB ramdisk that will hold the live environment. We'll format the ramdisk as UFS, mount it, and create two directories; one to hold a downloaded binary update and the other to hold the chroot filesystem. Following that, we'll set up networking.

# gpart destroy -F ada0
# gpart create -s gpt ada0
# gpart add -t freebsd-swap -s 2g ada0
# swapon /dev/ada0p1
# mdconfig -a -s 3g
# newfs md0
# mount /dev/md0 /mnt
# mkdir -p /mnt/update/../root
# dhclient igb0

HardenedBSD created a binary update utility for base, similar in scope to freebsd-update(8) , called hbsd-update(8) . We'll use that to populate /mnt/root . We'll then copy over /etc/resolv.conf so that DNS works within the chroot. Finally, we'll mount devfs(5) in the chroot.

# hbsd-update -VdnU -t /mnt/update -r /mnt/root
# cp /etc/resolv.conf /mnt/root/etc/
# mount -t devfs devfs /mnt/root/dev

We're now ready to dive into our chroot environment. We'll install the flashrom and ca_root_nss packages, download BIOS v4.0.23, and flash it.

VERY SPECIAL EXTRA CRUCIAL NOTE : Make sure you're downloading the right BIOS for your system! Do NOT blame me if you simply copy these next commands verbatim without first ensuring they apply to your system.

At the time of this writing (05 Feb 2019), the BIOS releases can be found here .

# chroot /mnt/root
# pkg install -y flashrom ca_root_nss
# fetch http://pcengines.ch/file/apu4_v4.0.23.rom.tar.gz
# tar -xf apu4_v4.0.23.rom.tar.gz
# flashrom -p internal:boardmismatch=force -w apu4_v4.0.23.rom

That is it! You've now flashed the "legacy" BIOS on your APU4! Go ahead and shutdown the system with shutdown -p now and go about your merry way! I know I'll be enjoying my new OPNsense 19.1 installation.


Recommend

  • 24
    • Github github.com 5 years ago
    • Cache

    Defeating a Laptop's BIOS Password

    Defeating a Laptop's BIOS Password We found a laptop laying around the office that had BIOS password enabled. On top of that, the laptop had secure boot turned on. We wanted to run an OS that was not signed wit...

  • 16

    Restoring stock BIOS on a Braswell Chromebook with a broken rom Jun 16, 2017 Since Braswell is still widely unsupported in the world of Chromebooks (no public Tianocore/Windows rom released yet)...

  • 47

    百敖BIOS中文视频培训一:BIOS启动总览中央处理器 (CPU)话题下的优秀回答者请到UEFI内核Edk2开源项目的维护者和Stable tag的维护者,百敖内核架构师高黎明,带来百...

  • 11

    内存为什么要Training? 内存初始化代码为什么是BIOS中的另类?

  • 27
    • www.pixelbeat.org 4 years ago
    • Cache

    Updating the BIOS using linux

    Updating the BIOS using linux The first logic executed on most computers is the BIOS. Essentially it sets up hardware specific to the system, and then passes control to a general purpose operating system. The BIOS has traditionally be...

  • 10

    华硕AMD 500/400主板Agesa 1.2.0.新BIOS上线华硕AMD 500/400主板Agesa 1.2.0.新BIOS上线 2021-01-15 18:28:39  来源:互联网 摘要:为带给大家更好的性能体验,华硕AMD 500、400系主板官网已上线新BIOS(AM4...

  • 28

    BIOS/UEFI培训终于上线了,小伙伴一起来吧中央处理器 (CPU)话题下的优秀答主借助卓易信息【688258】强大的云服务和专业的技术能力,我筹划了几个月的卓易云课堂终于上线了!(...

  • 5

    BIOS云课堂增加UEFI界面和SCT全解系列内容!中央处理器 (CPU)话题下的优秀答主BIOS的设置界面是给用户的第一印象,也是的BIOS开发需要重点着力的地方。UEFI内核维护者高黎明为你讲...

  • 83
    • soggi.org 3 years ago
    • Cache

    soggi's BIOS & Firmware Page

    soggi's BIOS & Firmware Page Welcome to soggi's BIOS & Firmware Page! Get BIOSes, firmware, drivers, manuals, patches, tools, utilities, tech demos, other downloads and specifications for your legacy/retro/vintage PC...

  • 8

    BIOSConnect function provides perfect conditions for attacks Due to Dell's flawed update method, hackers may be able to exploit four separate vulnerabilities in order to gain complete control of aff...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK