Page 1 of 1

Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 4:31 am
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)

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 3:57 pm
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

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 4:13 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 4:26 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 4:40 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Mon Jun 22, 2020 7:57 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Tue Jun 23, 2020 7:36 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Wed Jun 24, 2020 11:20 am
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Jul 10, 2020 5:58 am
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Sep 11, 2020 1:32 pm
by Washac
Thanks for this saves creating those SD Cards :)

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Sep 11, 2020 2:15 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Thu Oct 15, 2020 9:50 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Oct 16, 2020 2:53 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Oct 16, 2020 4:13 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Fri Oct 16, 2020 8:35 pm
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.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Tue Jun 29, 2021 3:56 pm
by Washac
This should not be stuck in an out of the way Linux thread, it should be somewhere upfront so as people new to this can see it, which will make their lives so much easier setting all this up,

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Tue Jun 29, 2021 5:16 pm
by lister_of_smeg
Well, it is in the Wiki (conveniently linked at the top of the forum home) in the 'Setup Guide' section.

Alternatively, the first hit when Googling 'mister setup' sends you to that same guide.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Tue Jun 29, 2021 5:33 pm
by Washac
lister_of_smeg wrote: Tue Jun 29, 2021 5:16 pm Well, it is in the Wiki (conveniently linked at the top of the forum home) in the 'Setup Guide' section.

Alternatively, the first hit when Googling 'mister setup' sends you to that same guide.
Ah, OK was not aware of that, mybad.

Re: Mr. Fusion - Universal MiSTer SD card image

Posted: Sun Dec 26, 2021 6:21 pm
by xalalalala
Thanks for the awesome work! It sure makes it way easier and confortable to setup the sd card. I can't find a single reason why i should go back to the old method.