PINE64
How much linux is required for the phone to run? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+--- Thread: How much linux is required for the phone to run? (/showthread.php?tid=10877)

Pages: 1 2


How much linux is required for the phone to run? - overdrawnfettuccine - 07-28-2020

I'm sure I'm not the only one who wishes they can write their own OS

I've written code for an Arduino to communicate with a qualcomm chip/modem to receive and send SMS using AT commands. 
I wanted to try a from scratch for the raspberry pi but it seems like I'll get poor video performance because there's no documentation for using their GPU/video

I was wondering if there's a lot of linux that's required to get the phone running and if not would it be possible to write our own OS or embeded like as people may do for the Arduino?


RE: How much linix is required for the phone to run? - User 18618 - 07-28-2020

Utilising the work already done to the mainline Linux kernel is the easiest way to achieve results.

If you can expand on your question, e.g. if you are primarily interested in developing user space or kernel space, I'm sure knowledgeable community members can steer you in the right direction.


RE: How much linix is required for the phone to run? - Subsentient - 07-28-2020

(07-28-2020, 02:06 PM)overdrawnfettuccine Wrote: I'm sure I'm not the only one who wishes they can write their own OS

I've written code for an Arduino to communicate with a qualcomm chip/modem to receive and send SMS using AT commands. 
I wanted to try a from scratch for the raspberry pi but it seems like I'll get poor video performance because there's no documentation for using their GPU/video

I was wondering if there's a lot of linux that's required to get the phone running and if not would it be possible to write our own OS or embeded like as people may do for the Arduino?
You should definitely keep using the Linux kernel, but that is the only component you are strictly going to need. You could write an entire custom user space for the PinePhone if you really wanted to, although it will take you until you're old and gray. If you tried to rewrite everything that's needed to get phone calls working, the task really is just so monumental that I strongly suggest you don't bother trying at all.


RE: How much linix is required for the phone to run? - overdrawnfettuccine - 07-28-2020

(07-28-2020, 05:48 PM)Subsentient Wrote:
(07-28-2020, 02:06 PM)overdrawnfettuccine Wrote: I'm sure I'm not the only one who wishes they can write their own OS

I've written code for an Arduino to communicate with a qualcomm chip/modem to receive and send SMS using AT commands. 
I wanted to try a from scratch for the raspberry pi but it seems like I'll get poor video performance because there's no documentation for using their GPU/video

I was wondering if there's a lot of linux that's required to get the phone running and if not would it be possible to write our own OS or embeded like as people may do for the Arduino?
You should definitely keep using the Linux kernel, but that is the only component you are strictly going to need. You could write an entire custom user space for the PinePhone if you really wanted to, although it will take you until you're old and gray. If you tried to rewrite everything that's needed to get phone calls working, the task really is just so monumental that I strongly suggest you don't bother trying at all.

How sure are you about that? As the solo programmer I was able to check the status of the SIM card, connect to 4g cell towers, check the signal strength, receive text messages, react to them, store them on the phone, send text messages and pull up GPS information with GLONASS. I specifically remember using AT+CMGF and wondering why my PDU text is not correct and switching to text because it was suitable for our application. It's not too hard

https://sixfab.com/wp-content/uploads/2018/09/Quectel_EC25EC21_AT_Commands_Manual_V1.2.pdf


RE: How much linix is required for the phone to run? - KC9UDX - 07-28-2020

If you want to go low level, I wouldn't use Linux at all. I'd start out with Minix or NetBSD.


RE: How much linix is required for the phone to run? - overdrawnfettuccine - 07-28-2020

I guess what I'm asking is there some kind of pine library that covers the touch screen (screen and touch inputs), communication with the quectel chip (or that handles all thats necessary for calls and text), and hardware buttons or is it all done in linux and I'd have to go from scratch if I want to write a toy os?


RE: How much linix is required for the phone to run? - Subsentient - 07-29-2020

(07-28-2020, 10:14 PM)overdrawnfettuccine Wrote: How sure are you about that? As the solo programmer I was able to check the status of the SIM card, connect to 4g cell towers, check the signal strength, receive text messages, react to them, store them on the phone, send text messages and pull up GPS information with GLONASS. I specifically remember using AT+CMGF and wondering why my PDU text is not correct and switching to text because it was suitable for our application. It's not too hard

The problem you'll have is getting the system to boot that far. Take a look at the device tree structure for Linux's implementation of the pinephone. This isn't an ATTiny85 where you can just fiddle registers directly and run on bare metal at kernel-level with almost no setup. For example, look at the U-Boot implementation, and that's just to get the kernel executed. U-Boot also has its own device tree implementation. ARM devices are a nightmare to get booted from ground zero and doing anything useful, just in general. If the PinePhone had ACPI/EFI it would be different.

I'm not saying it can't be done, but it's going to be a LOT more difficult than hacking on an arduino or ATMega AVR MCU, and even much more difficult than an x86 PC.

I have to ask, why would you want to go to all that trouble, when anything one man can write would be a vast underutilisation of the PinePhone's Cortex-A53 CPU? I run full desktop-grade XFCE and desktop Firefox etc on mine, and that's my daily driver.


RE: How much linix is required for the phone to run? - overdrawnfettuccine - 07-29-2020

(07-28-2020, 10:52 PM)KC9UDX Wrote: If you want to go low level, I wouldn't use Linux at all.  I'd start out with Minix or NetBSD.

(07-29-2020, 12:41 AM)Subsentient Wrote:
(07-28-2020, 10:14 PM)overdrawnfettuccine Wrote: How sure are you about that? As the solo programmer I was able to check the status of the SIM card, connect to 4g cell towers, check the signal strength, receive text messages, react to them, store them on the phone, send text messages and pull up GPS information with GLONASS. I specifically remember using AT+CMGF and wondering why my PDU text is not correct and switching to text because it was suitable for our application. It's not too hard

The problem you'll have is getting the system to boot that far. Take a look at the device tree structure for Linux's implementation of the pinephone. This isn't an ATTiny85 where you can just fiddle registers directly and run on bare metal at kernel-level with almost no setup. For example, look at the U-Boot implementation, and that's just to get the kernel executed. U-Boot also has its own device tree implementation. ARM devices are a nightmare to get booted from ground zero and doing anything useful, just in general. If the PinePhone had ACPI/EFI it would be different.

I'm not saying it can't be done, but it's going to be a LOT more difficult than hacking on an arduino or ATMega AVR MCU, and even much more difficult than an x86 PC.

I have to ask, why would you want to go to all that trouble, when anything one man can write would be a vast underutilisation of the PinePhone's Cortex-A53 CPU? I run full desktop-grade XFCE and desktop Firefox etc on mine, and that's my daily driver.

Oh I had no idea there were many hoops to jump through. I thought it'd be fun to program a device that only runs my code with a touchscreen and wifi


RE: How much linix is required for the phone to run? - Subsentient - 07-29-2020

(07-29-2020, 01:24 AM)overdrawnfettuccine Wrote: Oh I had no idea there were many hoops to jump through. I thought it'd be fun to program a device that only runs my code with a touchscreen and wifi
Yeah it's depressing on ARM except in the server space where ACPI is starting to appear.

If you want that kind of barebones experience, I'd recommend moving up to raw AVR microcontrollers, like the ATTiny85, my favorite. They're a lot of fun, and they're bare metal entirely, no arduino board to baby you. Just 8K of ROM to put your compiled C into. You can get a row of around 10 of them for like $15, then you can fiddle with them however you like.

You could also consider getting into linux kernel driver development, knowledge which would be useful in both ARM and x86 spaces.


RE: How much linix is required for the phone to run? - overdrawnfettuccine - 07-30-2020

(07-29-2020, 10:29 PM)Subsentient Wrote:
(07-29-2020, 01:24 AM)overdrawnfettuccine Wrote: Oh I had no idea there were many hoops to jump through. I thought it'd be fun to program a device that only runs my code with a touchscreen and wifi
Yeah it's depressing on ARM except in the server space where ACPI is starting to appear.

If you want that kind of barebones experience, I'd recommend moving up to raw AVR microcontrollers, like the ATTiny85, my favorite. They're a lot of fun, and they're bare metal entirely, no arduino board to baby you. Just 8K of ROM to put your compiled C into. You can get a row of around 10 of them for like $15, then you can fiddle with them however you like.

You could also consider getting into linux kernel driver development, knowledge which would be useful in both ARM and x86 spaces.

How much boot/init knowledge is required? I absolutely would like a touchscreen and either wifi or a modem with 4g capabilities/SMS.
Would it have enough CPU power to run a basic rougelike game written in C at 60fps? Things simple enough that the nes/snes can do with pixels instead of tiles which make those consoles life easier