public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: "Pali Rohár" <pali.rohar@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/boot: This program cannot be run in DOS mode.$
Date: Thu, 18 Apr 2019 13:27:21 +0200	[thread overview]
Message-ID: <20190418112721.GA9248@gmail.com> (raw)
In-Reply-To: <20190408212506.GA6428@amd>


* Pavel Machek <pavel@ucw.cz> wrote:

> On Mon 2019-04-08 20:08:09, Pali Rohár wrote:
> > On Monday 08 April 2019 20:04:22 Pavel Machek wrote:
> > > On Mon 2019-04-01 12:24:34, Pali Rohár wrote:
> > > > Every EFI binary is in PE format. And we know that PE format needs to have
> > > > MZ MS-DOS header as there is written offset to PE header.
> > > > 
> > > > Therefore generated bzImage binary with CONFIG_EFI_STUB option is MS-DOS
> > > > executable binary.
> > > > 
> > > > We already know the "requirement" that Windows PE executable started in
> > > > MS-DOS must print legendary and famous message to computer screen:
> > > > "This program cannot be run in DOS mode."
> > > > 
> > > > But trying to run that bzImage of Linux kernel with MZ header just cause
> > > > freezing whole MS-DOS instead of writing "the correct message" to user.
> > > > This is not the compliant behavior of PE executables!
> > > > 
> > > > This patch fixes this problem. When Linux kernel compiled with
> > > > CONFIG_EFI_STUB is started in MS-DOS then it prints message:
> > > > 
> > > >   This program cannot be run in DOS mode.
> > > >   To load Linux kernel from DOS mode use LOADLIN.EXE.
> > > > 
> > > > So it also helps MS-DOS users how to "correctly" start this bzImage binary
> > > > by mentioning LOADLIN.EXE. Note that MS-DOS strings are not null-terminated
> > > > but rather dollar-terminated.
> > > > 
> > > > To have error message unified bugger_off_msg for BIOS boot block code was
> > > > changed to:
> > > > 
> > > >   This program cannot be run in BIOS mode.
> > > > 
> > > > So if you copy generated bzImage directly to boot sector and try to boot it
> > > > by BIOS you get this new updated message.
> > > > 
> > > > Due to fixed offset of setup header (0x1f1), PE header was moved after
> > > > entrytext section. bstext and bsdata sections where is full MZ header and
> > > > MS-DOS code is now bigger.
> > > 
> > > Hehe, I guess the patch may have been dropped due to april's fools?
> > 
> > Yea, it was mean as first April patch :-) I tested it with MS-DOS 7.0
> > and DOSBox and it worked.
> > 
> > > You may want to retransmit?
> > 
> > Do you really think it can be useful? :-)
> 
> Dunno. It is quite simple, and quite a nice hack ;-).

Agreed, looks simple enough, no objections from me! :)

	Ingo


      reply	other threads:[~2019-04-18 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 10:24 [PATCH] x86/boot: This program cannot be run in DOS mode.$ Pali Rohár
2019-04-08 18:04 ` Pavel Machek
2019-04-08 18:08   ` Pali Rohár
2019-04-08 21:25     ` Pavel Machek
2019-04-18 11:27       ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190418112721.GA9248@gmail.com \
    --to=mingo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox