Clone your disk using Jeltka

Please note, if you don’t understand what’s going on here, it’s very easy to screw the source partition up, and lose your data! Be warned!

Obviously, boot into Jeltka first. Then, check the filesystem of the partition in question, in preparation for resizing the filesystem to it’s minimum size (please note, you may need to adjust device names accordingly):

e2fsck /dev/sda1

Then resize the filesystem to it’s smallest possible size using the -M flag of resize2fs:

resize2fs -M /dev/sda1

Mount the filesystem, check it’s size using df, and unmount it again (so fdisk can write the partition table successfully, later on):

mount /dev/sda1 /mnt

df -h

umount /dev/sda1

Now, we also need to reduce the size of the partition itself. This is so dd doesn’t copy more data than necessary (which could save you a lot of time). In the interests of safety, it’s always a good idea to make the partition at least 1GB bigger than the filesystem (fdisk and resize2fs, etc. calculate sizes in slightly different ways, the extra partition size ensures the partition is big enough to contain the filesystem). We also need to be careful because the version of fdisk included with Busybox uses the old 63 sector, default starting point for partitions, and your disk is probably partitioned with a 2048 sector starting point (this became the default in standard fdisk with the advent of GPT partitioning some years ago).

fdisk /dev/sda

To accommodate previous, we now change display units to sectors by pressing “u”. Press “p” to print the existing layout, to confirm the partition does indeed start at sector 2048. Then delete the existing partition – “d” followed by “1” (assuming the partition we’re concerned with is the first partition on the disk). Now we create a new partition with the same starting point – “n”, “p”, “1”, “2048”, “+14G” (where 14G is the size in gigabytes, you want the partition to be). Now type “p” again, and double check everything is as it should be, before hitting “w” to save the partition table and exit. Don’t worry too much if you’ve messed up here, as long as you can create a partition with the same starting point as the original, and enough size to accommodate the filesystem contained on it, you won’t lose any data. However, if you do something rash like create a new filesystem on an incorrectly sized/started partition, you will in fact be overwriting your nice data. In short, don’t do it!

Now we’re ready to do the actual copying using dd. I’m assuming here that you have a USB key/drive attached, and you’re going to output the partition image to a file on the USB key, with a view to dd’ing it onto a replacement HD/SSD, which you’ll physically put in your Chromebook subsequently. I’m assuming the USB key already has a compatible filesystem on it (ext4, FAT or NTFS, IIRC). Again, be careful to use the correct device name. First we’ll mount the USB stick somewhere suitable:

mount /dev/sdb1 /mnt

We should also backup the existing partition table and boot sector thusly:

dd bs=512 count=1 if=/dev/sda of=/mnt/bootsector.img

Then we’ll dd the partition to a file on the USB stick:

dd bs=1M if=/dev/sda1 of=/mnt/partition.img

If we had another console available, we could check on dd’s progress like so – find dd’s process number, and send a signal to it, to display progress every 60 seconds:

ps -e |grep dd

watch -d -n 60 kill -SIGUSR1 1234

Where “1234” is dd’s PID (will undoubtedly be something else entirely).

Assuming you didn’t run out of space on your USB whatever, dd will have completely successfully (eventually), and you can now set about swapping your HD/SSD out for a nice, shiny, big one. :)

Back already? Okay, now we’re ready to copy the partition table/bootsector over, and create a new partition to take advantage of all that space! Make sure you’ve mounted the USB whatever again.

dd if=/mnt/bootsector.img of=/dev/sda

Then use fdisk to create a new partition, as we did previously, only this time don’t specify a size (it will default to the end of disk).

Then, copy the partition image to the new partition we just created, using dd:

dd bs=1M if=/mnt/partition.img of=/dev/sda1

When this has finished, check you can mount the filesystem! Assuming you can, we can now resize the filesystem to take advantage of all that juicy space you’ve just purchased:

e2fsck /dev/sda1

resize2fs /dev/sda2

Success?

Another Month, Another ROM

“Yay”, I hear you say – someone has actually found a bona fide, reproducible problem with the last release. Apparently, the keyboard polling option in SeaBIOS causes double keyboard output in Grub, with devices which are capable of keyboard output via IRQ. So, I’ve made another release with the keyboard polling option of SeaBIOS removed. I recommend everybody using the last release (18/11/14) update if they ever envisage needing to use the Grub shell. Happy holidays!

A Call To Arms

Right, ladies and gentlemen. It’s time to give a little something back to the coreboot community who’ve made all this possible. I’ve created a self-extracting binary which will upload some information about the ROM you’re currently using (along with your dmesg output from boot) to the coreboot board-status repository. This repository is hopefully to be used to ascertain which boards a) currently work with coreboot and b) should remain “live” within the coreboot codebase. You will need an account at review.coreboot.org to post this output. Logging in with your Google account is fine, but you will then need to go to http://review.coreboot.org/#/settings/http-password to find out what your username and password is to actually post the output (once the script tries to upload it using git).

What we would really like to see is hundreds of commits, as the repository has so far not been used very much. By putting everything into this self-contained, self-extracting script, the idea is to reduce the amount of dependencies and get a lot more people uploading information. I’d appreciate it if anyone reading this and using one of my ROM’s would download and run https://johnlewis.ie/board-status.run forthwith. Thanks.

New ROM Release – 181114

There’s a new ROM release today. What’s changed? Not very much, hopefully:

  1. Same underlying coreboot build/revision.
  2. Updated SeaBIOS which aside from improved SD/MMC support contains a “keyboard-polling” option, which may (or may not) have an effect for people who’ve been experiencing keyboard issues.
  3. Some slight tweaks to Jeltka, the main of which being the addition of the tg3 driver for the C710, so C710 owners can use Jeltka with a wired connection.

If your current ROM is working well, there’s no need to update, but this release will hopefully help improve things for the people who’ve had niggly problems.

Tentative fix/work-around for i915 GPU hangs

Some of you may have noticed the GPU hangs on Haswell Chromebooks in recent versions of you favourite distro. Well, a man called Fabrice G. (via email) furnished me with what appears to be a fix, this afternoon. It’s rather a long addition to the kernel cmdline, and I’m not sure if *absolutely* all of it is needed, but it certainly appears to be doing the job on my HP Chromebook 14, in CentOS 7, with a 3.17 kernel.

Simply add the following to GRUB_CMDLINE_LINUX in /etc/default/grub:

drm.debug=0 drm.vblankoffdelay=1 i915.semaphores=0 i915.modeset=1 i915.use_mmio_flip=1 i915.powersave=1 i915.enable_ips=1 i915.disable_power_well=1 i915.enable_hangcheck=1 i915.enable_cmd_parser=1 i915.fastboot=0 i915.enable_ppgtt=1 i915.reset=0 i915.lvds_use_ssc=0 i915.enable_psr=0 

then run:

su -c "grub2-mkconfig > /boot/grub2/grub.cfg"

in CentOS/Fedora, or:

update-grub

in Debian/Ubuntu/etc

Enjoy!

Intermittent Website Issues

Apologies if you received a 502 “Bad Gateway” error when trying to visit the site in the last number of days/weeks – for some reason, without any apparent configuration change (although I guess there must’ve been a change in a default config somewhere) the server has decided to start resolving localhost as both 127.0.0.1 *and* ::1. What governs which result is returned, I do not know, but the PHP FPM backend is only listening on the IPV4 address. Consequently, when ::1 gets returned for localhost and Nginx attempts to connect, there is nothing listening on that address and port, hence the error.

I’ve since hard-coded 127.0.0.1 into the necessary config files, and the logs look good so far. Hopefully the number of visitors will stop going down now. ;)

Backpedalling

Another day, another slew of ROM’s. The evolution continues. Today’s is mostly about fixing things in the previous release (01/09/14). So, what’s in this release, I hear you ask?

  1.  I’ve removed the Intel framebuffer driver from Jeltka because Kernel Mode Setting doesn’t play nicely with kexec. Despite being a nice idea, VGA ROM independent Jeltka is therefore off the table.
  2. In addition to the automation and stability recently introduced by the script, having a separate coreboot tree for each base model (currently 12 not including the 2 ChromeOS coreboot trees I’ve kept hanging around after switching to upstream coreboot for Falco and Peppy), and moving to an md5sums file arrangement (simplifying upload and script maintenance), I’ve moved to having a “links” file for Haswell and Sandybridge/Ivybridge based Chromebooks, and using the same graphics id’s (0106 for Sandy/Ivybridge, 0406 for Haswell) across the board. This means there is much reduced chance of PEBKAC and ID-10T from my end resulting in ROM’s which don’t initialise the display (and leaving it to a Linux kernel to do it).
  3. The make process is now even simpler – make clean x 2, make, add choice of 2 links files, add Jeltka, upload.
  4. There will be *NO* Flashrom in Jeltka, as flashing with upstream Flashrom isn’t possible unless you’ve already used an external programmer on your Chromebook’s SPI chip. In lieu of that, I now recommend starting an Arch install to the point where you’ve setup the network, and then change VT’s to download flashrom and a ROM from my site. Similarly this is my recommended method of rescue, as the arch installer/rescue also has useful utils like Testdisk.

ROM Updates – 01/09/14

All ROM’s for all models have been updated. The main changes are:

  1. Subsystem vendor ID’s added to Falco, Peppy, Leon, and Wolf to ensure back-light is enabled by kernel > 3.15.
  2. All ROM’s now using a 4 MB CBFS with Jeltka as an ELF payload (this removes size overhead and other complications of floppy images).
  3. Jeltka updated to load the i915 frame-buffer driver (which means even if there’s something wrong with the VGA binary/ID’s you can still get a display by pressing ESC and 2 at the right times, assuming no USB device plugged in).
  4. Added e2fsprogs/fdisk/USB/MMC support to Jeltka (for basic filesystem/partition checking and manipulation). Be careful of Buildroot’s version of fdisk as it defaults to a first sector at 63 and DOS compatibility mode, and, if you switch it off by pressing “c”, fdisk will default to a first sector of “1”. This will probably cause problems, as most distros default to sector 2048 for alignment purposes. It means that resizing your filesystem will be tricky, if you forget to to recreate the partition at 2048, and it may appear that your filesystem is therefore b0rked!
  5. TPM conditionalised in dsdt.asl for any boards that have it, to avoid TPM being enabled and causing issues with suspend.
  6. I’ve made my own Panther/Zako compatible ROM to enable the 4MB CBFS for that model.

As always see the download page.

Suspend fixed in C720/Peppy ROM

As the name implies, suspend is fixed in the C720/Peppy ROM’s. Turns out I had forgotten to conditionalise/remove something from the board’s DSDT, which I didn’t forget for Falco/HP Chromebook 14.

Additionally, I have updated all the other Haswell Chromebook ROM’s to make sure the DSDT is suitable in those.

Jeltka has also had i915 frame buffer support added, so even if something is wrong with the graphics ID/ROM, you can still easily get the display to work. There’s probably something else in there which escapes me, but that seems like enough for the moment.

Linux & custom Chromebook firmware