I use a generic Fedora image on the Pi 2 and there is a bit of work you must do to adapt that in order to get to everything to work properly. This will apply equally to any distro that does not target the pi specifically, so you should have a read through that.
Even if you do want to use your own kernel in the end, it is probably best to first test your set-up using the ready made one distributed on github by the Rpi Foundation.
https://github.com/raspberrypi/firmware/tree/master/boot
This is actually the entire /boot
partition contents, so you might as well just use a copy of the whole thing. However, you will also need to install the corresponding modules into the root filesysem (i.e., the Ubuntu partition). As far as I have noticed, the firmware repo is maintained such that there is only one version of the kernel, in two flavors, one for the ARMv6 models and one for the the ARMv7/8 models, and the corresponding module directories are in another section of the "firmware" repo heirarchy:
https://github.com/raspberrypi/firmware/tree/master/modules
You should copy those directories into the /lib/modules
directory in the root fs. There will already be stuff there, possibly including directories for same base kernel version, but thanks to the suffixes used (by the Foundation, +
and -v7+
, by Ubuntu something longer) there should be no collisions. The Ubuntu ones will never be used and will probably take up a fair bit of space so you may want to delete them at some point (and after system updates which update the kernel). Beware I can't promise this won't cause minor problems with apt
, but probably not.
Also, as per the Fedora post, you probably don't want to use /boot
as the mount point for first parition because Ubuntu will install stuff there, and the root fs image probably has a /boot
partition with contents already. Instead, create a /boot/rpi
subdirectory for use as a mount point; this is mentioned again in relation to fstab
below.
Based on your error using the ready made kernel ("The disk drive for / is not ready yet or not present") and this ubuntu forums thread, I think the problem is because /etc/fstab
has not been tweaked as per step #2 in the answer linked above about Fedora.
Here's a minimal fstab
that should work:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot/rpi vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
This differs a bit from standard pi distro fstabs in that the first partition is mounted on /boot/rpi
instead of /boot
for reasons already explained. This partition doesn't actually have to be mounted at all, because it is not used for anything by the OS. On normal pi distros such as Raspbian, it is kept mounted so that apt
can update the kernel. However, if you are running a stock Ubuntu, it will not be updating the kernel automatically (or rather, it won't be updating the kernel actually used), so you could leave this completely out of fstab
and just mount it yourself when you update the kernel manually (again, see the post about Fedora for details on how to do this).
Note that fstab
doesn't include any swap -- you will have to make your own decisions about that. Traditionally pi oriented distros use a compressed RAM disk or a swapfile. The former I think is a bad idea unless you are maxing out usable RAM as a matter of operation (in which case I'd say you need a device with more RAM, or to reconsider what you are doing to fill it up). The latter is fairly harmless, but since the system will start to swap out a bit even when the RAM is not full, it may be at best pointless if you aren't ever planning to max the memory out.
Leaving the system some free memory for the page cache is generally more useful than wasting it on a swap ramdisk, and likewise, leaving little or no free RAM for whatever reason will lead to sub-optimal performance.
armhf
version, correct? – goldilocks Jul 04 '16 at 13:24/lib/modules/
directory on the root fs, preserving the directory name, which matches the kernel version (i.e., currently you should have a/lib/modules/4.4.14-v7+
directory, if not, you skipped a step; in case it was not clear earlier that is from here). – goldilocks Jul 04 '16 at 14:21