Script launcher menu and Linux hooks fantasies

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Mon Feb 12, 2018 9:41 pm

Sorgelig wrote:
Locutus73 wrote:I hope I'm not missing anything.

Pretty much like you've described.

Ok. What about socfpga.dtb? Do I have to compile it by myself or can I use a pre compiled one?
Does it change with different kernel revisions or is it just hardware dependent?

Thank you in advance.

Locutus73

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Mon Feb 12, 2018 10:27 pm

socfpga should be compiled as it may need to be changed later.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Tue Feb 13, 2018 10:49 am

I've recalled i've already asked Terasic about kernel and config. So i found their e-mail.
Yes, they use Kernel 4.5.0 - so just use the kernel from my repository. Config is in attachment.
de10-nano_defconfig.zip
You do not have the required permissions to view the files attached to this post.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Tue Feb 13, 2018 2:42 pm

Sorgelig wrote:I've recalled i've already asked Terasic about kernel and config. So i found their e-mail.
Yes, they use Kernel 4.5.0 - so just use the kernel from my repository. Config is in attachment.
de10-nano_defconfig.zip

Good! Just for curiosity's sake, I’ll check for any differences with /proc/config.gz in the official SD images.
I hope I’ll have the DE10-nano board in my hands by this weekend.
I’m using https://bitlog.it/hardware/building-emb ... soc-fpgas/ for reference, but I still find the device tree compilation a bit cumbersome; do I have to edit tcl files?

Many thanks in advance.

Locutus73

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Tue Feb 13, 2018 3:33 pm

Not harder than kernel itself.
This will build everything: make zImage modules dtbs

Terasic's u-boot loads dtb from separate file while my u-boot uses zImage_dtb which is simple concatenation of zImage and socfpga.dtb

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1718
Joined: Sun Jul 31, 2011 1:11 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Eero Tamminen » Tue Feb 13, 2018 11:33 pm

alfishe wrote:SDL 1/2 contain tons of code that might be needed by someone but go with such heavy dependencies just to write pixels? come one


I didn't see what point you tried to make with rest of your post, so I'll answer just your question of why cross-platform emulators use SDL.

Games and emulators use SDL to abstract access to frame buffer, input devices and sound. How that is done, is completely different on every platform (Linux, Windows, MacOS, Android...). Writing such code for every operating system where users may want to use your program, especially when one doesn't even have or use those OSes, would be worse than useless. Especially when there's something widely used like SDL which abstracts that.

While one could argue whether SDL's implementation for such HW access access (in general, or for given platform) is efficient, and whether it could be improved, I would recommend doing that in forums dedicated to SDL.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Thu Feb 15, 2018 11:37 am

Sorgelig wrote:Not harder than kernel itself.
This will build everything: make zImage modules dtbs

Terasic's u-boot loads dtb from separate file while my u-boot uses zImage_dtb which is simple concatenation of zImage and socfpga.dtb

Well, yesterday I received my DE10-nano board from Mouser, but, thanks to cr*ppy Italian postal services, I think that I’ll have to wait at least another week for my SDRAM+heatsink+fan from CBMStuff. Now, I’m pretty OCD about cooling, I’d like to start using the board with heatsink and cooling fan installed, but I know it should be safe do Linux tests with the board as is, without cooling… decisions.

Locutus73

alfishe
Atari freak
Atari freak
Posts: 63
Joined: Wed Jul 19, 2017 8:24 pm

Re: Script launcher menu and Linux hooks fantasies

Postby alfishe » Fri Feb 16, 2018 4:07 pm

Locutus73 wrote: I’d like to start using the board with heatsink and cooling fan installed, but I know it should be safe do Linux tests with the board as is, without cooling… decisions.


It's safe to start board without even heatsink. Just be aware that you won't get heavy cores like ao486 stably working and you might get occasional glitches here and there. Passive heatsink is sufficient for all cores, except ao486 if you don't use any closed case.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Mon Feb 19, 2018 3:25 pm

Sorgelig wrote:I've recalled i've already asked Terasic about kernel and config. So i found their e-mail.
Yes, they use Kernel 4.5.0 - so just use the kernel from my repository. Config is in attachment.
de10-nano_defconfig.zip


For now I just had time to extract the Kernel configs from:

1) The original SD card that came with my DE10-Nano
config.DE10-Nano-origninal-SD.4.1.33-ltsi-altera.gz

2) The Linux Console (kernel 4.5) SD card image available on Terasic's Web site
config.de10_nano_linux_console.4.5.0-00198-g6b20a29-dirty.gz

3) The Linux LXDE Desktop (kernel 4.5) SD card image available on Terasic's Web site
config.DE10_Nano_LXDE.4.5.0-00185-g3bb556b.gz


They all differ from the one you posted.

I think I'll try to proceed with Linux LXDE Desktop (kernel 4.5) zImage_dtb+linux.img on MiSTer SD layout.

Locutus73
You do not have the required permissions to view the files attached to this post.
Last edited by Locutus73 on Mon Feb 19, 2018 3:49 pm, edited 1 time in total.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Mon Feb 19, 2018 3:48 pm

DELETED

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Sat Mar 17, 2018 12:08 pm

Now, since I set up my kernel build environment, I’m trying the experiment described here viewtopic.php?f=117&t=33151&sid=4caced3293d27928a25e1e4a84e11ab2#p339065 basically running a Terasic Linux Distro with the new MiSTer layout, in order to confirm the feasibility of a multiboot feature for MiSTer.

So:
1. I downloaded latest MiSTer kernel sources
2. I added exfat support to the kernel config file extracted by Terasic DE10_Nano_LXDE.img (same 4.5 kernel)

Code: Select all

CONFIG_EXFAT_FS=y
CONFIG_EXFAT_DISCARD=y
# CONFIG_EXFAT_DELAYED_SYNC is not set
# CONFIG_EXFAT_KERNEL_DEBUG is not set
# CONFIG_EXFAT_DEBUG_MSG is not set
CONFIG_EXFAT_DEFAULT_CODEPAGE=437
CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
3. I tried to compile Sorgelig’s sources with the new config

But I have no luck, I always get the following errors

Code: Select all

init/built-in.o: In function `mount_root':
/home/alex/Linux-Kernel_4.5.0_MiSTer/init/do_mounts.c:611: undefined reference to `loop_max_part'
Makefile:936: set di istruzioni per l'obiettivo "vmlinux" non riuscito
make: *** [vmlinux] Errore 1


I tried to add

Code: Select all

CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8

To the .config, but again, the same error.

Any ideas?

Many thanks in advance
Best regards

Locutus73

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Sat Mar 17, 2018 12:43 pm

I don't know exact answer since it needs source exploring first which is on virtual machine.
I can give you direction to find the answer:
1) do not manually edit .config file - it has many dependencies between options. Always use config menu - find required option there.
2) use file search with content loop_max_part to find where it defined and then look around to find if there any conditional compilation near this definition. So probably you've missed some config settings.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Sat Mar 17, 2018 6:08 pm

Sorgelig wrote:I don't know exact answer since it needs source exploring first which is on virtual machine.
I can give you direction to find the answer:
1) do not manually edit .config file - it has many dependencies between options. Always use config menu - find required option there.

Good to know. I was editing manually the .config file because I was having problems with the make menuconfig command. Then I discovered my Debian was lacking ncurses, so after
sudo apt-get install libncurses5-dev
sudo apt-get install libncursesw5-dev

I successfully launched make menuconfig.
Adding exFAT support through menuconfig led to the same configuration I wrote manually, so, again no luck with kernel compilation, but…

Sorgelig wrote:2) use file search with content loop_max_part to find where it defined and then look around to find if there any conditional compilation near this definition. So probably you've missed some config settings.

Here’s the culprit! I discovered that your init/do_mounts.c externally refers to a loop_max_part function extern int loop_max_part(void); this function is implemented in drivers/block/loop.c which wasn’t compiled.
So, after adding
File systems ---> DOS/FAT/NT Filesystems ---> exFAT fs support
Device Drivers ---> Block devices ---> Loopback device support

through menuconfig, I successfully compiled your kernel sources with a modified .config extracted by Terasic’s Linux LXDE Desktop (kernel 4.5) http://www.terasic.com.tw/cgi-bin/page/ ... 6&PartNo=4

Here’s the original Terasic .config
config.DE10_Nano_LXDE.4.5.0-00185-g3bb556b.zip

Here’s the modified .config
config.DE10_Nano_LXDE.4.5.0-00185-g3bb556b.MiSTer_Kernel.zip

Here’s the compiled Kernel
http://www.filedropper.com/zimagedtblxde450mister

Now with the Terasic’s SD image DE10_Nano_LXDE.img on my Debian machine, I launched sudo sfdisk -l -uS DE10_Nano_LXDE.img and I got

Code: Select all

Disk DE10_Nano_LXDE.img: 3,5 GiB, 3776970752 bytes, 7376896 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x55f3145b

Device              Boot   Start     End Sectors  Size Id Type
DE10_Nano_LXDE.img1         4096 1028095 1024000  500M  b W95 FAT32
DE10_Nano_LXDE.img2      1028096 7376895 6348800    3G 83 Linux
DE10_Nano_LXDE.img3         2048    4095    2048    1M a2 unknown

Partition table entries are not in disk order.

Then with dd if=DE10_Nano_LXDE.img of=DE10_Nano_LXDE.img2 skip=1028096 count=6348800 I extracted the second Linux partition to a new DE10_Nano_LXDE.img file.

Now putting the new compiled kernel and the extracted partition image one the new MiSTer SD layout under /linux as zImage_dtb and linux.img I stared the DE10-Nano and…
…partial success (or partial failure if you prefer). :cry:

Terasic’s Linux successfully boots, and is accessible both by debug usb cable and by ssh on local network, but I get nothing through HDMI. Here’s the log captured from the debug cable

Code: Select all

U-Boot SPL 2017.03+ (Feb 10 2018 - 19:15:38)
Trying to boot from MMC1


U-Boot 2017.03+ (Feb 10 2018 - 19:15:38 +0800)

       Watchdog enabled
DRAM:  1 GiB
socfpga_bridges_reset: FPGA not ready, aborting.
MMC:   dwmmc0@ff704000: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Autoboot in 0 seconds
reading menu.rbf
2145892 bytes read in 184 ms (11.1 MiB/s)
reading /linux/zImage_dtb
5024536 bytes read in 419 ms (11.4 MiB/s)
## Flattened Device Tree blob at 014c3170
   Booting using the fdt blob at 0x14c3170
   reserving fdt memory region: addr=0 size=1000
   Loading Device Tree to 03ff5000, end 03fff9a7 ... OK

Starting kernel ...

[    0.000000] L2C: platform provided aux values permit register corruption.
[    0.916184] Failed to bind-mount /dev/mmcblk0p1 to /root/media/fat : -2

Welcome to Ubuntu 16.04.1 LTS!

[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Created slice System Slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
[  OK  ] Reached target Encrypted Volumes.
[  OK  ] Reached target Swap.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Remote File Systems.
[  OK  ] Reached target Slices.
[  OK  ] Listening on Syslog Socket.
[  OK  ] Listening on Journal Socket.
         Starting Load Kernel Modules...
         Starting Remount Root and Kernel File Systems...
         Starting Set console keymap...
         Starting Create Static Device Nodes in /dev...
[  OK  ] Listening on Journal Socket (/dev/log).
         Mounting Debug File System...
         Starting Journal Service...
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Listening on udev Control Socket.
[  OK  ] Mounted Debug File System.
[  OK  ] Started Load Kernel Modules.
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting udev Coldplug all Devices...
         Starting Load/Save Random Seed...
         Starting Apply Kernel Variables...
         Mounting Configuration File System...
[  OK  ] Mounted Configuration File System.
[    4.826272] hid-generic 0003:046D:C52B.0003: device has no listeners, quitting
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started Create Static Device Nodes in /dev.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Journal Service.
[  OK  ] Started Set console keymap.
         Starting Flush Journal to Persistent Storage...
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Set console font and keymap...
         Starting Tell Plymouth To Write Out Runtime Data...
         Starting Raise network interfaces...
[  OK  ] Started Flush Journal to Persistent Storage.
         Starting Create Volatile Files and Directories...
[  OK  ] Started Tell Plymouth To Write Out Runtime Data.
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started udev Coldplug all Devices.
[FAILED] Failed to start Create Volatile Files and Directories.
See 'systemctl status systemd-tmpfiles-setup.service' for details.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Reached target System Time Synchronized.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Reached target Paths.
[FAILED] Failed to start Update UTMP about System Boot/Shutdown.
See 'systemctl status systemd-update-utmp.service' for details.
[DEPEND] Dependency failed for Update UTMP about System Runlevel Changes.
[  OK  ] Found device /dev/ttyS0.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Started Daily apt activities.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting LSB: Set the CPU Frequency Scaling governor to "ondemand"...
         Starting System Logging Service...
         Starting Permit User Sessions...
[  OK  ] Started D-Bus System Message Bus.
         Starting Login Service...
         Starting Network Manager...
[  OK  ] Started System Logging Service.
[  OK  ] Started Set console font and keymap.
[  OK  ] Started Raise network interfaces.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Login Service.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
         Starting Light Display Manager...
[  OK  ] Created slice system-getty.slice.
[  OK  ] Started LSB: Set the CPU Frequency Scaling governor to "ondemand".
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Started Light Display Manager.
[  OK  ] Started Network Manager.
[  OK  ] Reached target Network.
         Starting OpenBSD Secure Shell server...
         Starting /etc/rc.local Compatibility...
         Starting Network Manager Script Dispatcher Service...
[  OK  ] Started /etc/rc.local Compatibility.
         Starting Hold until boot process finishes up...
[  OK  ] Started Hold until boot process finishes up.
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
         Starting Set console scheme...
[  OK  ] Started Network Manager Script Dispatcher Service.
[  OK  ] Started Set console scheme.
[FAILED] Failed to start Hostname Service.
See 'systemctl status systemd-hostnamed.service' for details.
[  OK  ] Started OpenBSD Secure Shell server.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.

Ubuntu 16.04.1 LTS DE10_NANO ttyS0

DE10_NANO login:


Maybe it’s something about some rbf file… we are very near.

Locutus73
You do not have the required permissions to view the files attached to this post.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Sat Mar 17, 2018 6:15 pm

Yep. you need rbf file which provides display support. It's loaded from fat partition on original SD card if i remember right. Though i forgot the name, but there is only one RBF file.
Since you just trying, you can take that rbf and rename it to menu.rbf, so it will be launched at startup.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Sat Mar 17, 2018 6:37 pm

Sorgelig wrote:Yep. you need rbf file which provides display support. It's loaded from fat partition on original SD card if i remember right. Though i forgot the name, but there is only one RBF file.
Since you just trying, you can take that rbf and rename it to menu.rbf, so it will be launched at startup.

This is exactly what I did (before reading your post :D ), the file is named soc_system.rbf but I always get no video :shrug:

Locutus73

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Sat Mar 17, 2018 7:10 pm

may be you need to edit u-boot environment to pass correct kernel parameters. MiSTer has specific parameters like memory limits.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Mon Mar 19, 2018 1:05 pm

Sorgelig wrote:may be you need to edit u-boot environment to pass correct kernel parameters. MiSTer has specific parameters like memory limits.

Ok, but... I don't know how :cry:

Can you give me a direction in order to perform useful tests for a hypothetical multiboot core? I mean something in order to gather useful data for MiSTer.
I extracted the following files from the first partition of Terasic’s Linux: soc_system.dtb, soc_system.rbf, u-boot.scr and zImage.
I think u-boot.scr could be useful in order to extract u-boot parameters, and I could try to join zImage and soc_system.dtb in order to create a zImage_dtb with the original Terasic’s 4.5 kernel, without your patches or my .config (but I don't think it will work).

[EDIT]
I see that, in u-boot.scr, there’s a reference to bridge_enable_handoff, to be exact

Code: Select all

fpga load 0 $fpgadata $filesize;
setenv fdtimage soc_system.dtb;
run bridge_enable_handoff;
run mmcload;
run mmcboot;
and in https://github.com/mathworks/altera-ubo ... ME.SOCFPGA it is reported that

Code: Select all

> run bridge_enable_handoff
   
   where bridge_enable_handoff will execute below steps
   > mw $fpgaintf $fpgaintf_handoff
   > go $fpga2sdram_apply
   > mw $fpga2sdram $fpga2sdram_handoff
   > mw $axibridge $axibridge_handoff
   > mw $l3remap $l3remap_handoff
   > md $fpgaintf
   > md $fpga2sdram
   > md $axibridge
I don't know if this can help... to me it's like reading Russian language :D


Thank you in advance

Locutus73

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2196
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Script launcher menu and Linux hooks fantasies

Postby Sorgelig » Mon Mar 19, 2018 1:36 pm

It seems it's much easier for me to handle this task than guide on every step.
I've already started to work on it. It boots into GUI now.

Locutus73
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Wed Feb 07, 2018 6:13 pm

Re: Script launcher menu and Linux hooks fantasies

Postby Locutus73 » Mon Mar 19, 2018 2:24 pm

Sorgelig wrote:It seems it's much easier for me to handle this task than guide on every step.
I've already started to work on it. It boots into GUI now.

Great! Ok, I hope I helped saving you some time somehow.

Maybe I could help preparing some scripts or Windows executables in order to extract the needed files from Terasic’s images thus making the setup of a multiboot environment more user friendly.

Locutus73


Return to “MiSTer”

Who is online

Users browsing this forum: glaucon1984 and 1 guest