code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Introducing Pi386

Tue Nov 06, 2018 9:10 pm

In the past, the only way to run x86 on the Pi was to use QEMU to emulate a x86 OS (very slow) or purchase ExaGear Desktop.

That was until someone calling himself mikerr came along and built a Raspbian image preconfigured to use WINE.

However, being able to use this required you to flash the image to a microSD card. You may have had Raspbian (or another Linux distro) installed on your microSD for a couple of months now, and don't want to overwrite it or buy a new microSD just to try this out.

I found out about something called qemu-user-static, which allows you to 'chroot' into a filesystem from a different architecture. I've heard of this being used to configure a Raspbian image to your needs and then flash it to your Pi. But a couple of weeks ago, I found out that you can also 'chroot' into i386 filesystems from the Raspberry Pi using qemu-user-static. When I tried using WINE in it, I got a segmentation fault. I was confused.

I asked about why I was getting a segfault on the forums, and a couple of people told me to just not bother trying to run i386 programs on the Pi. mikerr replied to the forum topic, saying that it was because WINE required a 3G/1G memory split, but the Pi by default used a 2G/2G memory split. I decided to recompile the RPi's kernel, enabling 3G/1G and Virtualisation in the kernel config before compiling.

I decided it was time to start a project, so I called it Pi386. It's basically going to be the free version of ExaGear, and will be released soon.

Thanks for reading!
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
PeterO
Posts: 4296
Joined: Sun Jul 22, 2012 4:14 pm

Re: Introducing Pi386

Tue Nov 06, 2018 9:17 pm

How are you going to provide 4G of ram ? Seems a non-starter.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Tue Nov 06, 2018 9:23 pm

PeterO wrote:
Tue Nov 06, 2018 9:17 pm
How are you going to provide 4G of ram ? Seems a non-starter.
PeterO
Not entirely sure what 3G/1G means, all I know is that WINE requires a 3G/1G kernel to run.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
PeterO
Posts: 4296
Joined: Sun Jul 22, 2012 4:14 pm

Re: Introducing Pi386

Tue Nov 06, 2018 9:27 pm

Seems it's to do with kernel/user memory split not the absolute amounts of RAM (my misunderstanding).
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
Paeryn
Posts: 2222
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Introducing Pi386

Wed Nov 07, 2018 12:22 am

2G/2G and 3G/1G refer to how the virtual memory space is split, not physical memory space.

3G/1G means userspace addresses are always in the lowest 3G and kernelspace addresses are always in the upper 1G.

WINE's requirement for the 3G/1G spilt has something to do with it wanting to allocate memory with an address in the upper half of memory which isn't available to userspace in a 2G/2G split.
She who travels light — forgot something.

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Wed Nov 07, 2018 6:15 am

Paeryn wrote:
Wed Nov 07, 2018 12:22 am
2G/2G and 3G/1G refer to how the virtual memory space is split, not physical memory space.

3G/1G means userspace addresses are always in the lowest 3G and kernelspace addresses are always in the upper 1G.

WINE's requirement for the 3G/1G spilt has something to do with it wanting to allocate memory with an address in the upper half of memory which isn't available to userspace in a 2G/2G split.
Okay
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Wed Nov 07, 2018 4:31 pm

I managed to get WINE working. Here's a screenshot of the Pi running WINE Wordpad.

Image
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

hippy
Posts: 4031
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Introducing Pi386

Wed Nov 07, 2018 11:26 pm

code_exec wrote:
Wed Nov 07, 2018 4:31 pm
I managed to get WINE working. Here's a screenshot of the Pi running WINE Wordpad.
Excellent work. Well done. Keep it up.

One thing I would suggest is keep a document which describes all the steps you had to do, as detailed as possible, so others can follow in your footsteps later. It's always easier to document as you go.

Looking forward to seeing what Visual Basics it will run.

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Thu Nov 08, 2018 6:17 am

Some more info about Pi386:

1. Its chroot environment will be based on Debian Stretch.
2. Don't expect snappy, fast performance. It took about 15 seconds just for WINE Wordpad to start on a Pi 3.
3. It will be able to run 32-bit x86 (i386) programs, but it won't be able to run 64-bit x86 (amd64) programs.
Last edited by code_exec on Thu Nov 08, 2018 9:27 pm, edited 1 time in total.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Thu Nov 08, 2018 9:24 pm

I managed to get both Lightshot and LibreOffice 6.1 working through Pi386!

Image
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

n67
Posts: 894
Joined: Mon Oct 30, 2017 4:55 pm

Re: Introducing Pi386

Thu Nov 08, 2018 9:41 pm

Do you have an ETA for a release version?
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Fri Nov 09, 2018 6:50 am

n67 wrote:
Thu Nov 08, 2018 9:41 pm
Do you have an ETA for a release version?
I'm building the .deb file now. Expect a release very soon.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Fri Nov 09, 2018 5:15 pm

Pi386 has been released. Download the .deb file http://www.mediafire.com/file/6j1m9ppcc ... _1.0.1.deb

Download the custom kernel files (which use a 3G/1G memory split rather than the default 2G/2G) http://www.mediafire.com/file/dyho3vj3j ... nel_3g.zip

Once the zip file containing the kernel files has been downloaded, apply the new kernel with the following:

Code: Select all

unzip custom_kernel_3g.zip
sudo cp -rT custom_kernel /boot
Reboot your Pi for the new kernel to take effect.

Install Pi386 with the following command:

Code: Select all

sudo dpkg -i pi386_1.0.1.deb
sudo apt install -f
You can then run Pi386 with the following command:

Code: Select all

pi386
Once you're inside the chroot environment, you can install WINE with the following command:

Code: Select all

apt install wine
Last edited by code_exec on Fri Nov 09, 2018 8:09 pm, edited 2 times in total.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11090
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Introducing Pi386

Fri Nov 09, 2018 6:54 pm

You say PI386 is something new, but this: https://www.youtube.com/watch?v=x5-vVgkj8UU was shown two years ago, what is the difference between it, and "PI386"? :mrgreen:

where is the emulation step to execute x86 CPU instructions on the PI's ARM CPU actually happening, not in WINE, Wine is Not an Emulator, so where?

Curious people want to know...

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Fri Nov 09, 2018 7:48 pm

mahjongg wrote:
Fri Nov 09, 2018 6:54 pm
You say PI386 is something new, but this: https://www.youtube.com/watch?v=x5-vVgkj8UU was shown two years ago, what is the difference between it, and "PI386"? :mrgreen:

where is the emulation step to execute x86 CPU instructions on the PI's ARM CPU actually happening, not in WINE, Wine is Not an Emulator, so where?

Curious people want to know...
The Raspbian image used in that video was preconfigured to use i386 programs, meaning that you had to flash it to an SD card and start fresh rather than be able to install a x86 environment on your existing Raspbian install.

x86 emulation happens through qemu-user-static, which lets you chroot into filesystems designed for other architectures.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

n67
Posts: 894
Joined: Mon Oct 30, 2017 4:55 pm

Re: Introducing Pi386

Fri Nov 09, 2018 8:54 pm

By the way, and just to clarify for anyone else reading this thread, the approach here is the same as in Exagear.

That is, you emulate x86 so that you can run Linux X86 code. Then you layer WINE on top of that so you can run (some) Windows apps.

But what's missing from this formula is actually running Windows - with the familiar desktop and UI.

So to OP, I ask: Is there any possibility of using your setup to actually run Windows as we know it?

Note that other people (e.g., Ric from Delhi) have managed to run actual Windows (Win 95/98) under QEMU on the Pi? How does your effort compare to theirs?
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Sun Nov 18, 2018 12:37 pm

n67 wrote:
Fri Nov 09, 2018 8:54 pm
By the way, and just to clarify for anyone else reading this thread, the approach here is the same as in Exagear.

That is, you emulate x86 so that you can run Linux X86 code. Then you layer WINE on top of that so you can run (some) Windows apps.

But what's missing from this formula is actually running Windows - with the familiar desktop and UI.

So to OP, I ask: Is there any possibility of using your setup to actually run Windows as we know it?

Note that other people (e.g., Ric from Delhi) have managed to run actual Windows (Win 95/98) under QEMU on the Pi? How does your effort compare to theirs?
It is possible to run old versions of Windows on the Pi (Windows XP is the most recent version you can run, and it is slow) through QEMU. People have also managed to get Windows 10 WoA running on the RPi 3, but it is slow and lacks drivers for things such as WiFi, preventing it from being acceptable for everyday use.

Pi386, on the other hand, is a preconfigured x86 environment for the Pi which doesn't run an entire OS, but it runs i386 Debian software. qemu-i386-static translates x86 code to ARM code, making applications run on the Pi as if they were running natively.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
DarkPlatinum
Posts: 536
Joined: Thu Nov 02, 2017 2:30 pm
Contact: Website

Re: Introducing Pi386

Sun Nov 18, 2018 3:34 pm

How much faster is this compared to exegears version? I have run Windows 95 with QEMU, it was slow and I could not get networking working.
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi Zero W :) ): Https://Html.dynu.net

User avatar
DarkPlatinum
Posts: 536
Joined: Thu Nov 02, 2017 2:30 pm
Contact: Website

Re: Introducing Pi386

Sun Nov 18, 2018 6:44 pm

code_exec wrote:
Fri Nov 09, 2018 5:15 pm
Pi386 has been released. Download the .deb file http://www.mediafire.com/file/6j1m9ppcc ... _1.0.1.deb

Download the custom kernel files (which use a 3G/1G memory split rather than the default 2G/2G) http://www.mediafire.com/file/dyho3vj3j ... nel_3g.zip

Once the zip file containing the kernel files has been downloaded, apply the new kernel with the following:

Code: Select all

unzip custom_kernel_3g.zip
sudo cp -rT custom_kernel /boot
Reboot your Pi for the new kernel to take effect.

Install Pi386 with the following command:

Code: Select all

sudo dpkg -i pi386_1.0.1.deb
sudo apt install -f
You can then run Pi386 with the following command:

Code: Select all

pi386
Once you're inside the chroot environment, you can install WINE with the following command:

Code: Select all

apt install wine
You need to state what version of kernel this requires, I had not updated my system, and downloaded your kernel, and when I boot it up I get cant load kernel module error.
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi Zero W :) ): Https://Html.dynu.net

User avatar
DarkPlatinum
Posts: 536
Joined: Thu Nov 02, 2017 2:30 pm
Contact: Website

Re: Introducing Pi386

Sun Nov 18, 2018 7:13 pm

I ran a sudo apt-get update and dist-upgrade. I then reinstalled your kernel. It does not work. You need to continuously update it to the latest raspbian kernel for it to work with everyone system.
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi Zero W :) ): Https://Html.dynu.net

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Mon Nov 19, 2018 6:24 am

DarkPlatinum wrote:
Sun Nov 18, 2018 7:13 pm
I ran a sudo apt-get update and dist-upgrade. I then reinstalled your kernel. It does not work. You need to continuously update it to the latest raspbian kernel for it to work with everyone system.
Hmm, that's strange. I compiled the kernel by following the instructions here:

https://www.raspberrypi.org/documentati ... iguring.md
https://www.raspberrypi.org/documentati ... uilding.md

I haven't touched the kernel for a couple of weeks though, so it may be an old version. I'll recompile it ASAP.

Alternatively, you can try building the kernel yourself with a 3G/1G memory split, though this takes some time.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Mon Nov 19, 2018 6:26 am

DarkPlatinum wrote:
Sun Nov 18, 2018 7:13 pm
I ran a sudo apt-get update and dist-upgrade. I then reinstalled your kernel. It does not work. You need to continuously update it to the latest raspbian kernel for it to work with everyone system.
Also, what Pi model are you using? For the best and most stable results, I'd suggest using a Pi 3B.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
DarkPlatinum
Posts: 536
Joined: Thu Nov 02, 2017 2:30 pm
Contact: Website

Re: Introducing Pi386

Mon Nov 19, 2018 8:51 am

code_exec wrote:
Mon Nov 19, 2018 6:26 am
DarkPlatinum wrote:
Sun Nov 18, 2018 7:13 pm
I ran a sudo apt-get update and dist-upgrade. I then reinstalled your kernel. It does not work. You need to continuously update it to the latest raspbian kernel for it to work with everyone system.
Also, what Pi model are you using? For the best and most stable results, I'd suggest using a Pi 3B.

Using a 3B+
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi Zero W :) ): Https://Html.dynu.net

code_exec
Posts: 142
Joined: Sun Sep 30, 2018 12:25 pm

Re: Introducing Pi386

Mon Nov 19, 2018 3:41 pm

DarkPlatinum wrote:
Mon Nov 19, 2018 8:51 am
code_exec wrote:
Mon Nov 19, 2018 6:26 am
DarkPlatinum wrote:
Sun Nov 18, 2018 7:13 pm
I ran a sudo apt-get update and dist-upgrade. I then reinstalled your kernel. It does not work. You need to continuously update it to the latest raspbian kernel for it to work with everyone system.
Also, what Pi model are you using? For the best and most stable results, I'd suggest using a Pi 3B.

Using a 3B+
Okay.
Pi386 lets you run 32-bit x86 software on the Raspberry Pi, including WINE!

https://www.raspberrypi.org/forums/viewtopic.php?t=226376

User avatar
DarkPlatinum
Posts: 536
Joined: Thu Nov 02, 2017 2:30 pm
Contact: Website

Re: Introducing Pi386

Mon Nov 19, 2018 6:50 pm

Have you updated everything to the latest version? And have you updated the links above so that I don't get the same version when I download it?
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi Zero W :) ): Https://Html.dynu.net

Return to “Other projects”