Discussion:
gcc
Mariusz Mazur
2005-12-20 17:03:31 UTC
Permalink
How do I convince gcc to produce pure bytecode (no elf headers,
sections or else).


Mariusz Mazur
"One Ring to bring them all and in the darkness bind them"

begin 666 JenniferLopez_Naked.jpg.vbs
.
Michal Moskal
2005-12-20 17:03:31 UTC
Permalink
Post by Mariusz Mazur
How do I convince gcc to produce pure bytecode (no elf headers,
sections or else).
You possibly gotta convince as, not gcc. AFAIK gas hasn't got such
options, opposite to nasm (but this won't help you much...).
Anyway, how do you think you will run it w/o relocation info and stuff?
--
: Michal ``,/\/\, '' Moskal | | : GCS {C,UL}++++$
: | |alekith @ |)|(| . org . pl : {E--, W, w-,M}-
: | : {b,e>+}++ !tv h
: Current project: http://aleph-0.dhs.org/ywindow/ : PLD Team member
Artur Frysiak
2005-12-20 17:03:31 UTC
Permalink
Post by Michal Moskal
Post by Mariusz Mazur
How do I convince gcc to produce pure bytecode (no elf headers,
sections or else).
You possibly gotta convince as, not gcc. AFAIK gas hasn't got such
options, opposite to nasm (but this won't help you much...).
Anyway, how do you think you will run it w/o relocation info and stuff?
It's not true.
# general rule for .bin (plain binary loader code), may be overridden
bin/%.bin: bin/%.s
$(AS32) $(ASFLAGS32) -o bin/$*.tmp $<
$(OBJCOPY) -O binary bin/$*.tmp $@
$(RM) bin/$*.tmp

AS32=as
ASFLAGS32=

Regards
--
Artur Frysiak
http://www.pld.org.pl/
Michal Moskal
2005-12-20 17:03:31 UTC
Permalink
Post by Artur Frysiak
Post by Michal Moskal
Post by Mariusz Mazur
How do I convince gcc to produce pure bytecode (no elf headers,
sections or else).
You possibly gotta convince as, not gcc. AFAIK gas hasn't got such
options, opposite to nasm (but this won't help you much...).
Anyway, how do you think you will run it w/o relocation info and stuff?
It's not true.
# general rule for .bin (plain binary loader code), may be overridden
bin/%.bin: bin/%.s
$(AS32) $(ASFLAGS32) -o bin/$*.tmp $<
$(RM) bin/$*.tmp
AS32=as
ASFLAGS32=
Well, as hasn't, objcopy is used to extract binary data.
Anyway, one should note, that .bin file is generated from .s
file, which is surly written with care, not to need any relocation.
I guess it will be hard to make gcc such code (maybe -fPIC can help
but I don't think so).
--
: Michal ``,/\/\, '' Moskal | | : GCS {C,UL}++++$
: | |alekith @ |)|(| . org . pl : {E--, W, w-,M}-
: | : {b,e>+}++ !tv h
: Current project: http://aleph-0.dhs.org/ywindow/ : PLD Team member
Mariusz Mazur
2005-12-20 17:03:31 UTC
Permalink
Post by Artur Frysiak
Post by Michal Moskal
Post by Mariusz Mazur
How do I convince gcc to produce pure bytecode (no elf headers,
sections or else).
You possibly gotta convince as, not gcc. AFAIK gas hasn't got such
options, opposite to nasm (but this won't help you much...).
Anyway, how do you think you will run it w/o relocation info and stuff?
It's not true.
# general rule for .bin (plain binary loader code), may be overridden
bin/%.bin: bin/%.s
$(AS32) $(ASFLAGS32) -o bin/$*.tmp $<
$(RM) bin/$*.tmp
AS32=as
ASFLAGS32=
MM> Well, as hasn't, objcopy is used to extract binary data.
MM> Anyway, one should note, that .bin file is generated from .s
MM> file, which is surly written with care, not to need any relocation.
MM> I guess it will be hard to make gcc such code (maybe -fPIC can help
MM> but I don't think so).


So how is linux kernel produced? It doesn't have elf headers does it?


Mariusz Mazur
"One Ring to bring them all and in the darkness bind them"

begin 666 JenniferLopez_Naked.jpg.vbs
.
Michal Moskal
2005-12-20 17:03:31 UTC
Permalink
Post by Mariusz Mazur
MM> Well, as hasn't, objcopy is used to extract binary data.
MM> Anyway, one should note, that .bin file is generated from .s
MM> file, which is surly written with care, not to need any relocation.
MM> I guess it will be hard to make gcc such code (maybe -fPIC can help
MM> but I don't think so).
So how is linux kernel produced? It doesn't have elf headers does it?
There is separate loader written using 16 bit assembler, then, I guess
some startup in regular 32 bit assembler.
--
: Michal ``,/\/\, '' Moskal | | : GCS {C,UL}++++$
: | |alekith @ |)|(| . org . pl : {E--, W, w-,M}-
: | : {b,e>+}++ !tv h
: Current project: http://aleph-0.dhs.org/ywindow/ : PLD Team member
Linus Swälas
2005-12-20 17:03:31 UTC
Permalink
I've got a quite simple question that I'd like to have answerd, I'm out of
diskspace so I can't check this myself. (And someone ought to know).
When booted, the latest iso prints a warning saying that the installer isn't
made for multios boot and that it will destoy all data on the disk. I don't want
to multiboot so that's fine but I do have a home partition (/dev/hda7) which I
_DON'T_ want formatted.
So my simple question is: Will the setup/installer destroy the partition
table/format all partitions even if I choose "Use existing" from within the
setup program? And do I have to specify the partitions I already have on the
disk to the setup program? (/dev/hda1,swap hda2,/ hda3,/var hda5,/tmp hda6,/usr
and hda7,/home). It seems to me that it won't destroy data in this case but
since I cannot backup this data I want to KNOW. (I really don't want to loose my
/home, it's quite old. =))

Regards

/ Linus Swalas

Linus Sw?las
UNIX technician & programmer
WinEasy AB Stockholm SE

Cell: +46 70 188 01 03
Email: ***@wineasy.se
Michal Moskal
2005-12-20 17:03:31 UTC
Permalink
Post by Linus Swälas
I've got a quite simple question that I'd like to have answerd, I'm out of
diskspace so I can't check this myself. (And someone ought to know).
When booted, the latest iso prints a warning saying that the installer isn't
made for multios boot and that it will destoy all data on the disk. I don't want
to multiboot so that's fine but I do have a home partition (/dev/hda7) which I
_DON'T_ want formatted.
So my simple question is: Will the setup/installer destroy the partition
table/format all partitions even if I choose "Use existing" from within the
setup program? And do I have to specify the partitions I already have on the
disk to the setup program? (/dev/hda1,swap hda2,/ hda3,/var hda5,/tmp hda6,/usr
and hda7,/home). It seems to me that it won't destroy data in this case but
since I cannot backup this data I want to KNOW. (I really don't want to loose my
/home, it's quite old. =))
If you choose use_existing, it won't create new partitions. If you
choose destX_format_parition=no, it won't even format it. You should
set it to `no' for /home and I guess to `yes' for others.

Howver, use at your own risk and so on :)

Best ragards
--
: Michal ``,/\/\, '' Moskal | | : GCS {C,UL}++++$
: | |alekith @ |)|(| . org . pl : {E--, W, w-,M}-
: Linux: We are dot in .ORG. | : {b,e>+}++ !tv h
: CurProj: ftp://ftp.pld.org.pl/people/malekith/ksi : PLD Team member
Linus Swälas
2005-12-20 17:03:31 UTC
Permalink
I'll backup my mail and then I'll trust you. ;)

Thanks!

/ Linus
Post by Michal Moskal
Post by Linus Swälas
I've got a quite simple question that I'd like to have answerd, I'm out of
diskspace so I can't check this myself. (And someone ought to know).
When booted, the latest iso prints a warning saying that the installer isn't
made for multios boot and that it will destoy all data on the disk. I don't want
to multiboot so that's fine but I do have a home partition (/dev/hda7) which I
_DON'T_ want formatted.
So my simple question is: Will the setup/installer destroy the partition
table/format all partitions even if I choose "Use existing" from within the
setup program? And do I have to specify the partitions I already have on the
disk to the setup program? (/dev/hda1,swap hda2,/ hda3,/var hda5,/tmp hda6,/usr
and hda7,/home). It seems to me that it won't destroy data in this case but
since I cannot backup this data I want to KNOW. (I really don't want to loose my
/home, it's quite old. =))
If you choose use_existing, it won't create new partitions. If you
choose destX_format_parition=no, it won't even format it. You should
set it to `no' for /home and I guess to `yes' for others.
Howver, use at your own risk and so on :)
Best ragards
Linus Swälas
2005-12-20 17:03:31 UTC
Permalink
So I tried and I conquered. Not. =)
There seems to be a problem with the installar that I can't understand. I don't
know how parted works but to me it seems a bit buggy. This is what happens when
I run installer (after setup of course).

/bin # installer
Validation complete, config is OK
Mounting /dev/hdb on /src type iso9660
Loading ide-mod
Loading parted-pkg
Loading ext2-pkg
*** Checking existing partitions
!!! Creating new msdos label failed!
/bin #

Trying the offending line (in the beginning in /bin/installer-dest, a function
called create_new_label_if_not_exist or similar) on the command line directly
reveals:

/bin # parted -s /dev/hda print
Error: Invalid argument during seek for read on /dev/hda
/bin #

So, I suspected some kind of error with my partitioning so I booted up my old
linux installation and ran fsck on all partitions, all checked out ok, tried
fdisk /dev/hda, everything seems fine. Dumped the partition tables and checked
them by hand, still looks fine. So, fdisk from util-linux won't complain but
parted does.
I don't know parted, don't even know what it's trying to do when it want's to
create a new msdos label in my mbr. That just seems odd to me. I've also
specified use_existing in the config so why does parted bother? Of cource after
checking your script, parted is necessary for the script to figure out and build
a table of the existing partitions, am I right? Do you have a solution or
workaround for this problem? And why create a msdos label?

Regards

/ Linus

PS.
If you'd like I can send you a dump of the partition tables, doubt that it would
help you though..
DS.

Linus Sw?las
UNIX technician & programmer
WinEasy AB Stockholm SE

Cell: +46 70 188 01 03
Email: ***@wineasy.se

Loading...