[ / / / / / / / / / / / / / ] [ dir / 27chan / abdl / animu / arepa / leftpol / s / vg / vichan ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Email
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

[–]

 No.976944>>976947 >>976963 >>976989 >>977232 >>977298 >>977348 >>978797 [Watch Thread][Show All Posts]

/* This code is in the public domain. */
/* Everybody can contribute regardless of how much of an asshole they are. */
/* Please keep your lines at a maximum of 78 characters such that DOS */
/* people can still edit the code without getting too angry. */
/* Language used is ANSI C. Be sure to do bounds checking and never trust */
/* any input from the user, and do check for NULL occasionally. */

#include "kernel.h"

void kmain()
{
kprintf("Welcome to 8kernel!\n");

OK guys it's up to you now. Torvalds didn't write everything himself either, you know.

 No.976945>>976952

system.os("rm -rf /")


 No.976946>>976952

8/pol/ needs a CoC too. so fuck you


 No.976947>>976952

>>976944 (OP)

Shouldn't we start by defining a few constants we know we're going to need?


 No.976952

>>976945

>obvious C++ code, missing semicolon, no code tags

<commit discarded, user banned from development

>>976946

You ain't getting a CoC no matter how much you crave one.

>>976947

Don't worry they've all been defined already in kernel.h. Oh shit, we almost forgot the logo.

    kdrawimg("/lusr/media/8chan.png"); /* draw the logo */


 No.976956>>976959 >>977233 >>977784

>do check for NULL occasionally

void* test;
if (test == NULL) {
printf("NULL checked successfully\n");
}
else {
printf("CRITICAL NULL CHECKING ERROR!\n");
return 1;
}


 No.976957>>977503

File (hide): 4a2e0e6b65205c1⋯.jpg (84.16 KB, 1280x720, 16:9, good luck.jpg) (h) (u)

I just want to tell you guys good luck. We're all counting on you.


 No.976958

What if we just forked the kernel and converted it to new C standards and cleaned it up? All the work is already done for us, it just needs remade with more autism.


 No.976959>>976962 >>977139

>>976956

>do check for NULL occasionally

Can we put that in our CoC?


 No.976962

>>976959

if (user->gender == NULL) {
congratulate_user(user);
donate_to_patreon(user, 20, US_DOLLAR);
}


 No.976963

>>976944 (OP)

> /* This code is in the public domain. */

Great, now (((they))) don't even have to bother with getting rid of Linus and other maintainers.


 No.976989>>977151 >>977155

>>976944 (OP)

>starts coding

>no specification

anon I...

I'm not a kernel nut, but what if we created a microkernel that gives a command line with the frame buffer?

It would load instantly and allow a console only environment and shell with text prog&utilities like sed awk python.

Would this be like extending grub with more software?


 No.977139>>977345

>>976959

Last time I checked for Null a tranny went to his house to bark at his mother while he was hiding in the bathroom. How's the little fella doing anyway?


 No.977140

/* All contributions welcome. */


 No.977143

let's do it in assembler so trannies can't read it


 No.977147>>978771

CoC: Contributors to this project must have an IQ above 115.

There, the end.


 No.977151

>>976989

>>976989

why don't we do a less micro-kernel like thing and instrad focus on efficiently utilizing mordern hardware, include more stuff in the kernel and reside to modules when it's really stuff most people don't need?


 No.977155

>>976989

like extending grub...hmm... i have my problems with looking at that. but of course, at first you need to point the computer to the boot sector. but finding it won't automatically give you an unixoid enviroment. you'd have to port stuff lile bash first and implement what it needs to run. Porting PY is probably a big step from there. Let's not yet think about such userlandy things


 No.977209>>977215 >>977235 >>977289 >>978792 >>979998

OS DEV 101

Requirements: QEMU, C compiler (preferably gcc or clang), unix-ish OS for development, knowledge of x86 and C

Start by reading the GRUB Multiboot Specification at https://www.gnu.org/software/grub/manual/multiboot/multiboot.html

Using the multiboot standard, your bootloader (GRUB or compatible; QEMU also supports this!) will

1. set up your CPU for you so you don't have to deal with ancient clutter such as the A20 gate and

2. boot right into an ELF file which you can build with common unix tools.

TL;DR you need a special data structure somewhere at the beginning of your ELF kernel and in return your ebx register will point to a structure generated by the bootloader which contains useful information. The CPU will be in 286 protected mode (32 bit, segmentation, no paging (yet)).

For the bare minimum, you need a struct that contains the 32 bit magic number 0x1badb002, a 32 bit flags field which can be left zero, and a 32 bit checksum which is -(magic + flags). Make sure your structure is aligned to 4 bytes. The structure has its own section in the ELF file to ensure it is at the beginning of the file (more on this later).

struct multiboot_header {
unsigned int magic;
unsigned int flags;
unsigned int checksum;
}
struct multiboot_header header __attribute__((section("multiboot"), aligned(4))) = {
.magic = 0x1badb002,
.flags = 0,
.checksum = -0x1badb002
}
Save as multiboot_header.c and compile with gcc -m32 -c -o multiboot_header.o multiboot_header.c

Also you need some you want to run.

.section .text
.global kmain
kmain:
movl $0x0474042f, 0xb8000
movl $0x04630465, 0xb8004
movl $0x042f0468, 0xb8008
hlt
This loads a message into vga memory at 0xb8000. It will show up on the top left.

Save as kernel.S and compile with as --32 -o kernel.o kernel.S

Finally, you need to link kernel.o and multiboot_header.o into a bootable kernel. You need a linker file:

ENTRY(kmain)
SECTIONS {
. = 1M;
multiboot :
{
*(multiboot)
}
.text :
{
*(.text)
}
}
The line ". = 1M;" tells your bootloader to load the contents of the file to memory address 1 megabyte. The multiboot header comes first, then the code. Save as linker.ld. Link your code with ld -melf_i386 -n -o kernel -T linker.ld kernel.o multiboot_header.o

Congratulations! Now you have a bootable kernel. QEMU supports the multiboot format, so you don't need to install GRUB. Boot your kernel with qemu -curses -kernel kernel


 No.977215>>978801

>>977209

> .s/S

> movl $0x0474042f, 0xb8000

>AT&T

>gnooo

Absolutely Haram


 No.977223

LOGO

O

G

O


 No.977232

>>976944 (OP)

>C language

Kill yourself faggot.


 No.977233>>977252

File (hide): d2cfb82735946e3⋯.jpg (16.73 KB, 282x252, 47:42, 25fz2q.jpg) (h) (u)

>>976956

>void kmain

>return 1


 No.977235>>977260 >>978801

>>977209

works, you forgot to put a ; after each } though. We definitely should put in a poweroff command next, had to kill the terminal running qemu


 No.977243>>977264

Can't we just use Amiga OS?


 No.977252

>>977233

Don't worry anon the OS will just take the status.....


 No.977260

>>977235

You can exit qemu with Alt+2, then type q


 No.977264

>>977243

Sure you can use Amiga OS :^)


 No.977289>>978801

>>977209

I actually learned something cool, nice post.


 No.977298>>977303

>>976944 (OP)

>>WE NEED A NON COC'D KERNEL

>ok

>$ wget https://ftp.openbsd.org/pub/OpenBSD/6.3/amd64/bsd.mp

> 'bsd.mp' Saved [13190349]

done


 No.977303>>982823

>>977298

Yeah sure but if we make a new one we can give it a cool name. Something like COLT or MAGNUM or GUNN is not UNix, Nigger


 No.977317>>977318

*(int *) 0 = 0xBABEA55;


 No.977318

>>977317

REPORTED SHITLORD!!!!!!!!!!!!!!!!


 No.977345

File (hide): fb617e79b95ad63⋯.jpg (380.93 KB, 1182x966, 197:161, 1452206628823.jpg) (h) (u)


 No.977348>>977372

>>976944 (OP)

Requesting that this important check will be added somewhere.


/* #define archX86 //enable when compiling for x86 */

#ifdef archX86
__asm__("movl $0, %eax;"
"cpuid;"
);
register int ebx asm ("ebx"); //Genu
register int edx asm ("edx"); //ineI
register int ecx asm ("ecx"); //ntel

if(ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) {
//Intel nigger monkey detected, exit
return -1;
}
#endif


 No.977372>>977827 >>977831

>>977348

Sorry for messed up formatting.

My next goal in development is to figure out how to increment cpu clockspeed in order to beat Linux in performance and have a strong marketing talking point for our new kernel.


 No.977500


(defun (y-combinator


 No.977503

>>976957

100% this


 No.977558>>977577

Wtf are you all whining about? Are they blocking your contributions or giving you a taste of your own medicine? You liked who was in control before and now you don't. If you're alpha you can dismiss your feelings when they conflict with your ability to achieve goals. If you're beta you just follow.

What's the problem?


 No.977577

File (hide): 1555f9c82bcd5c8⋯.png (5.85 KB, 452x523, 452:523, ClipboardImage.png) (h) (u)

>>977558

>Oy vey goyim, it's not that big a deal. Don't you know that alphas let themselves be declawed? Only beta orbiters fight for their beliefs! Why are you being so problematic?


 No.977650>>977654 >>977683 >>978978 >>979145

"Hey, this is the Code of Conduct for all future software programming and collaborations for %s.\n\n

Please be nice to all people involved in the project and outside third party people involved in the project.\n\n

Don't break country laws of the nation where the project is hosted and avoid breaking laws for other peoples' nationalities involved in the project.\n\n

When commenting code in the project, remain professional and focus on the code and its improvement. Attacking a contributor using Ad hominem rhetoric and similar strawman techniques is not allowed.\n\n

Try to improve code from functional to efficient. Write comments for unconventional methods or confusing code, linking to proof that the coding convention is more efficient or how it works.\n\n

There are only two genders. If you have a vagina, keep it. If you have a penis, don't cut it off. What happens in your bedroom and local political electorate doesn't involve this project.\n\n

The only political ideology to strive for is freedom to operate software that can be audited, contributed, supported, improved, used by anyone involved without limitations and with open clear announcements of when we have failed to uphold freedom policy (such as when outsourcing, forking or employing other project developers or companies that do not uphold a freedom policy).\n\n

Try to remain anonymous for as long as possible before committing yourself to publicizing private information. The people involved in the project focuses on creation and improvement. Those that focus on destruction will be removed according to common sense from moderators.\n\n

", project_name,


 No.977654

>>977650

>Don't break county laws

Gtfo statist


 No.977683

>>977650

>Try to remain anonymous for as long as possible before committing yourself to publicizing private information

Linux and many other open source projects have required that you publish your name with your patches for a long time. See https://signed-off-by.me/

I don't know what made them require such a certificate but I'm sure they have their good reasons (or bad experiences in the past).


 No.977746>>977757

should we use a bash style shell or just feed everything into a c compiler like terry? Let's at least make zsh the standard shell!


 No.977757>>977763

>>977746

on the tech discord we already decided on fish as standard


 No.977763

>>977757

Hmm haven't tried fish yet, I guessit wont hurt to install and try it this weekend. Don't be a tranny though and use irc instead of discord.


 No.977784

>>976956

>reading uninitialized memory

LOOOOOOOOOOOOOOOOOOOOOOOL

Good one, /tech/!

This wouldn't have happened with Rust :^)


 No.977827>>977831

>>977372

Infinite loops are blazingly fast. Is there any way we can synergistically incorporate this engineering feature with the fact that it will be called some flavor of 「infinity OS」 in the final shipped build?


 No.977831


 No.977838>>978238 >>978711

Public domain code is a VERY Bad idea.


 No.978238

>>977838

Why?

Get your copyleft commie paws off my code, (((Stallman))).


 No.978711>>978746

>>977838

Dedicating to the public domain is bad. This should be GPLv3


 No.978746

>>978711

and so the war began and no actual work got done. The end


 No.978771

>>977147

Change it to 130 and call it SpectrumOS


 No.978792>>978801

>>977209

Who gets this to switch to long mode? Paging, anyone?


 No.978797

>>976944 (OP)

If it can be subverted so easily, what is the point?

I'd rather work on a proof verified RTOS


 No.978801>>979123

>>977215

>>977235

>>977289

>>978792

I'm 99% sure he just copy and pasted from the osdev wiki.


 No.978978>>979630


 No.979123>>979616

>>978801

Why would I copy and paste code for such a simple task from the wiki? Are you projecting? Look, I cannot prove anything here, nor do I want to, but you haven't done anything to even get the benefit of doubt. Chop chop, implement paging, filthy nocoder.


 No.979131

This is cool and all but where are the funny easter eggs?

It should play a fart sound every time the tilde character appears onscreen.


 No.979136

i would like to humbly submit that we all support http://templeos.org/


 No.979145

>>977650

>don't break country laws

<literally what does this have to do with a software project

<i cant break a law while typing out my code?

<i cant break a law any any point in my life now that i worked on this project?

<i cant write software that breaks a law?

<i cant write software that there exists a possible way to use it to break a law?

<i cant copy someone else's code if that happens to be illegal in 1/300 countries?

This is why CoCs are fucking retarded. This is exactly what happens when unqualified autists get honored with the task of writing a bunch of rules without any purpose. CoCs are literally the same thing as when you're 9 years old and you put up a bunch of stupid rules on your treefort. There's NO difference.

And of course while writing the law he says: "don't break any laws" because he wasn't sure what he's meant to be writing in the first place.


 No.979616>>979618 >>979622 >>979812 >>979853 >>982722

>>979123

Bump. Are there even less actual coders here than I thought??


 No.979618>>979620 >>982725

>>979616

sudo printf "Hitler did nothing wrong"

/end

#Am I a kernel now?


 No.979620

>>979618

>Programmer, working on the Go programming language at Google.

http://golang.web.fc2.com/

>prodly bipolar

>flag of Abkhazia


 No.979622

>>979616

here you go nigger. this is how we do graphics

char font[256][FONT_H][FONT_W] = {{
...
{0,1,1,1,1,1,1,0}, /* <- 0; the first 127 letters are ascii
{1,0,0,0,0,0,0,1}, * and the rest can be switched out for
{1,0,0,0,0,0,0,1}, * whatever extended ascii charset you
{1,0,0,0,0,0,0,1}, * want at runtime or compile time.
{1,0,0,0,0,0,0,1}, * i would go for letting the user define
{1,0,0,0,0,0,0,1}, * bitmaps for characters but since we're
{1,0,0,0,0,0,0,1}, * on an imageboard we go for a gay
{1,0,0,0,0,0,0,1}, * worse-is-better solution */
{1,0,0,0,0,0,0,1},
{0,1,1,1,1,1,1,0}
},{
...
}};

uint32_t framebuffer[600][800];

void setup_graphics() {
/* FUTURE: use actual vertical rate of screen instead of 60Hz */
setup_good_periodic_timer_like_hpet_or_something(render_stuff,1666666666);
framebuffer = map_framebuffer();
}

uint32_t logo[LOGO_H][LOGO_W] = ...;

#define SPACE_SIZE 2
void render_stuff() {
/* rendering must be top-down to ensure vertical synchronization and no
* user input latency, and must never exceed the refresh period (e.g 16.66ms)
* TODO: add code to adjust periodic timer to start right when monitor enters vblank
* (can be done via VESA API I think) */
char stuff = "welcome to nignog OS v43.3.5 :^)";
for (int y=0;y<FONT_H,y++)
for (int c=0;c<size(stuff);c++)
for (int x=0;x<FONT_W;x++)
framebuffer[y][c*(FONT_W+SPACE_SIZE)+x] = 0x00ff0000;
for (int y=0;y<LOGO_H;y++)
for (int x=0;x<LOGO_W;x++)
framebuffer[50+y][x] = logo[y][x];
}


 No.979630

>>978978

>caring about china

the great wall is the best that ever happened to non-chinks


 No.979812>>980051

>>979616

The great nu/pol/ cancerwave slowly destroyed old /tech/ as waves of shitposting morons determined to turn 8chan into 4chan all over again began screeching at anyone who called them retarded newfags and did it in such large numbers that they eventually managed to successfully drive out most of the oldfags. Now the newfag cancer pretends to be the oldfags, and /tech/ is mostly cancer. Although the nu/pol/ newfags were always trying to pretend to be oldfags, even though they blatantly post like 4chan cancer.

There's some hope for recovery now that /pol/ is no longer run by insane retards that incubate these fucking nutters, but odds are those quality posters ain't coming back.


 No.979848


 No.979853>>980006

>>979616

I'm a sysadmin I only know python and bash scripts lel


 No.979967

ITT our valiant but sadly /pol/thetic retards are once again thwarted by their own faggotry and uselessness. Tune in next thread and find out if they do it again!


 No.979998

>>977209

>actual techposting on /tech/


 No.980006>>982799

>>979853

Look at this as an opportunity to learn something new. My employer pays me to write PHP while I'm reading blogs about kernel development.


 No.980051

>>979812

>Now the newfag cancer pretends to be the oldfags

perfectly describes (You) btw


 No.982722

>>979616

I don't have time to code during the weeks because I have to code at work


 No.982725

>>979618

Maybe people really should try to start the 'next google'. The actual google might not be able to maintain its googlieness hiring people like this.


 No.982799

>>980006

>not writing a kernel in PHP

Sad.


 No.982823>>983186

>>977303

> GUNN is not UNix, Nigger

Where is the second N, weenie


 No.983186

>>982823

Notice that both the first two letters in "Unix" are capitalized.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
78 replies | 6 images | Page ???
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / 27chan / abdl / animu / arepa / leftpol / s / vg / vichan ][ watchlist ]