Mr. Fusion - Universal MiSTer SD card image

Kernel, Main, Utilities & Apps, Misc Devices
User avatar
shmitty
Posts: 7
Joined: Tue Jun 16, 2020 8:08 am

Mr. Fusion - Universal MiSTer SD card image

Unread post by shmitty »

Hi all,

I think I managed to come up with a solution to have a minimal MiSTer SD card image that will resize itself and install MiSTer on the DE10-nano. It can be flashed with any general purpose SD card flashing utility on any platform.

I believe it's ready for beta testing by anyone who's interested: https://github.com/michaelshmitty/mr-fusion.

It uses a custom bootloader, kernel and initramfs to boot to a minimal in-memory OS. Then it copies the MiSTer release data from the SD card to tmpfs in memory. Next it resizes the SD card to make use of its full capacity and creates the necessary MiSTer partitions (exFAT MiSTer_Data and the A2 type bootloader partition). Lastly it copies the MiSTer release files from memory to the MiSTer_Data partition, writes the MiSTer bootloader and reboots the DE10-nano. The entire process takes about 60 seconds from bootup to seeing the MiSTer menu.
Note that neither the bootloader, the kernel nor the initial release files are preserved. After reboot the bootloader, kernel and data files are the ones from the MiSTer project as released by Sorgelig.

I have many todos for improvements: implement access to the framebuffer to give feedback on the process, remove more unnecessary stuff from the kernel, tune the bootloader for faster booting, document my entire adventure on building this, improving documentation, ...
Hopefully testing will show that it works and I hope people will find it useful, lowering the barrier to get started with MiSTer.

Regards,
Michael (shmitty)
User avatar
shmitty
Posts: 7
Joined: Tue Jun 16, 2020 8:08 am

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by shmitty »

Sorg, Rysha told me to ping you if you want to talk about adding this to MiSTer-devel. Feel free to contact me anytime. I can't send private messages through this board yet, only receive (no permissions).

Regards,
--m
User avatar
Sorgelig
Site Admin
Posts: 419
Joined: Thu May 21, 2020 9:49 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by Sorgelig »

Good idea! I was thought about this way, but had no time for research this topic.
Thanks for implementing it.
I've sent invitation to MiSTer-devel. After accepting, you can create and manage the repository in MiSTer-devel.
For user friendly version video output must be added. Or at least signalling by I/O board LEDs could be done to monitor the process.
User avatar
Sorgelig
Site Admin
Posts: 419
Joined: Thu May 21, 2020 9:49 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by Sorgelig »

For generic linux with video output may be you can base it on LXDE. You can get its Kernel which has driver for video used in LXDE AV core. And simple text console should be fine for the whole process.
User avatar
shmitty
Posts: 7
Joined: Tue Jun 16, 2020 8:08 am

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by shmitty »

Thanks! Good idea, I definitely want to add video output.

I only implemented the bootloader and kernel from scratch because I wanted to learn the entire process from the basics. Perhaps it is possible to use the u-boot and kernel from MiSTer and have video output already integrated? Or is the necessary rootfs contents for a simple MiSTer with video output too big for a ramfs?
I still need to study more about the u-boot env configuration. I could not easily find a way to let the MiSTer u-boot load an initramfs instead of the linux.img loop device. I also didn't just want to copy and paste stuff without understanding it.
I will also look into how LXDE does it. I will try to investigate the simplest possible video output solution. I want to learn a bit more about the fpga side anyway.

I'm putting script support in the next beta release so users can still choose to add additional scripts before they put the card into the MiSTer. I see the update script is included by default in your releases. I will also include the wifi.sh script.

Thanks for your time.
User avatar
Sorgelig
Site Admin
Posts: 419
Joined: Thu May 21, 2020 9:49 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by Sorgelig »

LXDE version of video output is independent from MiSTer, so you don't need to add MiSTer environment and complex manage of frame buffer.
Although, LXDE kernel is old (4.5 or 4.6) but it shouldn't be matter. You just need a simple build with video output. You only need kernel and rbf from LXDE. Kernel is available in sources. You don't need to use the LXDE Linux. Just its kernel.
User avatar
shmitty
Posts: 7
Joined: Tue Jun 16, 2020 8:08 am

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by shmitty »

Good suggestion, thank you.

I will try that approach, because if it works it will immediately get me what I want: graphics output through HDMI. Very beneficial to the end user, for sure.

But if I run into too much unknown territory too quicky, I may take a step back and start by adapting a simple ghrd example like in this tutorial (which I am currently studying)
https://bitlog.it/20170820_building_emb ... -nano.html
and this rocketboards tutorial
https://rocketboards.org/foswiki/Docume ... erSGuide#2

to implement a basic "knightrider" LED animation to provide feedback to the user in version 2.0 of the installer. Then upgrade to full HDMI output using the existing LXDE kernel for version 3.0.

I'm trying to keep a balance between learning new stuff and truly understand what's going on vs. creating something useful fast for the MiSTer community :lol:

I am very impressed with the power of the DE10-nano and all its possibilities. The preloader, u-boot loader, all very powerful things.

For now I am using the latest, stable official u-boot release and it works fine. But once I start interacting with the fpga, perhaps I must use the u-boot version adapted by Altera? Or is that old information?
At first glance it looks like the u-boot MiSTer is using is a fork of the original and not changed by Altera or am I wrong?

Thanks for the insights.
User avatar
shmitty
Posts: 7
Joined: Tue Jun 16, 2020 8:08 am

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by shmitty »

It looks like with a very simple hardware design from the reference implementation I should be able to generate a simple RBF that exposes an 8-bit memory mapped register of the LED's on the board, which I can then access through a memory mapped area of /dev/mem. I think that will be a good first step to have some simple user feedback. After that I can move on to more complicated stuff.
Nytron
Posts: 8
Joined: Wed Jul 01, 2020 9:28 am

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by Nytron »

Great work, I love this method. Should work on all OSes, desktop and mobile included. Etcher is a imaging tool that I keep on all my OSes. This works very nicely.
Washac
Posts: 50
Joined: Mon May 25, 2020 5:55 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by Washac »

Thanks for this saves creating those SD Cards :)
jca
Posts: 60
Joined: Wed May 27, 2020 1:59 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by jca »

After reading the top post a few times I must admit that I do no understand what it is all about.
What are the advantages of using this method compared to the actual method of making a SD card?
Thanks.
aberu
Posts: 86
Joined: Tue Jun 09, 2020 8:34 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by aberu »

Because this method is agnostic toward both the program being used to flash and the operating system you are using to flash the sd card.

It's a highly standardized method that is widely used on pretty much any SoC-based solution that uses a flash card to boot from.

EDIT: Also not sure what "actual method" means. if you mean the "official" method that was used before, Mr Fusion has replaced the previous custom disk imager application in the setup guide for MiSTer and has been incorporated into the official MiSTer project for a while now.
jca
Posts: 60
Joined: Wed May 27, 2020 1:59 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by jca »

Thanks for the answer. Yes, by actual method I meant the old official method.
I previously used Etcher and Win Imager for other projects. As a Windows user I did not realized the inconvenience for other OSes.
aberu
Posts: 86
Joined: Tue Jun 09, 2020 8:34 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by aberu »

I'll add, I prefer the old method ;)

Mainly because I can just image it, and go to the drive and transfer all the files I want then plug into the mister. The Mr. Fusion method requires me to plug it into the mister, boot, wait for it to install, and then take the microsd out to have that fast access.
ash2fpga
Posts: 79
Joined: Tue May 26, 2020 6:20 pm

Re: Mr. Fusion - Universal MiSTer SD card image

Unread post by ash2fpga »

I prefer the old method, too. Partly because I customize the update settings (update.ini) before it runs for the first time. I hope the old method does not go away.
Post Reply