Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6353585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:26:15+00:00 2026-05-24T22:26:15+00:00

I am writing a kernel, so that i am starting with a hello world

  • 0

I am writing a kernel, so that i am starting with a hello world program in kernel.

I have written a hello world kernel in c++ and it compiles successfully.

But when i boot it, it does not show anything on screen.

What’s wrong with this code?

link.ld

OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS{
. = 0x00100000;

.text :{
    *(.text)
}

.rodata ALIGN (0x1000) : {
    *(.rodata)
}

.data ALIGN (0x1000) : {
    *(.data)
}

.bss : {
    sbss = .;
    *(COMMON)
    *(.bss)
    ebss = .;
}
}

loader.asm

[BITS 32]

global start
extern _main

start:
    call _main
    cli 
    hlt

video.h

#ifndef VIDEO_H
#define VIDEO_H

class Video{
    public:
        Video();
        ~Video();
        void clear();
        void write(char *cp);
        void put(char c);
    private:
        unsigned short *videomem;
        unsigned int off;
        unsigned int pos;
};
#endif

video.cpp

#include "Video.h"

Video::Video(){
pos = 0;
off = 0;
videomem = (unsigned short*)0xb8000;
}

Video::~Video(){}

void Video::clear(){
unsigned int i;
for(i=0;i<(80*25);i++){
    videomem[i] = (unsigned short)' '|0x0700;
}
pos = 0;
off = 0;
}

void Video::write(char *cp){
char *str = cp, *ch;
for(ch=str;*ch;ch++){
    put(*ch);
}
}

void Video::put(char c){
if(pos>=80){
    pos = 0;
    off+=80;
}
if(off>=(80*25)){
    clear();
}

videomem[off+pos] = (unsigned short)c|0x0700;
pos++;
}

Kernel.cpp

#include "Video.h"
int _main(void){
Video vid;
vid.clear();
vid.write("Hello World!");
}

I am compiling it using this commands:

g++ -c video.cpp -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
g++ -c Kernel.cpp -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
nasm -f aout Loader.asm -o Loader.o
ld -T linker.ld -o Kernel.bin Loader.o Video.o Kernel.o

It does not give any errors.

If it is possible to debug, then please help me to how to debug.

I am booting it in virtual box.

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:26:17+00:00Added an answer on May 24, 2026 at 10:26 pm

    Have you tried qemu? When making a tiny os at uni, it proved to be the best program for this type of stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a C/C++ program that I'd like to have run when a user
I have the following makefile that I use to build a program (a kernel,
I'm writing a program that requires the following kernel launch: dim3 blocks(16,16,16); //grid dimensions
I writing a linux kernel module that does some work with /proc... I'm trying
I'm writing a Linux kernel module that needs to open and read files. What's
I'm working on writing a kernel, and I have a few friends working with
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
I'm writing a linux kernel module that emulates a block device. There are various
I generally have ignored using macros while writing in C but I think I
SOLVED see Edit 2 Hello, I've been writing a Perl program to handle automatic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.