creating images under linux

Programming, for all ages and all languages.
Post Reply
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

creating images under linux

Post by yemista »

Hello, I was wondering what tools and methods people use to create images of their OSes under linux. I want to create an image that consists of bootsector and my kernel all located linearly on a floppy disk. I dont want a filesystem, I want the bootloader to be first sector and the remaining sectors to be the kernel. I dont have a floppy drive, and am working with data images created from bochs bximage. Any ideas?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: creating images under linux

Post by Solar »

Searching for "images" on the Wiki turned up the page Disk Images which sums it up nicely.

Personally, I used 'dd' and the loopback device for the job.
Every good solution is obvious once you've found it.
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: creating images under linux

Post by yemista »

I am using dd now as well, but I dont know how to use it too well. The problem is, if you have boot.bin and kernel.bin, and use dd on the same image, kernel.bin will overwrite boot.bin. Is there anyway to have dd start copying starting on the second sector?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: creating images under linux

Post by Solar »

$man dd

Code: Select all

DD(1)                            User Commands                           DD(1)

NAME
       dd - convert and copy a file

SYNOPSIS
       dd [OPERAND]...
       dd OPTION

DESCRIPTION
       Copy a file, converting and formatting according to the operands.

       bs=BYTES
              force ibs=BYTES and obs=BYTES

       cbs=BYTES
              convert BYTES bytes at a time

       conv=CONVS
              convert the file as per the comma separated symbol list

       count=BLOCKS
              copy only BLOCKS input blocks

       ibs=BYTES
              read BYTES bytes at a time

       if=FILE
              read from FILE instead of stdin

       iflag=FLAGS
              read as per the comma separated symbol list

       obs=BYTES
              write BYTES bytes at a time

       of=FILE
              write to FILE instead of stdout

       oflag=FLAGS
              write as per the comma separated symbol list

       seek=BLOCKS
              skip BLOCKS obs-sized blocks at start of output

       skip=BLOCKS
              skip BLOCKS ibs-sized blocks at start of input

       status=noxfer
              suppress transfer statistics

       BLOCKS  and BYTES may be followed by the following multiplicative suffixes: xM M, c 1, w 2, b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and
       so on for T, P, E, Z, Y.
Note the 'seek' option.
Every good solution is obvious once you've found it.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: creating images under linux

Post by DeletedAccount »

you can use qemu-img , if you use qemu ........


Regards
Shrek
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: creating images under linux

Post by JohnnyTheDon »

Also, if you are copying onto an image with an existing filesystem that you want to preserve, you may want to use conv=notrunc. If you don't anything past the blocks you wrote gets deleted.
Post Reply