Difference between revisions of "Whichsys.c32"

From Syslinux Wiki
Jump to: navigation, search
m (Examples: More alternatives and additional examples)
(Correction: "-ext-" is not an option, use "-sys-". Minor rewording. Wiki formatting.)
Line 2: Line 2:
 
[[Category:Modules]]
 
[[Category:Modules]]
  
= About =
+
'''whichsys.c32''' is a COM32 module for Syslinux that selects which command to execute, based on the Syslinux bootloader variant from which it is run.
'''whichsys.c32''' is a COM32 module for Syslinux that determines which command to execute, based on the Syslinux bootloader variant from which it is run.
+
  
It is only available in Syslinux 4.02 or later.
+
It is available in Syslinux 4.02 or later.
  
= Usage =
+
== Usage ==
<pre>Usage:    whichsys.c32 [-iso- command] [-pxe- command] [-sys- command]</pre>
+
{|
 +
|
 +
whichsys.c32 [-iso- ''command''] [-pxe- ''command''] [-sys- ''command'']
 +
|}
  
= Examples =
+
== Examples ==
Boot the first hard disk when booted from ISOLINUX, boot the second hard disk (internal hard disk when your USB drive is detected as hard disk 1 by the BIOS) and swap drive numbers when booted from SYSLINUX:
+
<pre>
+
whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
+
</pre>
+
<pre>
+
COM32 whichsys.c32
+
APPEND -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
+
</pre>
+
<pre>
+
COM32 whichsys.c32
+
APPEND -iso- localboot.c32 -1 -sys- chain.c32 hd1 swap
+
</pre>
+
  
Load a specifc config file for each bootloader:
+
* Using additional COM32 modules:
<pre>
+
{| class="wikitable"
whichsys.c32 -iso- config iso.cfg -sys- config sys.cfg -pxe- config pxe.cfg
+
! When booted from
</pre>
+
! Execute this action
<pre>
+
|-
COM32 whichsys.c32
+
| ISOLINUX
APPEND -sys- config.c32 sys.cfg -iso- config.c32 iso.cfg
+
| Boot the first hard disk
</pre>
+
|-
<pre>
+
| SYSLINUX
COM32 whichsys.c32
+
| Boot the second hard disk  <!--
APPEND -ext- COM32 config.c32 <path/to/>ext.cfg -iso- COM32 config.c32 <path/to/>iso.cfg
+
-->(that is, the internal hard disk  <!--
</pre>
+
-->when your USB drive is detected as hard disk 1 by the BIOS) and <!--
 +
-->swap drive numbers
 +
|}
 +
{|
 +
|
 +
whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
 +
|}
 +
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
 +
|}
 +
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -iso- localboot.c32 -1 -sys- chain.c32 hd1 swap
 +
|}
 +
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -iso- LOCALBOOT -1 -sys- chain.c32 hd1 swap
 +
|}
  
Load a specifc LABEL entry (from the same config file) for each bootloader:
+
See also [[Config#LOCALBOOT]] and [[chain.c32]].
<pre>
+
 
COM32 whichsys.c32
+
 
APPEND -sys- label4sys -iso- label4iso
+
* Load a specifc config file for each bootloader:
</pre>
+
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -iso- CONFIG iso.cfg -sys- CONFIG sys.cfg -pxe- CONFIG pxe.cfg
 +
|}
 +
{|
 +
|
 +
whichsys.c32 -sys- config.c32 sys.cfg -iso- config.c32 iso.cfg
 +
|}
 +
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -sys- COM32 config.c32 <path/to/>sys.cfg -iso- COM32 config.c32 <path/to/>iso.cfg
 +
|}
 +
 
 +
* Load a specifc LABEL entry (from the same config file) for each bootloader:
 +
{|
 +
|
 +
COM32 whichsys.c32
 +
APPEND -sys- label4sys -iso- label4iso
 +
|}
 
where "label4sys" and "label4iso" are additional LABEL entries in the same "cfg" file as the whichsys.c32 statement.
 
where "label4sys" and "label4iso" are additional LABEL entries in the same "cfg" file as the whichsys.c32 statement.

Revision as of 20:41, 14 December 2018


whichsys.c32 is a COM32 module for Syslinux that selects which command to execute, based on the Syslinux bootloader variant from which it is run.

It is available in Syslinux 4.02 or later.

Usage

whichsys.c32 [-iso- command] [-pxe- command] [-sys- command]

Examples

  • Using additional COM32 modules:
When booted from Execute this action
ISOLINUX Boot the first hard disk
SYSLINUX Boot the second hard disk (that is, the internal hard disk when your USB drive is detected as hard disk 1 by the BIOS) and swap drive numbers
whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
COM32 whichsys.c32
APPEND -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap
COM32 whichsys.c32
APPEND -iso- localboot.c32 -1 -sys- chain.c32 hd1 swap 
COM32 whichsys.c32
APPEND -iso- LOCALBOOT -1 -sys- chain.c32 hd1 swap 

See also Config#LOCALBOOT and chain.c32.


  • Load a specifc config file for each bootloader:
COM32 whichsys.c32
APPEND -iso- CONFIG iso.cfg -sys- CONFIG sys.cfg -pxe- CONFIG pxe.cfg
whichsys.c32 -sys- config.c32 sys.cfg -iso- config.c32 iso.cfg
COM32 whichsys.c32
APPEND -sys- COM32 config.c32 <path/to/>sys.cfg -iso- COM32 config.c32 <path/to/>iso.cfg
  • Load a specifc LABEL entry (from the same config file) for each bootloader:
COM32 whichsys.c32
APPEND -sys- label4sys -iso- label4iso

where "label4sys" and "label4iso" are additional LABEL entries in the same "cfg" file as the whichsys.c32 statement.