A bridge to Cuntoo: for the Lenovo x61 (x86_64)

For additional Cuntoo baking documentation, see:




The following is my collected notes on my journey to a bootable Cuntoo usb drive for use with the Lenovo x61. This was a 'clean slate' restart from my previous (failed) attempt, as this time around I installed a heathen, hand-rolled Gentoo on the Lenovo first, then used the Lenovo to install Cuntoo to a usb drive, then booted the Lenovo from the usb drive.

Before I get into the details, here's the vpatch produced and kernel config1 used:

genesis.vpatch (trinque's keccak sig, for convenience)


Note: Sig verified for me after making the recommended change to line 14 of scripts/make_portage_tree.sh

Step 0: For the love of Christ, remember to use Screen. (or at least some kind of sane logging)

On my first run-through, I had the great gall to forgo typing "screen -L" before starting my adventures. While perhaps obvious to most, it is something that no one ever wished they didn't do.

Step 1: Install the heathen Gentoo

I used a Gentoo "LiveUSB"2 and a recent stage3 tarball3 from https://www.gentoo.org/downloads/, then proceeded to follow the Gentoo handbook:


This was my first successful Gentoo install, so it took me about 2 weeks of reading that handbook4 and troubleshooting various woes, but eventually I got it. For the more seasoned Gentoo-ists in the audience, this will probably be the easier part.

Step 2: Get your Republican toolbox in order (on the Gentoo bridge):

Make sure you have the proper gcc and gnupg versions

I had applied asciilifeform's battle-tested crapolade masks to  /etc/portage/package.mask, but I must've forgotten something because after Gentoo installed I found that I still needed to roll my gcc and gpg versions back.

First, I had to set a  /etc/portage/package.unmask on:


Then emerged gcc:

emerge -a =gcc-4.9.4

This took roughly 2 hours or so, afterwards:

gcc-config 1


Apparently, the portage I ended up with5 required at least gnupg 2.2.4, so I had to roll my portage back to 2.3.8 so it'd play nice with gnupg-1.4.21:

emerge -a =sys-apps/portage-2.3.8

emerge -a =app-crypt/gnupg-1.4.21

Install musl

This was pretty straightforward, and most of what I needed was in the faq https://www.musl-libc.org/faq.html. For reference, the release I used was https://www.musl-libc.org/releases/musl-1.1.21.tar.gz. From the horse's mouth:

How do I build musl?

In short, simply run ./configure and make. By default make install installs to /usr/local/musl. You may override this by passing --prefix to configure...

...For further details, see the INSTALL file provided with the source distribution.

Note: after installing, remember to add it to your PATH, e.g.:

export PATH=$PATH:/usr/local/musl/bin

You can test that you added it by issuing something like the following:

musl-gcc -v

Install Adacore GNAT 2016

In order to build ave1's GNAT later, you need Adacore GNAT 2016 first.

Head to https://www.adacore.com/download/more, filter on "x86 GNU Linux (64 bits)" and for the year choose "2016". Grab the tar, and the README.txt. Read and follow the latter.


SHA-1: 18da74a0ac9df2753bfd9b3d2dcad6e3379825c2


SHA-1: 845147a8c6ef6af29a68144d6b3d228fd226268e

Like with the musl install, remember to add the directory gnat was installed in6 to your PATH. Issue something like "gnatmake -v" to verify

Build ave1's GNAT:

Head to http://ave1.org/2018/building-gnat-on-musl-no-more-usrincludex86_64-linux-gnu/ and follow the excellent README.

Note: As always.. PATH! However, this time, make sure your heathen GNAT is no longer in your path and ave1's is.

Get a V setup going that calls out to phf's vtools:

You will need a V that uses phf's keccak-ized vtools. hanbot covers this topic pretty thoroughly in her notes (linked at the top), so I won't rehash too much.

For me, I ended up going with diana_coman's setup outlined in http://ossasepia.com/2018/11/13/v-with-vtools-keccak-hashes-and-its-own-tree/, and it is working splendidly.

Step 3: Cuntoo

This is amply documented at this point, both on trinque.org and the other guides, so I see no need for a step-by-step.

However, I did hit the following rock using my initial kernel config. The following spew erupted in the middle of building the kernel7:

error reading elf file init/calibrate.o

make[1]: *** [scripts/Makefile.build:294: init/calibrate.o] Error 1

make[1]: *** Waiting for unfinished jobs....

GEN     usr/initramfs_data.cpio.gz

AS      usr/initramfs_data.o

elf_getdata: No error information

error reading elf file usr/initramfs_data.o

.... [and so on for a dozen or so more files] ...

Now, I have not confirmed 100% this was what my issue actually was, but I ran across the following bug report in the wild that described symptoms that were similar to mine: http://lkml.iu.edu/hypermail/linux/kernel/1508.1/02478.html

Apparently there's a kernel option called CONFIG_STACK_VALIDATION that does some checks at compile time, analyzing all the .o files and validating the metadata. It is also supposed to be disabled by default, but I somehow managed to enable it. And according to the bug report:

These are caused by circular dependencies. The %.o pattern rules in
scripts/Makefile.build have the stackvalidate binary listed as a
dependency. But stackvalidate gets built *after* archprepare and
scripts/mod, both of which build objects using the %.o pattern rules.

So, it looks like scripts/Makefile.build tries to look for stackvalidate before it is built, causing some barf.

Anyways, disabling CONFIG_STACK_VALIDATION by setting it to "blank" did the trick for me8. Kernel built without issue.

...and that was it! After my kernel config woes were out of the way, the rest went smoothly. The Lenovo booted into Cuntoo from the usb stick and I was able to login with the user/pass I had set.

  1. generated via 'make menuconfig' []
  2. install-amd64-minimal-20190115T214502Z.iso []
  3. specifically: stage3-amd64-20190122T214501Z.tar.xz []
  4. indeed, I made sure it was word by fucking word []
  5. 2.3.51-r1 []
  6. for me, this was '/usr/gnat/bin' []
  7. If you're using the handy "bootstrap.sh", the lower-level "enter_chroot.sh" contains the call to "make all'" []

One Response to “A bridge to Cuntoo: for the Lenovo x61 (x86_64)”

  1. [...] went through both lobbes' and mod6's recent cuntoo adventure reports to look for clues on kernel configuration, and found I [...]

Leave a Reply