LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-28-2013, 05:49 PM   #1
TOOOOOOOOOOOOOL
LQ Newbie
 
Registered: May 2013
Posts: 9

Rep: Reputation: Disabled
im trying to write a operating system


it is very simple and i have written it already...part of the instructions says to open a terminal and find the parent directory....what is that?
 
Old 06-28-2013, 06:03 PM   #2
TOOOOOOOOOOOOOL
LQ Newbie
 
Registered: May 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter.
 
Old 06-28-2013, 06:19 PM   #3
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 319

Rep: Reputation: 80
So you wrote an operating system and you don't know how make works.. Let's pretend you are not lying.. Anything you are actually willing to compile you can open a terminal, probably you have to uncompress the source code with something like tar xfz file.tar.gz, then enter in the directory cd namedirectory and the type make. And then press enter.
 
Old 07-07-2013, 04:41 PM   #4
TOOOOOOOOOOOOOL
LQ Newbie
 
Registered: May 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Celyr View Post
So you wrote an operating system and you don't know how make works.. Let's pretend you are not lying.. Anything you are actually willing to compile you can open a terminal, probably you have to uncompress the source code with something like tar xfz file.tar.gz, then enter in the directory cd namedirectory and the type make. And then press enter.
yea my OS is simple...I was following a tutorial...if i get the OS to work it will only turn on a LED. But when it started asking about Parent and source directories..i got lost. I am a newbie and i just have a 4gb SD card an I am not that familiar with linux yet.
 
Old 07-07-2013, 05:18 PM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Not sure but perhaps calling it an operating system might be a slight overstatement in that case

Have a look at this tutorial. It might clarify lots of things for you.
http://rute.2038bug.com/index.html.gz
 
Old 07-08-2013, 05:22 AM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
I think this is what he's trying to do, from what he mentioned in another thread:
http://www.cl.cam.ac.uk/projects/ras.../tutorials/os/
 
1 members found this post helpful.
Old 07-08-2013, 07:34 AM   #7
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by brianL View Post
I think this is what he's trying to do, from what he mentioned in another thread:
http://www.cl.cam.ac.uk/projects/ras.../tutorials/os/

Thanks for the link. I like those projects. I played with LEDs and a RPi but I did it in Python.
 
Old 07-23-2013, 05:24 PM   #8
TOOOOOOOOOOOOOL
LQ Newbie
 
Registered: May 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
parent and source directories

i still dont know what a source directory is or parent directory...here is the instructions givent from the website COMPUTER LABORATORY. I am trying to write a simple OS for the PI raspberry. here are the instructions.
here is a new addition to the instructions for website : http://www.cl.cam.ac.uk/projects/ras...s/os/ok01.html
the instructions:
To be explicit, the folder structure should look like:

build/
(empty)
source/
main.s
kernel.ld
LICENSE
Makefile

here is the code i wrote for the OS..

. sections .init
.globl _start
_start:
ldr r0,=0x2020000
mov r1,#1
lsl r1,#18
str r1,[r0,#4]
mov r1,#1
lsl r1,#16
str r1,[r0,#28]
loop$:
b loop$
mov r2,#0x3F0000
wait1$:
sub r2,#1
cmp r2,#0
bne wait1$


THAT WAS THE CODE i put in a small text document. I just dont know how to get this into the kernel and what folder i should swap it with so the OS will run off this document. Its only supposed to turn the LED light on an off for the PI Raspberry. This was as far as lesson one and two took me.

HERE IS THE LAST STEP THAT I DONT KNOW HOW TO DO..(BELOW)

So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values.

To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again.

Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See Lesson 2: OK02 for a guide to making the LED flash on and off.

[1]^ OK, I'm lying it tells the linker, which is another program used to link several assembled files together. It doesn't really matter.
[2]^ Clearly they're important to you. Since the GNU toolchain is mainly used for creating programs, it expects there to be an entry point labelled _start. As we're making an operating system, the _start is always whatever comes first, which we set up with the .section .init command. However, if we don't say where the entry point is, the toolchain gets upset. Thus, the first line says that we are going to define a symbol called _start for all to see (globally), and the second line says to make the symbol _start the address of the next line. We will come onto addresses shortly.
[3]^^ This tutorial is designed to spare you the pain of reading it, but, if you must, it can be found here SoC-Peripherals.pdf. For added confusion, the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS.
[4]^ Only values which have a binary representation which only has 1s in the first 8 bits of the representation. In other words, 8 1s or 0s followed by only 0s.
[5]^ A hardware engineer was kind enough to explain this to me as follows:
The reason is that modern chips are made of a technology called CMOS, which stands for Complementary Metal Oxide Semiconductor. The Complementary part means each signal is connected to two transistors, one made of material called N-type semiconductor which is used to pull it to a low voltage and another made of P-type material to pull it to a high voltage. Only one transistor of the pair turns on at any time, otherwise we'd get a short circuit. P-type isn't as conductive as N-type, which means the P-type transistor has to be about 3 times as big to provide the same current. This is why LEDs are often wired to turn on by pulling them low, because the N-type is stronger at pulling low than the P-type is in pulling high.

There's another reason. Back in the 1970s chips were made out of entirely out of N-type material ('NMOS'), with the P-type replaced by a resistor. That means that when a signal is pulled low the chip is consuming power (and getting hot) even while it isn't doing anything. Your phone getting hot and flattening the battery when it's in your pocket doing nothing wouldn't be good. So signals were designed to be 'active low' so that they're high when inactive and so don't take any power. Even though we don't use NMOS any more, it's still often quicker to pull a signal low with the N-type than to pull it high with the P-type. Often a signal that's 'active low' is marked with a bar over the top of the name, or written as SIGNAL_n or /SIGNAL. But it can still be confusing, even for hardware engineer1
lsl r1,


Thanks for yalls help...maybe someone can help me out. Thanks
 
Old 07-23-2013, 09:51 PM   #9
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by TOOOOOOOOOOOOOL View Post
i still dont know what a source directory is or parent directory...
the source directory is the one called "source". It is listed explicitly in your post as "source/". Do you know what a directory is? If you are a windows user, then you may be used to calling directories "folders".

The parent directory is the directory above it in the directory tree (again substitute "directory" for "folder" if you are familiar with windows).

Evo2.
 
Old 07-23-2013, 10:00 PM   #10
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

in my previous post "above" should have been "below"... unless the tree is upside down.

Evo2.
 
Old 07-23-2013, 11:12 PM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
/path/to/SomeDirectory

"to" is the parent of "SomeDirectory"

"path" is the parent of "to"

Often the "source directory" is short for "the directory that contains the source code"

In this particular case

/path/to/
kernel.ld
LICENSE
Makefile
build/
(empty)
source/
main.s
They literally mean the directory called "source"

/path/to, is just a "placeholder"
a 'real world' example might look something like this

/home/bob/Pi/Lessons/1_OK01
kernel.ld
LICENSE
Makefile
build/
(empty)
source/
main.s
Quote:


7 Pi Time
So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory.
they are asking you to change to the /home/bob/Pi/Lessons/1_OK01 directory

It might have been easier to understand if they had made a simple addition
Quote:
7 Pi Time
So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory,the one that contains the file Makefile.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The non-operating system operating system LXer Syndicated Linux News 0 06-26-2010 06:42 PM
Tracing Intruders connecting to our system in Redhat Linux operating system vkunasani Linux - Software 4 02-15-2010 07:23 AM
'Operating system not found' Any operating system installed wont work. TechniSlave Linux - Newbie 55 02-09-2009 12:02 PM
Total Noob Question (Operating System vs File System) fuzzy1 Linux - Newbie 14 02-06-2009 11:33 AM
My grub is not loading on dual operating system with windows Xp Pro causing my system marlene tack Linux - Newbie 2 03-17-2008 08:54 AM


All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration