是否可以关闭linux内核并以实模式恢复? [英] Is it possible to shutdown linux kernel and resume in Real Mode?

查看:82
本文介绍了是否可以关闭linux内核并以实模式恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想在普通操作系统启动之前启动一个小型Linux发行版.

Let's say I'd like to start a small linux distro before my ordinary operating system start.

  1. BIOS加载MBR并执行MBR.
  2. MBR找到活动分区,这是我的linux分区.
  3. 启动Linux,然后执行所需的操作.
  4. Linux关闭,我再次切换到实模式.
  5. 原始分区引导扇区已加载,我的普通操作系统也已启动.

AFAIK,第4步将是一项艰巨的任务,要在linux之前的所有设备上恢复状态,INT13h会起作用吗?我需要还原中断向量表吗?仅举几例.

AFAIK, step 4 will be the difficult task, restore the state on all devices prior to linux, will INT13h be functional? Do I need to restore the Interrupt Vector Table? To mention a few.

这可能已经在任何现有项目中完成了吗?

Has this been done in any existing project perhaps?

推荐答案

Linux通常不支持此功能,特别是因为它以BIOS和DOS程序可能无法期望的方式重新初始化硬件.但是,在某些情况下,有一些基础架构可以切换回实模式-特别是对于重新引导(请参阅arch/x86/kernel/reboot.c中的machine_real_restart)-并且具有用于为kexec或挂起重新初始化硬件的代码.我怀疑您可以结合使用这些功能来做某事-但我不知道结果是否真的与DOS或Windows重新启动时所期望的相符.

Linux does not normally support this, particularly since it reinitializes hardware in a way that the BIOS and DOS programs may not expect. However, there is some infrastructure to switch back to real mode in specific cases - particularly, for a reboot (see machine_real_restart in arch/x86/kernel/reboot.c) - and has code to reinitialize hardware for kexec or suspend. I suspect you might be able to do something with a combination of these - but I don't know if the result will truly match what DOS or Windows would expect to see on reboot.

一个更容易的计划是使用可设置为一次在特定配置中引导的链加载引导加载程序,例如

A much easier plan would be to use a chainloading bootloader that can be set to boot in a particular configuration once, like GRUB. You could invoke grub-set-default, then reboot. When GRUB comes up, it would then pass control off to Windows. By then setting the fallback OS to the Linux partition, control would return to Linux on the next boot.

另一种选择可能是使用 Coreboot ,但是我不确定这是否是正式版本-已准备好启动Windows.

Yet another option may be to use Coreboot, but I'm not sure if this is production-ready for booting windows yet.

这篇关于是否可以关闭linux内核并以实模式恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆