delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/13/19:29:46

X-Spam-Check-By: sourceware.org
Message-ID: <45590DE6.4040106@tiscali.it>
Date: Tue, 14 Nov 2006 01:29:26 +0100
From: "Salvatore D'Angelo" <koala DOT gnu AT tiscali DOT it>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: ld: cannot perform PE operations on non PE output file 'bootsect'.
X-Scanned: with antispam and antivirus automated system at libero.it
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------070801090202040501070403
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

I have a problem compiling the bootsect.S file above using the Makefile. 
Basically the project create a boot sector on floppy that print "Hello 
World" at compuer boot.
On Linux it works fine but in cygwin I go the following link problem:

*ld: cannot perform PE operations on non PE output file 'bootsect'.

*In the cygwin mail archive I saw question like this without response 
please can someone suggest me what is wrong in my Makefile and what I 
have to change?
To build the project do the following steps:

1. download the two file in a directory <dir>
2. in cygwin move to this directory
3. type make

In linux the final file bootsect should have a size of 512 bytes. Using 
the command

make disk

you can copy it on a floppy making it bootable.

PS
I am not subscribed to this mail list so, please, put my address in cc
Thanks in advance for your help.

--------------070801090202040501070403
Content-Type: text/plain;
 name="Makefile"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Makefile"

AS=as
LD=ld

all: bootsect

bootsect: bootsect.o
	@echo "[LD] $@"
	@$(LD) -Ttext 0x0 -s --oformat binary -o $@ $<

bootsect.o: bootsect.S
	@echo "[AS] $@"
	@$(AS) -o $@ $<

disk: image
	@echo "[DISK]"
	@dd if=image of=/dev/fd0 bs=512

image: bootsect
	@echo "[KERNEL IMAGE]"
	@cat bootsect > image

clean:
	@echo [CLEAN]
	@rm -rf *.o image bootsect

--------------070801090202040501070403
Content-Type: text/plain;
 name="bootsect.S"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bootsect.S"

.code16
.text

.global _start

_start:
    movb $0xE, %ah              # Function 0x0E of Interrupt 0x10
    movb $'H', %al              # write 'H'
    int  $0x10
    movb $'e', %al              # write 'e'
    int  $0x10
    movb $'l', %al              # write 'l'
    int  $0x10
    movb $'l', %al              # write 'l'
    int  $0x10
    movb $'o', %al              # write 'o'
    int  $0x10
    movb $' ', %al              # write ' '
    int  $0x10
    movb $'W', %al              # write 'W'
    int  $0x10
    movb $'o', %al              # write 'o'
    int  $0x10
    movb $'r', %al              # write 'r'
    int  $0x10
    movb $'l', %al              # write 'l'
    int  $0x10
    movb $'d', %al              # write 'd'
    int  $0x10
    movb $'!', %al              # write '!'
    int  $0x10
    movb $'!', %al              # write '!'
    int  $0x10
    movb $'!', %al              # write '!'
    int  $0x10
    ret

.org 510# Last 2 bytes of the boot sector.

boot_flag:		.word 0xAA55	# Flag indicating a boot disk


--------------070801090202040501070403
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--------------070801090202040501070403--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019