I was looking for a new laptop and, perhaps surprisingly to some, I did not buy another Apple product. The reasons are my own, so I will not bother you with them. I needed the new product to run Linux, but also to pack some wallop, and have some sexy features. After all, if I'm making a once every 4-5 year purchase, I want to get some candy.
So having looked around, I found the very new Lenovo Yoga 2 Pro. I liked the look and feel of the Yoga, and for the extra features on the Yoga 2, I waited a few weeks. I have not been disappointed.
Now, remember that bit about Linux? My preferred release is Fedora, and when I found Kevin's Musings I made the decision. The new HW could run Fedora, but it might take some tweaking! Well, I spent quite a bit of time "tweaking", because I stupidly read, understood, and then ignored Kevin's closing comment about using rawhide. D'oh!
So this not very short blog post is to let others in on the how. With rawhide, obviously you get bleeding edge, which is why it worked so easily for Kevin. Most of the rest of us are not that brave. Especially when we are supposed to be busy looking after our employers HW, and not playing with our new toys. I spent many evening hours with the black screen, kernel crashes, generally failed attempts and a couple of successful Ubuntu (and Ubuntu variant) running. It still was not Fedora.
The cause of the difficulty is actually quite simple. The Yoga 2 Pro is very new, and only the more recent (read >3.10) kernels support some/all of it. So with Ubuntu 13.10 it runs and installs out of the box, but no network. This means you need to copy data around, without a network card, to get the wireless running, and then start tidying up the install.
With Fedora 19 install DVD (current release at time of writing), you get the 3.9 kernel and an EFI boot. This does not work, irrespective of how many tweaks you make to the UEFI/BIOS, and/or the kernel boot options. Below, I will explain how to fix this. I suspect this will work for most systems specified with Intel QHD+ graphics and EFI boot. With modifications for hardware/drivers/kernel versions, it should also be usable in the future as a guide for other Fedora type installs on new hardware, which is why I wrote it down. Personally, I am not going to need this for another 4 years or so.
If you are on form, you should be able to whip through this in about 30 minutes. Otherwise, reserve a couple of hours, to get it right.
With Fedora 19 install DVD (current release at time of writing), you get the 3.9 kernel and an EFI boot. This does not work, irrespective of how many tweaks you make to the UEFI/BIOS, and/or the kernel boot options. Below, I will explain how to fix this. I suspect this will work for most systems specified with Intel QHD+ graphics and EFI boot. With modifications for hardware/drivers/kernel versions, it should also be usable in the future as a guide for other Fedora type installs on new hardware, which is why I wrote it down. Personally, I am not going to need this for another 4 years or so.
If you are on form, you should be able to whip through this in about 30 minutes. Otherwise, reserve a couple of hours, to get it right.
What you need
First you need this:
- Fedora 19 install ISO
- USB capable of taking the image and extra software drivers (which means >4.5Gb)
- A piece of software such as Unetbootin (thanks guys!)
- Another computer running Linux (Fedora is going to match what I did, but you can work it out for yourself on anything else).
Part One
First, use those components to build a bootable USB stick for the install. I am not going to explain that. Go use Google and teach yourself something useful. It's a hell of a lot more satisfying than being spoon fed, and apart from anything else, if you cannot do that, you won't get the rest of this.
Test the USB stick like this:
Test the USB stick like this:
- Put it in the Yoga 2 Pro
- Boot it from the novo button
- Select the USB device in the boot menu (you do NOT need to make any other changes to the BIOS).
- Just press return when you get the first prompt (you might need reading glasses).
Next comes the most complicated parts. Skip to part four if you just download this init package. [This link does NOT work yet]
Part Two - initrd
We will take a kernel, and use it modify the init image from the Fedora 19 DVD.So, pick your second system. It does not need to match "Fedora 19", I took mine from a Fedora 18 system. Just for simplicity, I used an x86_64 source system, since I was building the init for an x86_64 install.
- Mount your USB stick (# mount -t auto /dev/sdX1 /mnt). You can find "X" in the output from dmesg.
- Make a working directory and cd to it (# mkdir /home/Working ; cd /home/Working/ )
- Copy the initrd file from the stick to your working computer. We will assume current directory is "Working" (# cp /mnt/images/pxeboot/initrd.img ./initrd.img.xz )
- Uncompress the initrd (# unxz initrd.img.xz # yes, add the extension if you missed it in the line above).
- Unpack the initrd.img file (# cd /home/Working/ ; cpio -idumv <initrd.img ; rm initrd.img ). The contents of /home/Working is now the source for your custom initrd file.
- Copy the entire /usr/lib/modules/3.11* tree to your new initrd tree (# cp -prv /usr/lib/modules/3.11* /home/Working/usr/lib/modules/ )
- Now convert the custom tree to a new img file (# find . |cpio -oc >../initrd.custom.img )
- Then compress it with xz (# cd .. ; xz --check=crc32 ./initrd.custom.img ; mv ./initrd.custom.img.xz ./Working/initrd.custom.img ).
- Copy the matching kernel to the same location (you can work that out for yourselves). Rename the kernel something obvious, for example vmlinuz-3.11
Part Three - squashfs
You now have a kernel which will boot, and recognise the screen. However,. it will not get much further. The next step is to build a custom squashfs.img and put it in the right place.
- Copy the squashfs.img off the USB stick ( # cp /mnt/LiveOS/squashfs.img /home/Working/ )
- Now create a mount point for it ( # mkdir /home/Working/mnt/ )
- Then mount it (# mount -t squashfs /home/Working/squashfs.img /home/Working/mnt )
- Now copy out the root FS image ( # cp /home/Working/mnt/LiveOS/rootfs.img /home/Working/ )
- Unmount the squashfs image (# umount /home/Working/mnt )
- Now mount the root FS image ( # mount -t auto /home/Working/rootfs.img /home/Working/mnt )
- Copy the entire 3.11 module tree to your new initrd tree (# cp -prv /usr/lib/modules/3.11* /home/Working/mnt/usr/lib/modules/ )
- Copy the new firmware driver ( # cp /usr/lib/firmware/iwlwifi-7260-7.ucode /home/Working/mnt/usr/lib/firmware/ ). If you do not have the firmware file, try yum ( # yum search firmware ), and install the relevant package. If that is too much, try Google.
- Now you have to blacklist the ideapad_laptop kernel module for the install. I will give you this one, just watch directory names if you have not used the structure I have here. (# echo -e "# We blacklist the ideapad laptop module so WiFi comes up for install\nblacklist ideapad_laptop" >/home/Working/mnt/etc/modprobe.d/blacklist-ideapad_laptop.conf )
- Unmount the image ( # umount /home/Working/mnt )
- Now we have to make a new squashfs file, so first we need a tree ( # mkdir -p LiveOS/LiveOS )
- Move the new root FS to the right location (# mv rootfs.img ./LiveOS/LiveOS/ )
- Make the squash FS ( # mksquashfs LiveOS squashfs.img -comp xz )
- Now move the new file back where it is needed ( # mv squashfs.img /mnt/LiveOS )
- Now change the USB root .treeinfo file ( # vi /mnt/.treeinfo ). Here is what I added:
[checksums]
images/pxeboot/initrd.custom.img = sha256:a1645adfd552eb771c3e5b52acc6ae2e198afb65277149c1e4d4663aae2512f9
images/pxeboot/vmlinuz-3.11.4 = sha256:96b9c349ecac69b755096b7213d5b95a46b98cc5c81b3ad8de4cdcc284bd3743
images/pxeboot/initrd.custom.img = sha256:a1645adfd552eb771c3e5b52acc6ae2e198afb65277149c1e4d4663aae2512f9
images/pxeboot/vmlinuz-3.11.4 = sha256:96b9c349ecac69b755096b7213d5b95a46b98cc5c81b3ad8de4cdcc284bd3743
These are (obviously) just the check sums for the initrd and kernel file. You can generate these with shasum -a 256 <FILE>. For help, try shasum -h or Google. I kept the files in images/pxeboot because it simplifies typing later.
Part Four
Now unmount the USB stick, and wait for the pretty lights to stop flashing ( # umount /mnt ), then remove the stick.
So what have you achieved at this point?
You have:
A new squashfs image file, containg the drivers and firmware for the network card.
A new initrd image with the drivers for the screen, and a more recent kernel which will support the drivers.
So what have you achieved at this point?
You have:
A new squashfs image file, containg the drivers and firmware for the network card.
A new initrd image with the drivers for the screen, and a more recent kernel which will support the drivers.
And Finally ...
Put the stick in to your Lenovo Yoga 2 Pro and boot it with the novo button. Simply select the relevant entry from the Boot Menu, and off we go. Next we have to tell the system to use the new files.
You do NOT need to disable secure boot, or make any changes to the BIOS/UEFI at all.
When you see the EFI boot options, just press "e". You are now in a small text area where you can change things to boot the new initrd and kernel. Make it look like this (assuming the files and directories are named as above):
You do NOT need to disable secure boot, or make any changes to the BIOS/UEFI at all.
When you see the EFI boot options, just press "e". You are now in a small text area where you can change things to boot the new initrd and kernel. Make it look like this (assuming the files and directories are named as above):
setparams 'Install Fedora 19'
linuxefi /images/pxeboot/vmlinuz-3.11 inst.stage2=hd:LABEL=DOODLE acpi_backlight=vendor quiet
initrdefi /images/pxeboot/initrd.custom.img
linuxefi /images/pxeboot/vmlinuz-3.11 inst.stage2=hd:LABEL=DOODLE acpi_backlight=vendor quiet
initrdefi /images/pxeboot/initrd.custom.img
One short note: When I formatted the USB stick, I called it DOODLE, that bit is up to you.
Then press Fn+F10 (unless you changed that in the Bios Settings).
Then press Fn+F10 (unless you changed that in the Bios Settings).
Troubleshooting
- Any references to unsupported filesystems and cows probably means you thought I made a typo. Actually, there really are 2 LiveOS directories above the rootfs thus: /home/Working/LiveOS/LiveOS/rootfs.img. Otherwise, there's something else wrong with the squashfs image file.
- The squashfs.img file looks too big? It should be about 280Mb. Just delete it, rebuild it, and copy it back to the USB stick.
- After install, if your wifi does not work, then you need to log in on a console, and repeat the ideapad_laptop blacklist, then remove the module ( # rmmod ideapad_laptop) and it should just start working. You can reboot if you want to.
Thanks
To Kevin for getting it right first, which gave me the direction for this.