linux - 如何将 linux 内核和引导加载程序添加到 Raspberry Pi2 的 Ubuntu 14.0.4 核心 rootfs?

标签 linux ubuntu linux-kernel raspberry-pi2 u-boot

如标题所示,我正在尝试使用 Ubuntu 14.0.4 base用于 armhf 的 rootfs 为我的 Raspberry-Pi2 创建最小的 Ubuntu 镜像。

我必须自己添加内核和引导加载程序,因为我不是这个主题的专业人士,所以我对编译内核/U-boot 的所有不同指南感到非常困惑。找不到任何内容来涵盖整个过程并让 RPi 启动。

有没有人可以帮助我完成将内核和引导加载程序安装到 RPi2 的 Ubuntu(核心)rootfs 并创建可引导 SD 卡(从头开始)的过程?

PS:我想要整个过程的分步指南,以便我(和其他像我一样的人)可以在本地应用它们并从头开始启动和运行 Pi2。

我有一台 Ubuntu 14.0.4 笔记本电脑作为我的主机,用于交叉编译和复制文件等。

我很绝望,谢谢!

最佳答案

为什么不使用官方版本here ?拥有SD卡的一般流程是为SD卡做两个分区。第一个分区将是 FAT32,您的引导加载程序、设备树 blob 和内核镜像以及任何其他文件都可以驻留在其中。如果我没记错的话,RPi 在第一个分区中需要相当多的其他二进制 blob。第二个将是一个 ext 分区,您需要在其中放置 rootfs。获取任何可用的发行版镜像,将其写入 SD 卡并将第二个 rootfs 分区替换为您喜欢的任何发行版 rootfs。内核和设备树 blob 也可能驻留在第二个分区的/boot 而不是第一个。

我也赶紧查了一下。我有一张用于 RPi3 的 SD 卡,上面有 Raspbian。我用基于 Ubuntu 的 rootfs 替换了具有 Raspbian 的 rootfs 的第二个分区。它可以很好地启动,但在

 * Starting Mount filesystems on boot[ OK ]
 * Starting Populate /dev filesystem[ OK ]
 * Stopping Populate /dev filesystem[ OK ]
 * Starting Populate and link to /run filesystem[ OK ]
 * Stopping Populate and link to /run filesystem[ OK ]
 * Stopping Track if upstart is running in a container[ OK ]
 * Starting Initialize or finalize resolvconf[ OK ]
 * Starting set console keymap[ OK ]
 * Starting Signal sysvinit that virtual filesystems are mounted[ OK ]
 * Starting Signal sysvinit that virtual filesystems are mounted[ OK ]
 * Starting Bridge udev events into upstart[ OK ]
 * Starting device node and kernel event manager[ OK ]
 * Starting Signal sysvinit that remote filesystems are mounted[ OK ]
 * Stopping set console keymap[ OK ]
 * Starting load modules from /etc/modules[ OK ]
 * Starting cold plug devices[ OK ]
 * Starting log initial device creation[ OK ]
 * Stopping load modules from /etc/modules[ OK ]
 * Starting set console font[ OK ]
 * Stopping set console font[ OK ]
 * Starting userspace bootsplash[ OK ]
 * Starting Send an event to indicate plymouth is up[ OK ]
 * Stopping userspace bootsplash[ OK ]
 * Stopping Send an event to indicate plymouth is up[ OK ]
 * Stopping cold plug devices[ OK ]
 * Stopping log initial device creation[ OK ]
 * Starting configure network device security[ OK ]
 * Starting Mount network filesystems[ OK ]
 * Starting configure network device security[ OK ]
 * Stopping Mount network filesystems[ OK ]
 * Starting configure network device[ OK ]
 * Starting configure network device[ OK ]
 * Starting Bridge socket events into upstart[ OK ]
The disk drive for / is not ready yet or not present.
keys:Continue to wait, or Press S to skip mounting or M for manual recovery

我没有调查原因,但我相信这是由于/etc/fstab。

[root@alarmpi ~]# cat /etc/fstab 
# 
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
/dev/mmcblk0p1  /boot   vfat    defaults        0       0

这是来自 Arch。我没有记下 Ubuntu 的,但它是不正确的。

将 rootfs 替换为基于 ArchLinux ARM 的 rootfs,它似乎可以正常启动。请注意,我使用了基于 Raspbian 的 SD 卡并将 rootfs 与 Arch 的交换。

[    3.743064] systemd-journald[85]: Received request to flush runtime journal from PID 1
[    4.791472] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

Arch Linux 4.1.18-v7+ (ttyS0)

alarmpi login: 
Arch Linux 4.1.18-v7+ (ttyS0)

alarmpi login: root
Password: 
Welcome to Arch Linux ARM

     Website: http://archlinuxarm.org
       Forum: http://archlinuxarm.org/forum
         IRC: #archlinux-arm on irc.Freenode.net
[   15.258407] random: nonblocking pool is initialized

我希望这能让您对如何处理这个问题有足够的总体了解。

关于linux - 如何将 linux 内核和引导加载程序添加到 Raspberry Pi2 的 Ubuntu 14.0.4 核心 rootfs?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38139687/

相关文章:

python - 无法使用 PIP 升级 Scipy

ubuntu - 一些 VSCode 键绑定(bind)在 Ubuntu 中不起作用

bash - 从枚举的文件名中减去数字

c - 系统调用为用户分配内存

linux - 如何知道 linux 内核运行 EL2(非安全)或 EL3(安全)模式?

linux - 为什么 Bash 变量在 if 语句内为空,但在 if 语句外却不为空?

python - 是否可以使用来自非登录 shell 的单行命令从 bash 登录 shell 执行 python 脚本?

linux - 将 Emacs 复制/粘贴与系统复制/粘贴集成

linux - 增加多个文件名 Bash 的数量

c - 多次加载内核模块(snd-aloop)