Initial success running Leap on an ODROID-N2

Hi - I’m not sure if this is the correct place for this, but I was asked to share details by folks on reddit, so here I am.

I have been able to successfully bootstrap Leap-15.0 on an ODROID-N2 board. In principle, Leap-15.1 should work the same way when an aarch64 version is available, and Tumbleweed should also be okay. I must reiterate that this is not a “clean room” installation; I used the pre-installed version of Ubuntu to help me get to a running openSUSE Leap. Here are the full details and instructions for those who are interested. I would very much like for the N2 to become an officially supported board, but I have neither the skill nor time to get it there, but I’m willing to participate with someone who does.

What I bought (I’m in the US, so from Ameridroid):

ODROID-N2 with 4 GB memory
eMMC module, 128 GB, red dot (Ubuntu pre-installed)
12V/2A supply
black case

Already had:
USB keyboard
USB wireless mouse
HDMI monitor
Ethernet cable
eMMC/micro-SD adapter
micro-SD/SD adapter
desktop has SD card reader/writer

I store stuff in the ODROID-N2 directory under my home directory (i.e. ~/ODROID-N2). I downloaded the Leap rootfs image from http://download.opensuse.org/ports/aarch64/distribution/leap/15.0/appliances/ and stored it there. When I insert the eMMC module in my desktop (via adapters), it comes up as /dev/sdg.

Phase 1 - running stuff on my desktop to modify the eMMC module
First, a backup:

dd if=/dev/sdg of=odroid-n2_ubuntu.img bs=1M

Make temporary mount points in /mnt:


mkdir /mnt/mnt1 /mnt/mnt2

Mount the boot partition on mnt1, then the root partition on mnt2:


mount /dev/sdg1 /mnt/mnt1
mount /dev/sdg2 /mnt/mnt2

Go to root directory and wipe it (BE CAREFUL THAT YOU ARE RUNNING THIS IN THE CORRECT DIRECTORY!)


cd /mnt/mnt2
rm -rf *

Untar the aarch64 Leap here


tar -xJf ~/ODROID-N2/openSUSE-Leap15.0-ARM-JeOS.aarch64-rootfs.aarch64-2018.07.02-Buildlp150.1.1.tar.xz

At this point, I installed the MMC card onto the N2, and it booted using the Ubuntu kernel and the Leap user space

WARNING FOR BELOW!!! - the /boot directory you see at this point (by doing a simple “ls /” is not the directory that the system boots from! This /boot is on /dev/mmcblk0p2. The true boot partition is /dev/mmcblk0p1; we will mount that as /mnt later on.

Phase 2 - modifications when running on the N2 directly. I am logged in as a user and have a working ethernet connection. I store things in a directory called System in my home directory.

Follow the instructions (more or less) for building the kernel at https://wiki.odroid.com/odroid-n2/software/building_kernel. Grab the source and change into it’s directory:


cd System
mkdir kernel
cd kernel
git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidn2-4.9.y
cd linux

Do the compile. Note that this puts the modules into /lib/modules on /dev/mmcblk0p2, exactly where we want them


make odroidn2_defconfig
make -j4
sudo make modules_install

Now mount the true boot partition on /mnt and copy over the kernel image


sudo mount /dev/mmcblk0p1 /mnt
sudo cp -f arch/arm64/boot/Image.gz arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtb /mnt

Copy over the config file since we need it in a minute


sudo cp .config /boot/config-4.9.177+

Next I think we have to rebuild the uInitrd file. I used https://wiki.odroid.com/odroid-xu4/software/building_kernel for guidance, though the tools in openSUSE are vastly different from Ubuntu.

Unfortunately, I seem to have lost the mkimage and dracut commands I used for rebuilding the initramfs file. (They don’t appear in my bash history that I can access at the moment.) I think they were the following:


cd /boot
dracut -H -f /boot/initramfs-4.9.177+.img 4.9.177+
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initramfs-4.9.177+.img /boot/uInitrd-4.9.177+.img

*I’ve rerun these and they seem to produce the right outputs, but the final /uInitrd-4.9.177+.img file isn’t quite the same size as the one I produced yesterday. (Very close, however.)
*
Copy the new uInitrd file to the actual boot directory


cp uInitrd-4.9.177+.img /mnt/uInitrd

If you have a look at the /mnt directory which contains the true boot partition with ls -l, you should see a new Image.gz, meson64_odroidn2.dtb, and uIinitrd. Holdovers from the Ubuntu install that are still necessary (I think) are boot.ini and boot.ini.default. I seem to have auto-created edid.bin and display.bin files, but they were not part of the original Ubuntu setup.

I have not tested this extensively yet having just completed all this yesterday, but I have a running xfce desktop, am able to surf the web with Firefox, and have compiled and run the hardinfo benchmarks on it. It’s a very speedy little board; eventually I hope to turn it into a web server and nextcloud host (thus my interest in Leap rather than Tumbleweed).

Update:

Unfortunately, I seem to have lost the mkimage and dracut commands I used for rebuilding the initramfs file. (They don’t appear in my bash history that I can access at the moment.) I think they were the following:

cd /boot
dracut -H -f /boot/initramfs-4.9.177+.img 4.9.177+
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initramfs-4.9.177+.img /boot/uInitrd-4.9.177+.img

*I’ve rerun these and they seem to produce the right outputs, but the final /uInitrd-4.9.177+.img file isn’t quite the same size as the one I produced yesterday. (Very close, however.)
*

I have found the commands - I forgot that I had changed to root user at some point. So as root:

cd /boot
dracut -H -f /boot/initramfs-4.9.177+.img 4.9.177+
mkimage -A arm64 -O linux -T ramdisk -a 0x0 -e 0x0 -n initramfs-4.9.177+.img -d initramfs-4.9.177+.img uInitrd-4.9.177+
mv uInitrd-4.9.177+ /mnt/uInitrd

I see that Leap-15.1 images are available - they must have come online after I downloaded the 15.0 version, so I think I will start from scratch and follow my own instructions. See if I know what I’m talking about.

**Note! **I am guessing there are further little bits from the Ubuntu install that help in the boot process. Looking at the Ubuntu Partition Table at https://wiki.odroid.com/odroid-n2/software/partition_table, I have done nothing with the things labeled “BL1/MBR”, “U-Boot”, and “U-Boot Environment”. Everything associated with U-Boot is still TBD. A proper clean room openSUSE install will have to figure out how to deal with this.

Based on my experience primarily withRPi images, AFAIK all ARM images utilize uboot, but the available documentation to modify beyond common boot options is extremely complex and undocumented… not just by the openSUSE maintainers, but the upstream uboot itself.

If you mount an entire openSUSE ARM image, I’m not sure how you can avoid including the openSUSE version of uboot.

TSU

Agreed, but at least for now, whatever Ubuntu uses will start up the openSUSE kernel, initrd, and user space if they are named identically. That is what I did to bootstrap this and so far it has been sufficient. Reading the U-Boot documentation makes my head hurt, so I have no idea how to do a 100% openSUSE image for this, but I’ll settle for a 99.9% openSUSE setup for now.

While I’m here, I went through through the exercise of starting from scratch (reinstalling the Ubuntu backup and booting it to make sure I wasn’t cheating). I now have a nice, shiny Leap-15.1 installation on my N2. A few additional notes that I forgot about:

I was very sloppy in not including a lot of “sudo” prefixes in the commands in Phase 1 (on the desktop). Nearly everything there requires root permission, so either change to root or be prepared to add a lot of sudos. My apologies for that.

Between Phase 1 and Phase 2 - after I’ve booted with the Ubuntu kernel and the openSUSE user space, I do a lot of administration that isn’t strictly necessary but makes life easier. For example, I add a normal user, change the root passwd, enable sshd (but prohibit root logins), install a ton of software (xfce pattern, base-devel pattern, emacs, etc.). I could have done this by downloading a xfce or KDE or whatever build, but I prefer specifically loading my own things from the barest JeOS install. None of this work is included in my list because it is how I like to have things set up, but it is not necessary for the bootstrap. However, I would not like for you to think that my list is a linear, scriptable effort.

Another thing I forgot to say is that I never change the partition sizes or filesystem types as set up by Ubuntu. /dev/mmcblk0p1 (the true boot partition) remains a 128MB vfat filesystem, while /dev/mmcblk0p2, the root partition, stays at ext4 filling the rest of the space. This could probably be changed to btrfs or something else at the “wipe the user space” step, but I see that my pure Tumbleweed install on an ODROID-C2 also uses ext4, so I chose to leave it alone.

All this said, I would love to see a truly 100% openSUSE install image for the N2. I’m hoping there is a U-Boot expert out there somewhere who can take care of that part of it and assemble everything into a properly supported image.

I followed this "receipe"up till booting the N2. The only difference is I downloaded another snapshot, since we’re a year later, and I want to run KDE:

http://download.opensuse.org/ports/aarch64/distribution/leap/15.1/appliances/openSUSE-Leap-15.1-ARM-KDE.aarch64-rootfs.aarch64-2019.05.17-Snapshot1.105.tar.xz

It has 2019.05.17 in it’s file name, buth the last modification date is jan 15 2020.

I can boot the N2, but not the KDE-stack. I leaves me with petitboot (I think), and give me the chance to exit to a shell.
I think that’s not was supposed to be the result at this stage.
I get an internet connection, and the p2 partition indeed contains the untarred Leap 15.1 download, so that’s good. But apparently the N2 won’t boot it…

Anything I can do here, or anything I have done wrong?

Thanks for your efforts so far!

Hi - thanks for the PM - very wise of you.

I’m not a wizard, but I’ll try to do what I can to help. I’m a little confused on how far you have gotten at this point. I believe you have gotten through installing everything on the card (eMMC?) from the desktop, completing what I called Phase 1. Since you mentioned “boot the N2” and “get an internet connection”, I assume that means you got to a traditional non-graphical login prompt, and are able to get to a bash prompt - is that the case? What exactly do you mean by “apparently the N2 won’t boot it” - do you mean it won’t boot off the opensuse 4.9.y kernel, or that KDE fails to start on the Xorg stack? (Very different things.) Let’s start with those basics and we’ll see where we can go from there. Cheers.

(Hey - I’m thrilled that someone else is actually crazy enough to try out my ramblings. My N2 is still running strong as a web and Nextcloud server - just used it for a video chat this morning.)

I’m not a wizard, but I’ll try to do what I can to help. I’m a little confused on how far you have gotten at this point. I believe you have gotten through installing everything on the card (eMMC?) from the desktop, completing what I called Phase 1. Since you mentioned “boot the N2” and “get an internet connection”, I assume that means you got to a traditional non-graphical login prompt, and are able to get to a bash prompt - is that the case? What exactly do you mean by “apparently the N2 won’t boot it” - do you mean it won’t boot off the opensuse 4.9.y kernel, or that KDE fails to start on the Xorg stack? (Very different things.) Let’s start with those basics and we’ll see where we can go from there. Cheers.

Indeed I have passed Phase 1, and when try to boot the N2 with the so created micro-SD (I don’t use eMMC here), the N2 boots, but only to the first phase.
You then get a little menu top left, and a counter “Boot in <x> seconds” bottom left. All of this is non-graphical.
Normally,you wait that counter g to zero, and the system boots through, from partition 2. But in this case that process leaves me with only a white screen.

The just mentioned top menu contains a choice the go to a system shell, and if one choose that (of course you have to do that before the boot counter reaches zero), you get a root prompt, and you can ls -l the two partitions, and with “ip address” you can see there is a network connection.
The second partition contains indeed, as could be expected, the untarred openSuse snapshot.

Maybe I misread your primary posting, but I had the impression that you did get a graphical login, and from there do the creation and copying of the new kernel an config, rebuild the ulinitrd file, etc, etc. At least, you can login as a user, and that I cannot.
But I’m rather unsure if I have interpreted your initial posting correctly, so I’d very much appreciate your comment here.

(Hey - I’m thrilled that someone else is actually crazy enough to try out my ramblings. My N2 is still running strong as a web and Nextcloud server - just used it for a video chat this morning.)

I have 4 N2’s, two of them running Ubuntu: one just like you with a web and nextcloud server, the other runs CoreElec. These two I bought a year ago. The other 2 arrived last week, and since I use openSuse (TW and Leap) on all our laptops and other systems at home, I’d like to run the N2’s with openSuse too.
Thanks again so far, and I’m curious what your further comment will be!

Okay, it sounds like it is booting the Ubuntu kernel from xxxp1, but for some reason cannot continue with the userland from openSUSE on xxxp2. Do you get enough of a bash environment to attempt to download the kernel and build it? I admit that might be unpleasant without the graphical helpers (like YaST), but in principle it should be possible .

The just mentioned top menu contains a choice the go to a system shell, and if one choose that (of course you have to do that before the boot counter reaches zero), you get a root prompt, and you can ls -l the two partitions, and with “ip address” you can see there is a network connection.
The second partition contains indeed, as could be expected, the untarred openSuse snapshot.

Does the first partition (boot, xxxp1) contain Ubuntu stuff? (It should.) What does “uname -a” look like if you can run it?

Maybe I misread your primary posting, but I had the impression that you did get a graphical login, and from there do the creation and copying of the new kernel an config, rebuild the ulinitrd file, etc, etc. At least, you can login as a user, and that I cannot.
But I’m rather unsure if I have interpreted your initial posting correctly, so I’d very much appreciate your comment here.

Oh, wait a second. It’s been a long time, but for the very first boot I’m sure I did not have a graphical login. That comes from the intermediate steps between Phase 1 and Phase 2 that I talked about in one of my later posts (that starts with “While I’m here”). That’s when I created a normal user, changed the root password, installed xfce which would have dragged in the graphical bootloader, etc. Are you able to do any of those steps? Perhaps that is where the glitch is.

That’s post #5 in this thread. I also realized that I installed the JeOS version and built up from there, while you tried directly the KDE version. Perhaps there is something funny about the KDE version. Could you also try starting with JeOS?

It’s been a while since your last reply, I’m sorry for that.

But I’ve run in some weird things, at least, I don’t understand them.

Both my standard monitors, and the AV-receiver/beamer combination, are 4k screens.
The Ubuntu Mate won’t boot on them, that is, I get the Hardkernel logo, and the menu I mentioned before, and after 10 sec’s it performs the kexec to the, what I shall call, secondary boot, to get the Ubuntu graphical login prompt.
On the AV-receiver/beamer, after that, a white screen is all I get.
On the LG 4k monitor, it goes in a loop Hardkenel-logo -> menu->kexec->Hardenel-logo etc.

I have an older, 1080p monitor, and on that one the system boots normally.
Very funny thing is that when I, after having the graphical environment up and running on that older monitor, and I switch the monitors that moment, I do get a usable screen on the 4k LG monitor. Be it that the fonts and colours look terrible.

I tried several values for the setenv hdmimode in boot.ini, all in the 4K-range, but none of them gives another result that described above.

I’ve done quite some googling, but I must admit that I’m at a loss here…

Any idea here?

But aside from this problem, with the switch-monitor-workaround I managed to get KDEup and running, following your recipe. Thanks a lot, ergo!!

Of course there kernel images have moved forward somewhat, 4.9.177 is now 4.9.219. But it works.

But the weirdness of using 4K screens remains…

Excellent! I’m happy to hear you got it running. Which reminds me that it’s time to update my kernel too. It’s no longer at 177, but I’m sure it’s not up to 219.

But the weirdness of using 4K screens remains…

Unfortunately I can’t be of any help there. I’ve never tried a 4K screen with it. I suspect there is some mode that needs to be enabled, but I don’t remember if it is supposed to be able to drive something that big. Anyway, thanks for updating with the good news. Best wishes!