code_exec
Posts: 46
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!

User avatar
PeterO
Posts: 4257
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: 46
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.

User avatar
PeterO
Posts: 4257
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: 2169
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: 46
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

code_exec
Posts: 46
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

hippy
Posts: 3911
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: 46
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.

code_exec
Posts: 46
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

n67
Posts: 839
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"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

code_exec
Posts: 46
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.

code_exec
Posts: 46
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.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11015
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: 46
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.

n67
Posts: 839
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"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

Return to “Other projects”