News for hackers. Stuff that matters.

alehyze

:-)
Thanks :-)

The article that got me started is the pdf taken from a conference called "OpenBSD Kernel Internals: The Hitchhiker's Guide" mentioned here: https://www.openbsd.org/events.html

I just checked the link and the site seems to be down for me now, so I refer you to that page. Hopefully it will come back up or the link will be updated.

In that article it describes how to add a syscall to openbsd. So you start by writing a very simple one just to see that it works and get comfortable rebuilding the kernel and testing your syscall with a userspace program.

Then, since I roughly knew what I wanted to achieve, I started looking at kernel code and finding the parts relevant to what I wanted to do.

Then take baby steps with your changes, try and fail until you succeed with a small bit before moving on to the next. Especially value failures, as they give you hints about what is going on. Think why it could have failed and try a different approach that should not fail in the same way. Very tedious and time consuming, but a very good way to learn when you don't have the books.

Then looked for hints on the web and talked to the awesome people on the mailing lists and on the reddit OpenBSD channel.

I did not talk too much to people though, I asked a few questions at the beginning and then had a short conversation about allocating contiguous physical memory to a userspace task, which is something that OpenBSD does not do. I figured out how to do that by myself, by trial and error. Same with other details.

My mindset was: I know how to do this with bare metal, there must be a way to connect to the kernel code and do the same in a way that does not break things too much if I keep it limited in scope.

I hope this helps :-)

Latency is a huge barrier, and it does not come only from OSes.

For example, modern television sets have a "gaming" mode because in normal mode they somehow process the video frames to make them look better, in a way that introduces latency.

Someone who works on audio software told me that audio over bluetooth has a very high latency too.

There are several bits that can introduce latency in a system. The OS is the part that software developers can adjust and improve.

Yep, that's amazing!!!

And it illustrates perfectly why what I am doing is cool.

I played that game in the browser and it looks great. But the controls are quite a bit laggy. That is not the developer's fault, they cannot do much about it. The medium that they chose is not designed for low latency.

My project enables developers to make a game like that more fun when you actually play it.

Can you elaborate? What do you mean by "performance" ?
Thanks :-) I like especially the pico-8, as it's fairly easy to write an emulator for that, as far as I understand.
This makes a lot of sense. Thank you :-)

Those are complicated matters.

I just have no idea how to do this properly at the moment. I am just hearing people's opinions for now and I'll try and do something that people are generally happy with. On the other hand, it's also true that one cannot please everyone.

To me it's like: "I have done something that I think is cool, let's see what people think about it".

I mentioned that I wanted to do a product out of this and people got emotional, as if it was granted that it's going to be a huge success.

I really wish it was that easy. I think that this is not realistic. It would take a lot of work from a lot of people who need to be paid because they need to pay their own bills to make this into a success. And it still could fail.

I regret having mentioned that I may want to turn this into a product, because it put too much focus on that rather than on the tech that I have developed.

> That was meant to be constructive :)

Uh, ok, sorry :-) It's just that I have been a bit upset by some other comments that made me feel like I am a bad guy only because I did something different and said it would be nice to make some money out of it.

> I enjoy typing and drawing on my iPad Pro, and one of the reasons it is enjoyable is that the iPad Pro has very low input latency.

You would be surprised. Apple has put a tremendous amount of effort to make their stylus low latency, and they did a terrific job. The latency is good for handwriting and drawing, or for typing. But for games I believe that there is still a very long way to go. Early machines had a solution that worked very well but the industry evolved in a completely different direction.

> Your interesting approach is not what people are going to buy. They're going to buy what happens because of it. That's what you've got to sell if you want to sustain the development!

You're absolutely right about this. I am painfully aware of this. I have many years of "interesting approaches" that go nowhere for lack of ability to connect with people on that level.

You know, different people have different abilities. There are exceptional people who are good both at their craft and at selling it, some only at their craft. Picasso and Van Gogh, Edison and Tesla, Gauss and Galois.

I am hoping to connect with other people, with experience in the area of selling and communications.

But more practically, there are a few places to get started. One I am looking at is the retro gaming space. Input latency is a big deal there. If I can manage to give people a low latency retro console, they are going to be interested. I have to customise an existing emulator, which I will be looking into after this round of "marketing", i.e. posting about my project on social media.

At the moment there is no "price", as there is nothing to sell :-)

I am only looking for people's opinions now

thanks :-)
Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @07:46PM (#27375409)
Regarding the "open source, if you like it buy me a coffee" thing, I am not against that. By saying "I'd like to turn this into a product", I don't rule that out. I already mentioned that in another comment.

To me at this stage it's more about making a living out of something I love doing rather than becoming the next big tycoon.

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @07:23PM (#27375260)
I haven't thought this through I have to admit.

I thought that the BSD license was friendly to this kind of stuff.

If I step on people's toes I would ask for forgiveness and try to give them something back, which I think is just the right thing to do.

For example, I read that OpenBSD developers were sad that most of the contributions they got was from individuals more than from companies, when they actually help companies a lot.

Maybe this could be a way to change that situation?

At the end of the day I want to be happy with myself. I don't want to make enemies. Possibly, I would love to keep working on this for a living as I enjoy it more than everything else I did in the past.

This is not a product yet. If it's going to be, it's going to be a very long and hard way before that happens. Why is everyone so concerned about money at this stage?

Personally, I thought that this was a cool thing that some people would like. Maybe I could make a simple living out of it.

Most people comments seem to me like they are assuming that this is going to be a huge success that could make money and are worried that the other devs would be left out with nothing.

Isn't this a bit of a prejudice? And isn't it premature to assume it's going to be a success?

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @07:08PM (#27375141)
Thank you for your reply :-)

First of all, consider that I am just a guy who usually programs for a living and has been in a personal situation where he could not work. For some time I had an idea in my mind about this stuff and instead of getting depressed about not being able to work I went for it and started making it.

I am not asking for money at present, I am only asking for opinions.

My "product" is not a product yet, it's a prototype, there is no cost at the moment.

I clearly said in another reply that I am not even against open sourcing it, if that is what has to happen. Or maybe people will not be interested enough and forget about it. Who knows.

What I am saying is that I have spent quite some time working on this stuff and at the end of the day I have to pay my bills too, so it would be nice if I could make some people happy and get something back.

What worries me is that I genuinely believe that this is an interesting approach to "an operating system for games and game development" and I may not be able to sustain its development for much longer.

In its current form it can be added to a raspberry pi 4, yes, as this is what I have done myself.

Now for the question about why would you be interested. If low latency gaming is not interesting to you, then it would not be the product for you.

You are right, there is lots of great software out there that can be obtained at no cost.

That is true for everything. For example I don't watch much television so I don't use paid tv services.

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @06:13PM (#27374687)
thanks :-)
Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @06:06PM (#27374618)
I am sorry if people feel like this is not the right place for this post.

If the admins feel like that, please remove the offending post(s). Or ask me to amend them.

I have made something that I think is cool and with the hope that others liked it, but if it's out of place I can only apologise.

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @05:48PM (#27374413)
By the way, here is a video demonstration of all this. It's not very polished and VSYNC does not work, but it works pretty much how I describe here.

https://youtu.be/KhRnGbVhejk

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @05:45PM (#27374383)
As mentioned in another comment, I am planning to add a C/C++ interpreter and I have put GNUstep in there, so that people can easily build their sprite editors and other game dev tools :-)
Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @05:39PM (#27374328)
I just released the "big picture". I am sure that the OpenBSD kernel devs can redo what I did ten times quicker (in terms of development time) and a million times better (in terms of clean integration with the kernel and security) if they want to. They know all of the details of the kernel :-)

That said yes, I would like to be able to turn this into a product.

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @05:35PM (#27374295)
What it does at the moment is a bit hacky, in that it does not integrate with the existing graphics stack in the way people could think.

I haven't written a driver for the pi graphics card or for HDMI audio. What I do with graphics is to save the existing state before beginning the game, do whatever I want during the game and restoring the state when it ends. With audio I am not doing it that cleanly as I believe that OpenBSD does not currently even touch HDMI audio registers.

As for the reduction of stuttering, when the game begins I stop 3 of the four cores, assign them entirely to the game ( also with new interrupt vector tables both in EL0 and EL1 ) and when the game exits give them back to OpenBSD. That way, while the game is running without interruption, the single core that is left to OpenBSD is free to run admin tasks. Since the game has a process that can be scheduled by that single core, the game can do networking or file I/O using OpenBSD, because the different cores have the same entries in the user space MMU tables and so they share memory and can talk to each other. OpenBSD cannot interrupt the game, it can only kill it if needed.

Regarding upstreaming my work the answer is "Probably not. But if the world wants it open sourced I am not against it and could think about doing a fork (Say we call it OpenBSD4Games). Or I could just give some help with the raspberry pi drivers."

The reason for that is that I am doing quite some stuff that am pretty sure the OpenBSD devs would not be happy to put in. OpenBSD is strongly focused on security. I am pretty sure they would not want to have some code in there that hijacks 3 cores out of 4 and gives them to a user process. Another example: I have been told that giving several contiguous memory pages to a user task is something that should not be done in OpenBSD. I understand why but then I give a game quite a few contiguous memory pages that the hardware will use for the frame buffer and so has to be contiguous.

Also, this is prototype code. It works for me, it still needs a ton of work and might not even be 100% correct. I cannot possibly understand all of the little details in the kernel in 2 months.

I am proud of this achievement though and would love to be able to turn this into a real product that many people enjoy.

Regarding the "home computer" part, I thought about game devs. When doing a game, it's not only the game code that is important. The tools are very important as well. So I built GNUstep ( on OpenBSD it does not currently work on arm64 ) so that it's super easy to build tools for game development in Objective-C.

Also I thought about playing around and experimenting, and I am planning a GUI app with GNUstep that integrates a C/C++ interpreter called cling, which is developed by CERN for their physics simulations if I am not wrong. With that, a game developer will be able to experiment with code and tweak it in a way that is similar to what Xcode playgrounds does with swift on the Mac.

Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @04:58PM (#27373937)
Without going into the details: I have read the linux drivers and understood how HDMI audio and hardware sprites (planes) work amongst other details. Then implemented that myself in C and assembly with no OS. Then modified the OpenBSD kernel in a way that it can use that stuff and do even more sophisticated stuff. This is not just recompiling the kernel with some different options. It's writing substantial code. I modified 6.8 because 6.9 was not even out when I started, so it's been a couple of months of very hard work on the kernel only, not counting all the time I spent on it before when I was working bare metal. And it's not finished yet :-)
Re:Raspberry Pi 4 OpenBSD based home computer/gaming console on Wednesday June 02, 2021 @04:12PM (#27373484)
True.

The fact is that the zero does not have the computing power I want. The 3 does not have USB3 and that is a big issue for another reason.

It has to be the raspberry pi 4 :-)

Raspberry Pi 4 OpenBSD based home computer/gaming console

When I started programming as a kid, I had a Commodore 64 and later an amiga 500. Those machines came with very simple software and expected you to write some, rather than giving you thousands of pre-made packages to learn and play with.A lot of existing software was video games. They were much simpler than those people play nowadays but they were still a lot of fun. Part of the fun was low...

( Read More... | 43 comments | 65 points | on HN )
Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @09:42AM (#26621388)
My 1) is a reply to why I did it. I took it as a literal question and I gave a genuine answer.

EDIT: Ok, I think I see what you mean now. I believe your question is about what is the appeal in doing this stuff. It's pretty much the same reason why someone would build a chair or a table from scratch versus buying one at IKEA and building it. The former gets the enjoyment from all of the journey from a piece of wood to the finished chair and from building exactly the chair that they want and the latter is probably more focused on the chair itself. END_OF_EDIT

As for the rest, I believe that some answers are already in the post and in the comments that I and other people made.

I may have misunderstood what you meant and if that is the case let's restart from scratch:

Do you want to program a raspberry pi at the hardware register level, without any APIs ?

Re:Dragon’s Lair on the TI 99/4A on Monday March 29, 2021 @05:32AM (#26619236)
this is sooo cool! I had no idea that something like that existed. Kudos to whoever has done it :-)
Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @05:12AM (#26619086)
Let me reply to both questions.

1) why?

I always loved low level programming. I started as a kid on a c64 and then on an Amiga and really loved tinkering with those. Then when I got old enough to get a job in the computer industry there were layers of software everywhere and no more tinkering. I felt cheated.

I love old school games more than modern ones. This is only a matter of personal preference. People still play chess after thousands of years and nobody complains that the chessboard is obsolete, so there must be something about games that does not age with time and technological progress.

With modern video games there is a perceivable delay between when I press a button and when something happens. That is called "latency", and for many reasons it is one thing that has become worse and worse with advancements in technology. It appears to me that most people are used to having high latency in games and they do not bother too much. To me it breaks the immersion. Again, purely personal preference. One strategy to reduce latency is to remove software layers between the game code and the hardware.

2) isn't the pi hardware already fairly well documented?

Yes and no. Yes if you want to play with electronics via GPIO. No if you want to make old school games or if you want to write your own toy but fully functional operating system.

Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @04:16AM (#26618813)
What I have so far are simple demos, without anything even close to a kernEl. What I have is closer to the c64 karnAl in the sense that I have a few functions that do stuff but then again it's even smaller than that. Also I expect the usual firmware that boots linux to do its setups before booting my program.
Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @04:12AM (#26618792)
yep :-) only thing to add: hardware sprites do not necessarily have to be small in size. What characterise them is the fact that you don't have to redraw them in software every frame in order to move them.
Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @04:11AM (#26618787)
The SOC designer decided for whatever reason not to disclose this kind of information. They published quite a lot of stuff about the GPU on the other hand. They must have their own reasons and I am going to respect that.
Re:I reverse engineered the Raspberry Pi hardware [video] on Monday March 29, 2021 @04:08AM (#26618769)
Apologies, this is what I posted nonetheless. Showing the reverse engineering would be probably extremely boring for most people. It's many hours of me coding, extracting the SD card from the Mac, inserting it into the pi and getting frustrated because it does not work as I expected yet until finally I get it right and say "YES!" :-)
Re:I reverse engineered the Raspberry Pi hardware [video] on Sunday March 28, 2021 @08:14AM (#26609671)
I managed to reverse engineer some of the raspberry pi hardware up to the point that I have all the ingredients to make a retro-like gaming console.

Particularly, I have audio over HDMI and hardware sprites.

Older »