flat assembler
Message board for the users of flat assembler.

Index > Linux > what is linux

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 19 May 2007, 02:51
could anyone insight me on what is linux and linux kernel?

i explain what i understood currently, if wrong, please correct me.
linux kernel could be downloaded from http://www.kernel.org/

linux kernel is like windows API

kde, gnome is like explorer.exe in windows.

what those distro did are, combine a boot loader (or linux kernel can self-boot?), linux kernel, window manager, etc software

linux kernel can be used to detect hardwares (on boot) and provide access to it through kernel api (am i correct?) or device drivers are separated from kernel? or kernel only contained basic driver?

if i put linux kernel and put a prompt (bash or ect shell), i can expect it to function like DOS expect the program calls to linux kernel. (am i right?)

thank you.
Post 19 May 2007, 02:51
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 19 May 2007, 04:53
Simply put :
Linux itself is just a kernel.

http://en.wikipedia.org/wiki/Kernel_%28computer_science%29
"In computer science, the kernel is the central component of most computer operating systems (OS). Its responsibilities include managing the system's resources and the communication between hardware and software components. As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processors and I/O devices) that applications must control to perform their function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls."

The kernel itself is not a standalone tool, so it needs another tools to work (bootloader, compiler, window manager, etc). and that forms the OS (the GNU/Linux system).

CMIIW
Post 19 May 2007, 04:53
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 May 2007, 15:53
Quote:
inux kernel is like windows API

no. linux kernel is like native API, even not entire. Windoze's kernel contains code to handle graphical mode. In Linux world, this code is not in kernel, it's in thing called "x server".

Linux kernel contains things like those in kernel32.dll

X server has it's API, but it's quite ugly one, so there are libraries that wrap X server API into nicer API. These libraries are somewhat similar to Win32 GUI API (user32, gdi32).

most common GUI libraries are GTK and Qt.

Quote:
kde, gnome is like explorer.exe in windows.

not exactly. KDE and GNOME are complete packages of GUI applications. For example they include GUI app to set network connection etc.

"Explorer.exe" is just a "window manager", just piece of entire package.

Quote:
what those distro did are, combine a boot loader (or linux kernel can self-boot?), linux kernel, window manager, etc software

yes. linux kernel doesn't boot itself, you use boot manager (lilo or grub).

Quote:
linux kernel can be used to detect hardwares (on boot) and provide access to it through kernel api (am i correct?) or device drivers are separated from kernel? or kernel only contained basic driver?
For user-mode apps you shouldn't use kernel API. You should use standard C library API as much as possible. Device drivers are compiled into kernel, or dynamically un/loaded as "kernel modules".

I think you should try to instal Gentoo. Just by installing it, you will understand lot of linux. It's not hard, but it takes quite some time.
Post 20 May 2007, 15:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rob.rice



Joined: 20 Dec 2003
Posts: 54
rob.rice 07 Dec 2007, 02:55
Post 07 Dec 2007, 02:55
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 14 Feb 2008, 18:00
wanna ask,
is that possible to use the following way to have a linux with a prompt only.

1. download the kernel,
http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.2.tar.bz2

2. put a lilo/grub

3. get a prompt (nothign will function, eg. ls cat etc...) just a prompt to reprint what i type.

4. then i put fasm inside then i can start programming in linux using fasm?

any idea. (call me weird, but i think the above ways will make me understand how linux works)
Post 14 Feb 2008, 18:00
View user's profile Send private message Reply with quote
nocona



Joined: 04 Aug 2007
Posts: 35
nocona 17 Feb 2008, 06:25
if you want to start from scratch, you need existing linux installation or linux livecd. you can visit www.linuxfromscratch.org to see how they do it. you can use existing installation of linux distro - recompile kernel and don't compile any drivers you need as modules, integrate it into kernel. delete everything except your kernel and grub files plus any userspace program/libraries you need. in order to get a prompt you need a shell (e.g bash), but you can actually start anything in place of init as the first userspace program executed by kernel. Just make sure you append "init=<your binary path>" to the kernel command line, e.g init=/bin/bash. put fasm and your favorite editor and you're done.
Post 17 Feb 2008, 06:25
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 17 Feb 2008, 17:40
thanks for the info nocona, so i need a chicken to produce the first egg ;P
Post 17 Feb 2008, 17:40
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 02 May 2008, 12:35
still without any progress on my site... damn, why am i so stupid and smart.... damn it.
Post 02 May 2008, 12:35
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 18 Jul 2008, 22:55
since i am on holiday (sort of),
yeah, with a laptop, hardly holiday...

http://forums.debian.net/viewtopic.php?t=28875

still trying to figure out... but a little bit progress already Wink
Post 18 Jul 2008, 22:55
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 19 Jul 2008, 11:03
yeah, finally i got what i want Wink
it took me several hours to google here and there, damn, this is simple after i figure it out.

below are the steps that i use.

assumptions:
------------
1. you already got a linux OS running (i use debian)
2. i run it inside vmware, using xp as host.
3. sda is first hard disk with debian installed.
4. sdb is second hard disk to be experiment with mini debian + bash only.
5. after you remove the sda, the sdb would become sda. *(remember)

steps:
------
1. fdisk the new drive sdb (i use 1 GB)
2. create bootable partition (to be use as /boot) /dev/sdb1
3. create swap (i haven't figure out how to use it yet) /dev/sdb2
4. create root partition /dev/sdb3
5. i set them all as primary partition.
6. mkfs -t ext3 /dev/sdb1 and /sdb3 then mkswap /dev/sdb2
7. mkdir /mnt/root
7. mkdir /mnt/boot
8. mount /dev/sdb1 /mnt/boot
8. mount /dev/sdb3 /mnt/root
7. mkdir /mnt/boot/grub
7. mkdir /mnt/root/bin
7. mkdir /mnt/root/dev
9. cp /boot/vmlinuz-2.6.18-6-686 /mnt/boot
9. cp /boot/initrd.img-2.6.18-6-686 /mnt/boot/
11. cp /usr/lib/grub/i386-pc/stage1 /mnt/boot/grub/
12. cp /usr/lib/grub/i386-pc/stage2 /mnt/boot/grub/
13. cp /usr/lib/grub/i386-pc/e2fs_stage1_5 /mnt/boot/grub
14. download the bash source that you want to compile, if you use debian, make sure you run the aptitude install build-essential if you haven't 'make' before.
15. put the source gz in /usr/src extract it and you got /usr/src/bash-3.2, cd into it.
16. export CC="gcc -march=i686"
17. ./configure \
--enable-minimal-config \
--enable-static-link \
--host=i686-pc-linux-gnu \
--exec-prefix=/ \
--without-bash-malloc
18. make
19. ./bash --version (so that you could see the baby bash that just born)
20. cp bash /mnt/root/bin
20. mknod /mnt/root/dev/console c 5 1
21. umount /dev/sdb1 and /dev/sdb3
22. sudo grub
> root (hd1,0)
> setup (hd1)
> quit
23. shutdown and remove the 1 hard disk (the one that installed with debian)
24. you will come to GRUB >
> root (hd0,0)
> kernel /vmlinuz-2.6.18-6-686 root=/dev/sda3 init=/bin/bash
> initrd /initrd.img-2.6.18-6-686
> boot
25. eventually, you will come to a bash prompt. no ls, no mount and etc. just a bash prompt.

yeah, i got it, a bash prompt Smile
i am quite interested with the initrd now Wink maybe to learn making my own one soon.


the lesson
----------
i could have save some minutes if i first build the bash static, then try it from the installed Debian GRUB to boot it, instead of shutdown, remove the hd

to proceed with auto boot, a menu.lst is required to be located in /boot/grub/menu.lst
Post 19 Jul 2008, 11:03
View user's profile Send private message Reply with quote
Rahsennor



Joined: 07 Jul 2007
Posts: 61
Rahsennor 30 Jul 2008, 11:20
Thanks for posting the list, it saved me a lot of searching. Very Happy

Why not replace bash with Busybox?
Post 30 Jul 2008, 11:20
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 31 Jul 2008, 18:14
hi there,
Quote:

Why not replace bash with Busybox?

yeah, waiting for holiday to figure that out.
Post 31 Jul 2008, 18:14
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12795
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 06 Aug 2008, 17:03
Quote:

Why not replace bash with Busybox?

k, wanna do this tonite Smile hopefully i would come up with something and way of doing things.
Post 06 Aug 2008, 17:03
View user's profile Send private message Reply with quote
Lightning Stalker



Joined: 14 Aug 2008
Posts: 14
Lightning Stalker 21 Aug 2008, 07:04
    It's pretty easy. You just download the source, read the README and that tells you how to compile it. You'll need the Debian again to compile it. Then you run busybox with the switch that tells it to make the links (I can't remember the switch offhand). It makes ls, chmod, etc which just link back to busybox. So when you run say wc, the link runs busybox as wc so it acts like wc.
Post 21 Aug 2008, 07:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.