LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 04-30-2016, 07:53 AM   #1
bala2117
LQ Newbie
 
Registered: Apr 2016
Posts: 1

Rep: Reputation: Disabled
How to run my own hello_world application on top of Linux kernel and how to convert my Kernel images into bootable image


I have compiled Linux kernel 4.5.2 for x86_64 machine and i got below set of files in /boot.
vmlinuz-4.5.2
System.map-4.5.2
config-4.5.2
initrdz-ramfs.img-4.5.2
bzImage
lib (directory)

Requirement:
===========
1. Where i need specify my own hello_world application?

2. How to convert compiled kernel images with application into bootable image (like USB bootable image). Also what are the files required among the above all to make it bootable image and how to do?

3. Then i need to boot my x86_64 machine through USB boot it should launch my hello_world application.

Kindly help me out with step by step procedure because I am not getting any clue.
 
Old 04-30-2016, 08:59 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
To just run your program, you can add an init job for it so that it runs when the system starts up. If you are trying to make it the only thing that runs on the box, then it is a little more complex.

A bootable system has 3 pieces:

1) Bootloader - after the platform firmware runs it starts the bootloader. Usually, you would use a standard bootloader like grub or grub2. The bootloader can have a menu to let you either boot your standard system or your test system.
2) Kernel - The kernel starts up and initializes drivers and then starts up a user space init program.
3) User space - Normally your user space is on disk, has shell, desktop and services and is mounted by a stock ramdisk image. In your case, if you just want to run one standalone program, you can do it all in the ramdisk. There are plenty of tutorials on the web on modifying it, like this one:

http://backreference.org/2010/07/04/...itramfs-files/

You would have to add your program, plus any libraries that it needs into the ramdisk image, and start it from the init script. For extra credit you can make it the init program so no script is needed, but I can't fit a proof of that in this margin.
 
  


Reply



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
Create bootable disk image with linux kernel anjohn Linux - General 3 08-16-2013 05:36 AM
bootable kernel image creation aloktiagi Linux - Newbie 1 05-20-2010 10:17 PM
how to create a kernel bootable image aloktiagi Linux - Newbie 1 04-23-2010 07:15 AM
compiling same kernel with 2 different bootable images b123coder Linux - Software 1 11-19-2004 10:39 AM
Kernel image for syslinux bootable floppy??? the_rydster Linux - General 1 02-22-2004 01:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:41 PM.

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
Open Source Consulting | Domain Registration