2

Please note that I am building this Os through a different sd card with raspbian, but on the same machine(Pi Zero W) as the one I'm testing my Os on.

I am trying to learn how to create my own raspberry pi operating system and I'm following the tutorial

https://jsandler18.github.io

and using bits from

https://wiki.osdev.org/Raspberry_Pi_Bare_Bones

to setup the basics. I have a raspberry pi zero w to attempt to compile the os.

On the tutorial it says that once I have finished creating the first layer of files,

  1. boot.S
  2. kernel.c
  3. linker.ld

I must cross-compile the files. So I did and all the commands worked including the one to create kernel.img. The tutorial then said to remove all files from the boot partion in the sd card except for:

  1. bootcode.bin
  2. fixup.dat
  3. start.elf

I then put my newly created kernel.img into the boot partion and ejected the sd card and shutdown the current desktop.

Start Up

When I put the Sd card into the pi zero it started up like usual the led green light on. The rainbow screen appeared with the recovery screen shortly appearing later. For some reason after that the screen was black and hadn't echoed the intended

 Hello, kernel World!

onto the screen. I can confirm that the HDMI cable was still connected as the screen didn't say "No Signal". Another thing which I'm not sure is related is that the usb plugin to the pi zero wasn't connecting during all of this, so no keyboard and mouse.

The main thing I would like to know, is why the screen isn't displaying the intended data.

Please comment if you need any other information

Thanks for the help

Update

I did some research and found that when the screen is blank and not doing anything it means kernel.img is invalid. This is a step to the solution, but doesn't solve the problem.

Below I will list the commands I use too compile the files:

To Convert boot.S to boot.o

  arm-none-eabi-gcc -mcpu=arm1176jzf-s -fpic -ffreestanding -c boot.S -o boot.o

To Convert kernel.c to kernel.o

  arm-none-eabi-gcc -mcpu=arm1176jzf-s -fpic -ffreestanding -c boot.S -o boot.o

To create the myos.elf file using linker.ld to connect kernel.o and boot.o

  arm-none-eabi-gcc -T linker.ld -o myos.elf -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc

To create kernel.img from myos.elf

  arm-none-eabi-objcopy myos.elf -O binary kernel.img

All these commands successfully go through with the files from the first tutorial(the one by JSandler)

Is it a possibility that these tutorials are outdated and that's why they don't work?

Programing
  • 21
  • 2

0 Answers0