2

I recently bought an HP Stream, which is a neat, cheap laptop that I intended to install Xubuntu on. Unfortunately, I have been running into problems due to its eMMC drive.

I found it seems to be impossible to install any version of Linux (I've tried the Ubunbtu families, Debian, and Arch) without applying this kernel patch.

Although I'm familiar with Linux as an operating system, I've never had to actually apply a kernel patch, and I'm completely unsure how to do this to suit my purposes. Tutorials I've found yet far are for advanced users looking to upgrade their current running OS.

From my reading, it is possible to compile the kernel on a different machine as long as the have the same architecture. (Both computers are x64) and have the necessary drivers.

My questions are:

How can I apply this kernel patch?

How can I install it on my machine (ISO?)

I understand this is potentially a long and detailed Q&A, but I've somewhat run out of ideas.

2

I think it's not super easy, if there were any kernel boot options that might help boot the HP with a standard kernel (like noapic, nomodeset, etc) I'd try those first.

Some instructions are too long & varied to post here [ https://help.ubuntu.com/community/Kernel/Compile ], but one page actually looks almost reasonable, if you're compiling for the same architecture & Ubuntu release.

These steps are for compiling a kernel on your current machine, if it's the same "type" x64 and running the same Ubuntu version it might work. [From https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel ]:

Obtaining the source for an Ubuntu release

Either

  • Either apt-get source linux-image-$(uname -r)
  • Or git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release codename>.git
    For example to obtain the precise tree:
    git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git

Build Environment

If you've not built a kernel on your system before, there are some packages needed before you can successfully build. You can get these installed with:

sudo apt-get build-dep linux-image-$(uname -r)

Modifying the configuration

[ Here's the part where you'd apply your patch. That link looks like the patch just modifies drivers/mmc/card/block.c, so that file should be in the downloaded source files. It looks like it just adds a little bit to one line, so if you wanted to manually edit the one line with copy & paste that should work, it just removes the "-" starting lines and adds the "+" starting lines. Or using the patch program with patch --verbose -p1 <the_patch_file (maybe without the -p1 if it doesn't work, controls how it finds the file to patch, see man patch for info). If you're not doing other changes I'd skip the rest as the instructions suggest. ]

This step can be skipped if no configuration changes are wanted. The build process will use a configuration that is put together from various sub-config files. The simplest way to modify anything here is to run:

chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
fakeroot debian/rules clean
fakeroot debian/rules editconfigs

This takes the current configuration for each architecture/flavour supported and calls menuconfig to edit its config file. The chmod is needed because the way the source package is created, it loses the executable bits on the scripts.

apt-get will try to "upgrade" the kernel to the stock build/version of the Ubuntu kernel if you build a custom kernel without appending an extra string to the end of your kernel version. To prevent apt-get from listing the Ubuntu kernel as upgradeable when you type apt-get upgrade, you must (from the kernel documentation) append an extra string to the end of your kernel version. This will show up when you type uname, for example.

To prevent this, in the Kernel Configuration Menu, navigate and modify:

  1. General setup --->
  2. () Local version - append to kernel release

Building the kernel

Building the kernel is quite easy. Change your working directory to the root of the kernel source tree and then type the following commands:

fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary-generic

If the build is successful, a set of three .deb binary package files will be produced in the directory above the build root directory. For example after building a kernel with version "2.6.38-7.37" on an amd64 system, these three (or four) .deb packages would be produced:

cd ..
ls *.deb
    linux-headers-2.6.38-7_2.6.38-7.37_all.deb
    linux-headers-2.6.38-7-generic_2.6.38-7.37_amd64.deb
    linux-image-2.6.38-7-generic_2.6.38-7.37_amd64.deb

on later releases you will also find a linux-extra- package which you should also install if present.

Testing the new kernel

Install the three-package set (on your build system, or on a different target system) with dpkg -i and then reboot:

sudo dpkg -i linux*2.6.38-7.37*.deb
sudo reboot

About the installing it part, I wouldn't bother building an ISO (with something like remastersys) that's probably just another headache ;-)

If you could just copy the files over to the hard drive that might work. I'd usually suggest a linux live cd/usb, but if Ubuntu won't boot... maybe a different distro with a different kernel, or use windows to copy the files, or a partition image and a windows-equivalent dd tool?

  • Thanks for taking the time to write this. What about applying the patch? – Alexander Lozada Dec 20 '14 at 14:58
  • Added a bit about using it the "Modifying..." section, in []'s. FYI, if you're not familiar with them, the patch is the part of the linked page from diff --git ... down, really just modifying that - line into the + line (the - & + characters are just for patch's reference, not part of source) – Xen2050 Dec 20 '14 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.