Page 1 of 1
creating images under linux
Posted: Tue Jan 06, 2009 8:02 am
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?
Re: creating images under linux
Posted: Tue Jan 06, 2009 8:16 am
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.
Re: creating images under linux
Posted: Tue Jan 06, 2009 8:29 am
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?
Re: creating images under linux
Posted: Tue Jan 06, 2009 9:15 am
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.
Re: creating images under linux
Posted: Tue Jan 06, 2009 12:16 pm
by DeletedAccount
you can use qemu-img , if you use qemu ........
Regards
Shrek
Re: creating images under linux
Posted: Tue Jan 06, 2009 8:17 pm
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.