r0l1 / razer_blade_14_2016_acpi_fix

ACPI firmware fix for the Razer Blade 14 2016
36 stars 7 forks source link

Newb-friendlier documentation #5

Open toastal opened 7 years ago

toastal commented 7 years ago

I've been able to generate the img file, but I really have no idea how to get it working with GRUB. Is that possible? Where do I begin looking?

zachbr commented 7 years ago

You can chain multiple archives to initrd, so I just changed the grub2 /etc/grub.d/10_linux script to alter the definitions of initrdefi to load the created CPIO archive.

...
linux_entry ()
{
  os="$1"
  version="$2"
  type="$3"
  isdebug="$4"
  args="$5"

  sixteenbit=""
  linuxefi="linux"
  initrdefi="initrd"
  case "$machine" in
    i?86|x86_64)
    sixteenbit="16"
    linuxefi="linuxefi"
    initrdefi="initrdefi /razer_acpi_fix.img"
    ;;
    aarch64)
    linuxefi="linux"
    initrdefi="initrd /razer_acpi_fix.img"
    ;;
  esac

  if [ -z "$boot_device_id" ]; then
...

Someone will come along and say this is not the right way to handle it, because it probably isn't, but I couldn't find anything better while I was digging around.

After you make this change, regenerate your grub2 config.

Edit: and while I'm here, I'd like to thank the author for this CPIO fix. It's much better than specifying "Windows 2009" and losing my touchpad and who knows what else.

r0l1 commented 7 years ago

I recommend to use systemd-boot. That's easier :)

kachunkachunk commented 7 years ago

A couple of folks recommend that, heh. Well, for Grub2, feel free to put this in your wiki or guide later, following any necessary refinement:

Edit /etc/grub.d/10-linux and locate the initrd generation line containing intel_ucode. It should look like ${intel_ucode} ${rel_dirname}/${initrd} at about line 150.

You then want to insert ${rel_dirname}/razer_acpi_fix.img. And this assumes you are installing the file in /boot, by the way.

Your end result is: initrd ${rel_dirname}/razer_acpi_fix.img ${intel_ucode} ${rel_dirname}/${initrd}

From there, you should then be able to run update-grub safely. It should also persist through reboots. But consider a few tweaks as well:

Depending on the problems you face, there may be other tweaks necessary, inserted in /etc/default/grub. For GRUB_CMDLINE_LINUX_DEFAULT, add nouveau.blacklist=1 button.lid_init_state=open pcie_port_pm=off before quiet splash

Run update-grub again to persist your changes and reboot. During startup, edit the Grub boot line to double-check your work. You should see the initrd line now starts with /boot/razer_acpi_fix.img, then goes on with intel_ucode and so forth. It should just boot without changes, so hit F10. If you get stuck on boot again, you'll probably need to correct this boot line on your next startup attempt and manually load the image again (initrd=[path-to-razer_acpi_fix.img]; maybe you supplied a bad path), you might have an issue with your image file (check for updates or issues on Git), or it really is some other issue and you might have to explore this further via another Live CD.

These should help resolve some Bumblebee and suspend lid misbehaviors. YMMV for anything not Arch/Manjaro, but in my experience with Ubuntu it really should not vary much, if at all.

(lots of edits. Also I realize AMD users probably won't see intel_ucode...)

I'll have to post a guide for the folks like myself that had a Live CD installers hang without this fix. It's mostly going to be the same with some additions like editing the ISO so it has the fix in it.

ghost commented 7 years ago

@kachunkachunk Thanks a lot for sharing how to make it 'update-grub' safe. I've been looking for a way to do this but didn't know where to put it.

I'm running Ubuntu GNOME 17.04 and the config line is a bit different from yours. The line, located at around 200, looks like

sed "s/^/$submenu_indentation/" << EOF
    initrd ${rel_dirname}/${initrd} 

After editing:

sed "s/^/$submenu_indentation/" << EOF
    initrd  ${rel_dirname}/razer_acpi_fix.img ${rel_dirname}/${initrd}

and I have a perfectly working /boot/grub/gru.cfg with the ACPI fix. There is no intel_ucode line anywhere in my /etc/grub.d/10_linux though.

JeremyBYU commented 7 years ago

Just wanted to chime in that I had the same situation has @lungten and his changes worked! Thanks everyone.

kachunkachunk commented 7 years ago

Happy to help. A more living doc for this, at least for now, can also be found here. It's subject to author approval but I'm sure you can find the intended suggestion.

I also think intel_ucode may be incorporated if you install linux-firmware, but I can't quite confirm this (running Manjaro, and indeed that's a big reason for the 50+ line difference we have heh).