(This is a guest post by Antoni Sawicki aka Tenox)
This is a Virtualization Challenge. A competition to virtualize an OS inside emulator/hypervisor. (Previously 1 / 2 /3)
This time the object of the competition is QNX version 1.2. A demo disk is covered here. This is the set of floppy disks:
As you can see the boot disk is copy-protected. As such I have imaged these disks using both KryoFlux and SuperCard Pro. The magnetic flux stream images are available here. For verification I have converted the raw stream of the demo disk in to a sector image using HFE tool. The converted disk boots and works correctly in an emulator. The demo disk can also help with analyzing the boot process since it’s known to work.
The contest is to virtualize the OS, install it and provide a fully working hard disk image with the OS installed. Any emulator of your choice or method is acceptable as long as anyone can download and run it. The prize is $100 via PayPal and of course the fame! 🙂 The winner will be whoever comments the article first with a verifiable working solution.
A bonus $50 prize will be awarded if you can patch the boot floppy disk so that it can be installed as if the copy protection was never there.
(This is a guest post by Antoni Sawicki aka Tenox)
Fresh from the oven, or rather Kryoflux dump – a QNX version 1.1 Demo Disk:
I managed to boot it on 86Box:
For the readers with more curiosity and time at their hands please could you try it on different emulators and comment what works and what doesn’t.
For the less curious this how the demo actually looks like once you log in as demo user:
As the authors demand to make as many copies of this disk as possible here it is. Please download and spread!
I also managed to dump the rest of QNX 1.2 including boot disk, utils and even c compiler. Unfortunately the boot disk is copy protected:
I have raw stream dump made with Kryoflux as well as regular disk images. If you are interested in circumventing checking the copy protection so the system could be run in an emulator let me know in a comment. Perhaps time for another Virtualization Challenge?
This was a bit more work than I had anticipated. However flygoat had done much of the legwork for me. The first thing to get is flygoat’s mc-loongson.zip. I made a local download as I suspect many will not have QQ or WeChat (Or don’t want to admit to the government that you are downloading this…).
I’m not sure if it’s a MIPS thing or a UOS thing, but it had Java 11.0.4 in by default, which is CRAZY slow
$ /usr/lib/jvm/java-1.11.0-openjdk-mips64el/bin/java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Debian-1deb10u1)
OpenJDK 64-Bit Zero VM (build 11.0.4+11-post-Debian-1deb10u1, interpreted mode)
I installed version 8, but they are ‘in parallel’ in different directories… I guess it’s the .net hell drift all over again. Although to be fair I’ve only dealt with vendor installed java on Linux where it’s all fixed to single versions.
One annoying thing is that it cannot find JavaFX over and over despite it being installed, so I had to manually add the ‘module-path’. This is the syntax for version 11, I’m not all that sure on the version 8 syntax.
$ /usr/lib/jvm/java-8-openjdk-mips64el/bin/java -version
openjdk version "1.8.0"
OpenJDK Runtime Environment (Loongson 8.1.3-mips64r2-uos) (build 1.8.0-184.108.40.206-2deepin-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)
I changed the /etc/alternatives/java to point to version 8, which although causes the launcher to crash launching the actual exe, it’s trivial enough to change it to version 8. Although the command is… unwieldy but save it to a shell script.
I’m sure it won’t paste well, but here we go.. and it’s in my homedir sooo here we go!
Naturally you’ll need your own username, token, uuid..
One thing is for sure, setting the graphics to higher details gives better performance. I suspect that it’s a matter of pushing more of the rendering to hardware, out of software mode.
I have it set to Fabulous! graphics, render distance of 25 chunks, no vysnc, clouds fast, mipmap level 2.
While it does take a while to load up, join the server, and do the initial world loading, you can watch all 4 cores run at 100%, but once it’s loaded in, it’s down to a single core at 100%, and the other 3 are hovering around 10-25%. So once jit’d and loaded in it seems to run okay.
They are jackhammering downstairs and I could make this 1 minute clip in a brief moment of peace. This is before I figured out that the more acceleration you give Minecraft, the faster it runs with the GPU doing the heavy lifting (I think).
Is this the machine for the Minecraft enthusiast? Hardly, but Minecraft is the Java success story, where a platform like this, a fringe non mainstream platform will run a commercial app. This is where the real portability of binutils/gcc/libc and Linux prove to be the winning platform.
I saw this card while I was out, and I’ve seen mention of some Radeon’s working on the Lemote A1901 board, although it didn’t like my Asus Radeon R9 380 Strix, I’m guessing it’s too old? I can’t find it now, but there was some mention somewhere of someone using a 500 series card (I don’t understand the AMD number schema), so I figured I’d get the 570 as it was just over $100 USD, and it has 8GB of VRAM, so it ought to be somewhat usable if I guessed wrong on the compatibility.
But I did get lucky! The card not only was able to initialize, but UOS came up to the desktop!
glxinfo -B gave the following output:
name of display: :0 display: :0 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: X.Org (0x1002) Device: Radeon RX 570 Series (POLARIS10, DRM 3.27.0, 4.19.0-loongson-3-desktop, LLVM 7.0.1) (0x67df) Version: 18.3.6 Accelerated: yes Video memory: 8192MB Unified memory: no Preferred profile: core (0x1) Max core profile version: 4.5 Max compat profile version: 4.5 Max GLES1 profile version: 1.1 Max GLES profile version: 3.2
So there we go, 8GB of memory, and ‘Accelerated: yes’. It’s also FPS locked to the screen refresh so it’s running a steady 60fps for the display I’m using. I need to build some later games that use GL to really push the machine.
The one big ‘negative’ is that the video card sits over the SATA ports, so I need to get an L connector SATA cable, as now I can’t use my 2TB spinning rust disk with the fancy GPU in place. And it makes my 800 watt PSU all the more justified.
I’m just glad that the portable drivers, well are portable!
AKA what happens when your OS is from one Debian like distribution and lags behind the rest of the world, but you want to run a parallel infastructure. Obviously for people who have sane setups their stuff is in sync and this doesn’t apply.
HOWEVER for people who use USO they will find out quickly that it’s a Debian derived MIPS64EL based distribution, but they don’t keep any MIPSEL (32bit) binaries. So I was thinking add in the dpkg arch, and some deb sources and I’d be good to go, right? Except the stuff is out of step so what happens is that UOS decides it wants to replace the OS with what is on the mipsel repos. Even when specfiying the arch’s directly.
deb [by-hash=force arch=mips64el] https://professional-packages.chinauos.com/desktop-professional eagle main contrib non-free
deb [arch=mipsel] http://deb.debian.org/debian buster main contrib non-free
So the good news is that I asked around and found a solution that I’d never heard of, “debootstrap”. The general page is here:
What it boils down to is that it’s a script set that will download enough DEB’s and extract them onto a directory and prep it out as a chroot/jail. And you can specify whatever architecture you want, you can even use qemu to run totally alien stuff! I’d never heard of this before, such a shame.
YES it’s that simple! Although there is some house cleaning to be done:
apt install makedev
mount none /proc -t proc
Making the devices sure took long enough, but now I could do the regular update, add in some compilers and stuff, X11, and whatnot and get things going. Remember to mess around with xauth to get X11 forwarding from chroot working
gcc disasm.o audio.o configuration.o dialog.o file.o hostcall.o keymap.o main.o memAlloc.o misc.o screen.o screenConvert.o sdlgui.o shortcut.o scalebit.o input.o fe2.o ../fe2.part1.o ../fe2.part2.o -L/usr/lib/mips64el-linux-gnuabi64 -lSDL -o ../frontier
/usr/bin/ld: ../fe2.part1.o: in function <code>load_binfile': fe2.s.c:(.text+0x180): relocation truncated to fit: R_MIPS_CALL16 against</code>[email protected]@GLIBC_2.2'
/usr/bin/ld: fe2.s.c:(.text+0x19c): relocation truncated to fit: R_MIPS_CALL16 against <code>[email protected]@GLIBC_2.0' /usr/bin/ld: fe2.s.c:(.text+0x1a8): relocation truncated to fit: R_MIPS_CALL16 against</code>[email protected]@GLIBC_2.0'
/usr/bin/ld: fe2.s.c:(.text+0x1c0): relocation truncated to fit: R_MIPS_CALL16 against <code>[email protected]@GLIBC_2.0' /usr/bin/ld: fe2.s.c:(.text+0x1e4): relocation truncated to fit: R_MIPS_CALL16 against</code>[email protected]@GLIBC_2.0'
/usr/bin/ld: fe2.s.c:(.text+0x1f0): relocation truncated to fit: R_MIPS_CALL16 against <code>[email protected]@GLIBC_2.2' /usr/bin/ld: fe2.s.c:(.text+0x280): relocation truncated to fit: R_MIPS_GOT_DISP against</code>[email protected]@GLIBC_2.0'
/usr/bin/ld: fe2.s.c:(.text+0x284): relocation truncated to fit: R_MIPS_CALL16 against <code>[email protected]@GLIBC_2.0' /usr/bin/ld: fe2.s.c:(.text+0x290): relocation truncated to fit: R_MIPS_CALL16 against</code>[email protected]@GLIBC_2.0'
/usr/bin/ld: fe2.s.c:(.text+0x2b4): relocation truncated to fit: R_MIPS_CALL16 against `[email protected]@GLIBC_2.0'
/usr/bin/ld: fe2.s.c:(.text+0x2c4): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
make: *** [Makefile:18: ../frontier] Error 1
I’d never heard or seen this before, and yeah it’s some MIPS’isim.
Apparently it’s something called a “global offset table” which of course has a 64k entery limit which can cause an overflow if you are doing something crazy like running a disassembler and having tens of thousands of instructions.
Looking at the GCC MIPS options page, there is hope, one can opt for a more iniffecient and larger table with the simple option of -mxgot
While discussing various non x86 boards the topic came up about the Chinese government MIPS based processors, namely the Loongson-3A4000. I’ve tried several times on the past to buy one with no success however 2020 would make up with it as 2 separate leads yielded boards.
To me, there is a great deal of confusion around this setup as it goes by different names, and is sometimes spelt in English, other times Chinese (Simplified & Traditional) with different part numbers and vendors making it kind of confusing.
Various names include, but not limited to:
ICT Loongson-3A R4(loongson-3A4000)
I don’t want to sound like I’m going to just shit all over this thing, but it’s not free, it’s not subsided, and it’s not cheap. Weighing in at 元3,500 RMB the LX-6901 is not a machine for the masses, however it is a non x86 machine for the classes.
Thanks to my day job I was able to get my buyer to trace down several companies, and ads placed on TaoBao and another from AliExpress. Last time I tried both routes, along with the board manufacter Lemote, I was unable to get anything. This time however both leads would work out so now I have 2.
I was told that it would take upwards of 2 weeks for the order(s) to be fulfilled and I should have them in 3 weeks. However 4 business days later this box arrived in my office:
I suspect they need to temper people’s expectations on shipping, but luckily for me I’m not over seas, although shipping from China to Hong Kong does require a special permit for electronics.
Clearly the tape had been opened several times for various inspections as this shipment was destined to be exported. But props on the dragon tape!
As expected, two boards! Oddly and confusing enough both suppliers insist the boards are different.
Natrually, they are of course identical.
Here is a better glimpse at the board.
The Lemote LX-6901 is not without faults however, it has a memory controller issue and cannot operate correctly with 2 sticks of ram. Luckily my DDR4 extras are 16gb so it’s not bad for messing around. The board also can post ATI boards. However it doesn’t like my Asus Radeon R9 380 Strix board, although it posted fine. I have a few of the FirePro W2100 cards, not a remarkable card, but it does work.
In addition you do need a specific OS for the board, on vendor on AliExpress was unwilling to send me anything, while another on TaoBao was willing to send me UnionTech’s UOS.
the M.2 slot works fine and I was able to boot from USB, and install UOS. The BIOS is very ‘PC’ like, pressing ENTER will enter the bios, and you can change boot priorities, or drop to the UEFI shell if you so please.
Installation is pretty easy and straight forward. There is only a few options during install, the desination, if you should accept the default layout (why not)? and a language
The USB stick is slow, but it didn’t matter as I only needed to install twice. The first time I had both memory slots populated, and the board crashed at 5% of the install. I was able to do some searching around and found out about the bad memory controller, so popping out one of the DIMMs and I was able to install and use the machine.
UOS for the MIPS however is a seeming commercial product that is very difficult to buy outside of China (it may very well be allocated only for certain circles as you need a Chinese cellphone number, government ID, and some kind of project id?), although I’m still trying.
The phone support was useless, and I’ve had a few email exchanges on asking if it’s available for purchase, and if so how much. I’ll update if I can figure it out.
What does suck is that while UOS is not authorized you can’t get any OS updates, nor can you enable to root user. So yeah you can’t effectively own the machine with UOS. There is a ‘trial’ mode to enable a 90 day ‘grace’ period so at least I can add GCC and at least build software. Clearly if I can’t sort out UOS I’ll have to dump the kernel / initrd and restore another MIPS64EL Linux distro over the filesystem. Debian has MIPS64EL, and seems to be working to mainline the LX-6901.
UOS bills itself as a Windows replacement, and I have to say that I do enjoy using it. It has some rather ‘Windows’ qualities to it, like the sound mixer, and ease of installing apps from the ‘store’ however if it’s not in the store and it’s Not authorized you are out of luck. As much as I dislike distro of the week nonsense, I do like the idea of thousands of people being hired to flesh it out to make Linux usable, but only time will tell how much of it is translation to Chinese, and how much is developing software.
When it comes to performance the 3A4000 running at 1.8Ghz is faster than a Raspberry Pi 4, however not significantly faster CPU wise. However the big plus the MIPS does have is that it has a far more capable bus with M.2 and PCI-E slots along with SATA giving the board much better IO than any SOC solution like the Pis.
I built the BYTE Benchmark 5.1.3 and did this graph with data from running on a Zero for comparison. I had to adjust scales for some of this so its more visible, however the important data is here that CPU wise they are close together, but in the area of IO the Dragon pulls far ahead. For those who like the Linux boot score, the CPU ‘clocks’ in at 3594.02 BogoMIPS per core.
It’s been a large ‘discovery’ thing, and a long time since I’ve tried to make Linux a ‘daily driver’ and of course the scarcity of MIPS binaries on Linux is going to be an issue, but I’ll have to explore the apparent ARM/x86 compatibility as I can find more information about it.
Since this has been such a learning curve for me as I learn more things I’ll add them to this list:
In the world of “If you can’t encourage an exclusive, buy it” here we are at this crossroad again. With the new MS console getting ready to be pushed out into the world, there is no doubt that we are not only in for a new deluge of Skyrim ports, but the much anticipated Starfield should be appearing on nextgen consoles, the best way to keep it exclusive is to just buy the beleaguered studio, and push onwards.
No doubt the fallout from … Fallout 76 has burnt a lot of people, so this may just further isolate their diminishing fan base, only time will tell. Or normies just don’t care about FO76 as it was some MMMMOOOORPG thing that normal people don’t care about, and all they want to do is kill dragons, and shoot lazzer beams from their hands.
One thing that is kind of fitting is that the culture of ‘release it and patch it in the field’ is in safe hands at Microsoft!
Way back in the late 90’s from the University of Utah there was this fantastic project that promised to bring Operating System construction to mere mortals but taking existing PC operating systems, Linux, NetBSD, FreeBSD and break them down to their best components, and then interlink them using COM allowing you to glue the best parts together like lego.
And the project was called OSKit.
It was fantastic for something unknown at the time for creating so called ‘bare metal programs’ that didn’t have a real operating system, but rather could use operating features like LIBC, or the EXT2 filesystem. It was almost that level of ‘MS-DOS’ like feeling from protected mode, but being able to take more stuff with you.
And of course transforming the ELF into a multiboot executable that GRUB can load:
And now you are ready to boot, on say Qemu?
I was kind of surprised it never really took off, maybe it was too far ahead of it’s time. The most notable project I’ve seen that used it was OSKit-Mach, although they later on abandoned OSKit.. I’m not sure why but I would suspect the lack of updates post 2002 would have something to do with it.
Building this was… Interesting as I recall this being somewhat difficult, and I know I’ve probably made it more difficult, but I thought it would be ‘fun’ using the tools of the time. And 1999 has us at Debian 2.2r0. Which thankfully is on archive.org and is a mere 3 CD-ROMS for the i386 binaries. Installing that into VMWare wasn’t so difficult, and swapping CD images around I was able to get enough installed to start building things. For those of you who don’t want to install Debian, here is my pre-compiled Linux on Linux toolchain: i586-linux2.tar.gz. It’s i386 on i386, so you will need to be able to run i386 ELF exe’s. For OS X users that haven’t installed Catalina, you can try OSX-Linux-2.00-i586-gcc2723.tar.gz
I should point out, that although things have to be patched around for older versions of OSKit, 20020317 does build fine using GCC 2.95.2 (20000220) from Debian 2.2r0. So if you want to build in a VM, then you really don’t need any of this. But I’m strange, and I have my WSL2 Debian 10 to think about. So the easiest way to build GCC 2.x is with GCC 2.x so why not start in Debian?
First let’s prep our destination directory, and populate it like a good little cross compiler:
And now I can build stuff!… I then tar’d if up and copied it to my WSL instance, and now I can cross compile fine (a big plus of WSL2 is that you can install the 32bit support, and run old EXE’s! Take that Apple!)
Now it’s worth noting that a few things need to be edited, the ‘OSKit on UNIX’ thing won’t build cleanly and I didn’t investigate as Qemu is a thing now. So disable it in the modules.x86.pc file. Then run configure like this:
sh configure --host=i586-linux --prefix=/oskit --build=i586-linux --enable-modulefile=modules.x86.pc
Despite using the host, build or target setting it doesn’t pick up prefix of our cross compiler, so you have to manually edit Makeconf
Be sure to change the tool exports to look like this:
And finally remove -fno-strict-aliasing from OSKIT_FFLAGS, and now you can build!
The bonus is that it’ll build well under a minute on a modern machine.
As mentioned above you should now be able to take the hello world example kernel, and transform it to a multiboot, and boot it via grub.
Again this was such an exciting project I’d hate for it to just suddenly die in absolute obscurity. Maybe it’ll inspire others to try “assisted bare metal” programs, there was a DooM OS, among others in the era.
Again super thanks to shadyjesse for finding and fixing the larger issues, and philpem for his great emulator, freebee!
I have to say, having never played with an AT&T Unix PC, it’s kind neat with this windowing non X11 UI. Although even in emulation it’s incredibly slow. But such was the Unix microprocessor revolution of the era, it’s crazy to think the mighty SUN-2 is also on the same level of performance, although SUN would at least go the way of the 68020 before giving up on the 68k for SPARC.
Even though the 68000 lacked the ability to recover from bus faults, allowing a better path to UNIX with the 68010, OEM’s still brought their own MMU technology to flesh it out, leading to divergent systems. Not that it mattered all that much for AT&T as they started to establish themselves as the new defacto go to UNIX vendor they quickly abandoned the market leaving the Unix PC, and 3B2’s to die off. While so many like to think that the ‘Unix’ business is booming, it really only boomed once AT&T exited the market until Linux had started to gain enough mindshare post 1.0… Which also included 68000 support, although aimed for the the stronger 68030/68040’s.
Anyways I’m sure you didn’t come here for my ramblings about the 68000 instead you want an easy to run package to click and GO!
There are two executables, for normies, tourists, and people only wanting to witness the fun it doesn’t matter which one you use. For anyone wanting to install the 3B1 Unix, you’ll want “freebee-10sec-O2.exe”. Since the 3B1 uses a non standard format, if you want to use FAT 360kb disks from a PC emulator then you’ll need “freebee-9sec-O2.exe”. Isn’t compatibility great?