<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=4449&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / ARM (Banana Pi R2): Booting Linux kernel via u-boot and Grub]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=4449</link>
		<description><![CDATA[The most recent posts in ARM (Banana Pi R2): Booting Linux kernel via u-boot and Grub.]]></description>
		<lastBuildDate>Sun, 08 Aug 2021 19:35:36 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[ARM (Banana Pi R2): Booting Linux kernel via u-boot and Grub]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=31000#p31000</link>
			<description><![CDATA[<p>Hello</p><p>I&#039;m currently trying to boot a kernel on an ARM board (Banana Pi R2) using u-boot as first stage, followed by Grub. The job of u-boot in this setup is to initialise the hardware and to setup an UEFI environment. It then loads Grub (from the grub-arm-efi package in the Devuan repository) which in turn shall load an installed Linux kernel.</p><p>The basic receipe for this setup is the following (work in progress, may be incomplete):</p><ul><li><p>Build a Devuan GNU root-fs using multistrap. It must have the necessary packages like the grub-arm-efi package, basic system tools (shell, your favourite editor, apt, ...).</p></li><li><p>Build u-boot from source.</p></li><li><p>Build the kernel for your board from source.</p></li><li><p>Create an SD card where you install u-Boot onto.</p></li><li><p>Copy the zImage from your compiled kernel to the boot partition of the SD card and name it vmlinuz-(kernel version string).</p></li><li><p>Copy the kernel modules folder of your compiled kernel into the /lib/modules/ in your root-fs.</p></li><li><p>Copy the content of your root-fs onto the root partition of the SD card.</p></li><li><p>Copy qemu-system-arm into /usr/bin into the root-fs on the SD card, then chroot into it, mount /dev, /sys, /proc and /boot (the boot partition on the SD card, not the boot partition from your current computer) and run update-initramfs -c -k (kernel version string)</p></li><li><p>Run grub-install to get grub onto the boot partition. In case that doesn&#039;t work, you may need to use grub-mkimage. The latter can be a bit tricky because you have to hand-select the modules. This invocation might work: </p><div class="codebox"><pre><code>grub-mkimage -p &#039;(hd0,msdos1)/grub/&#039; -O arm-efi -o /boot/efi/boot/bootarm.efi fat ext2 probe terminal scsi ls linux elf part_msdos search normal help echo loadenv parttool boot configfile disk fdt file fshelp gfxmenu halt jpeg lsefi msdospart png reboot search_fs_file search_fs_uuid test</code></pre></div></li><li><p>Run update-grub to generate a configuration file for grub. It should find your kernel and the initrd-image you made with update-initramfs.</p></li><li><p>unmount everything mounted in your SD card partitions and then unmont them, too.</p></li><li><p>Put the SD card into your ARM board. It should be able to boot to Grub.</p></li></ul><p>This is where I&#039;m stuck at the moment: I can get to the point where Grub is loading a kernel and the ramdisk, but then the board restarts after a few seconds. The kernel I use is version 5.12 from this repository: <a href="https://github.com/frank-w/BPI-R2-4.14" rel="nofollow">https://github.com/frank-w/BPI-R2-4.14</a>.<br />These are the last lines I get via the serial console before the board reboots:</p><div class="codebox"><pre><code>Loading Linux 5.12.0-bpi-r2+ ...
Loading initial ramdisk ...

Press any key to continue
EFI stub: Booting Linux Kernel...
EFI stub: usind DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...</code></pre></div><p>Is it just the hardware support for the Banana Pi R2 that prevents the kernel from booting or can this be reproduced on other ARM boards besides the Raspberry Pi*? Is an adtitional step required to get the kernel to work?</p><p>*= Note: The Raspberry Pi cannot be booted using Grub, see: <a href="https://dev1galaxy.org/viewtopic.php?id=3508" rel="nofollow">https://dev1galaxy.org/viewtopic.php?id=3508</a></p>]]></description>
			<author><![CDATA[dummy@example.com (mstrohm)]]></author>
			<pubDate>Sun, 08 Aug 2021 19:35:36 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=31000#p31000</guid>
		</item>
	</channel>
</rss>
