Author Topic: Hardwere switch for dual boot.  (Read 5615 times)

0 Members and 1 Guest are viewing this topic.

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6762
  • Country: fi
    • My home page and email address
Re: Hardwere switch for dual boot.
« Reply #25 on: October 22, 2020, 04:47:27 pm »
I really appreciate the criticism and advice, Ian.M!

So, here's the updated schematic:


Also, I sketched up a small board at EasyEda with pads for 0603, 0805, or through-hole 1/8 watt resistors, just to see what it'd look like in 2D and 3D.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13026
Re: Hardwere switch for dual boot.
« Reply #26 on: October 22, 2020, 07:53:56 pm »
Looks reasonable.  However depending on the OPTO's CTRR, and the PC serial port's actual thresholds, you may find you need more drive than you can get through a 680R resistor from a 3.3V logic level.  Also many MCUs have somewhat asymmetric I/O pin output drivers that sink better than they source, so consider bringing out all the OPTO-LED cathodes individually so you can choose to drive it with active low outputs.
« Last Edit: October 22, 2020, 08:09:54 pm by Ian.M »
 
The following users thanked this post: Nominal Animal

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6762
  • Country: fi
    • My home page and email address
Re: Hardwere switch for dual boot.
« Reply #27 on: October 23, 2020, 10:04:50 am »
Yes; the BOM does not contain the resistors, and in the description, I do mention using 470 Ohm resistors instead for 3.3V I/O (as ESP-07 uses, I just realized).  (On the RS-232 side, the status signal voltages are positive, high anything between 5V and 25V.)

The forward voltage of the ACPL-247 is 1.0-1.2 V, so 680 Ohm yields 5.6-5.9 mA on 5 V I/O, and 470 Ohm 4.5-4.9 mA on 3.3V.  The 5 mA driving current was a guess, based on the datasheet as it promises a minimum 100% CTR at 5V 5mA.  I suspect that 1 kOhm resistors would be fine (2mA driving current), and would definitely be preferred on the microcontroller side, but I don't see how to check if it would work in practice, other than testing.

I never even thought about using the I/O pins to sink instead of sourcing current – no real-world experience! – but now that you mentioned it, it makes a lot of sense.  If I recall correctly, DCE is inverted in the PC status port, so one has to deal with inversion anyway (which is just one XOR mask on the desired "status number" to pass to Grub).  I think I'll create a second version of the schematic and board, this time with 0603/0805 resistors only, and think a bit harder on the hand-solderability.

Again, your comments have been invaluable, Ian.M; thanks! ^-^
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6762
  • Country: fi
    • My home page and email address
Re: Hardwere switch for dual boot.
« Reply #28 on: October 23, 2020, 04:53:03 pm »
Okay, here is the updated schematic, board, and 3D views.  It's 1" by 0.8" or 25mm by 20mm, with three 2.1mm holes for fastening (16mm and 21mm between hole centers).





The resistor pads work for both 0603 and 0805 resistors, and the pads are larger than normal to make soldering them easier.  There is an additional through hole pad on the BAT54C diode output, in case there is just one supply on the output side so that one can omit the BAT54C.  Alternatively, if the output side is e.g. a microcontroller, one can tap off the BAT54C output to MCU power, and connect more than one supply to the BAT54C inputs.  Instead of marking resistor values, I labeled them RLIM (for the 470 Ohm current-limiting resistors) and RPULLDN for the pull-down resistors.
As of 2020-10-23, the components are supported by JLCPCB's SMT assembly service, but I tried to make it easy to solder.

The schematic and board files are in public domain here.
« Last Edit: October 23, 2020, 04:56:16 pm by Nominal Animal »
 

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: Hardwere switch for dual boot.
« Reply #29 on: October 23, 2020, 09:36:41 pm »
Wait, does the board have a physical RS-232 serial port, with an 8250/16550 compatible UART, on the motherboard?

If it does, then you indeed can just use one of the status pins on that port, if you make sure the Grub iorw module (iorw.mod) is enabled.  Then,
    inb -v MCE 0x3FE        (for first serial port)
    inb -v MCE 0x2EE        (for second serial port)
    inb -v MCE 0x2FE        (for third serial port)
    inb -v MCE 0x3EE        (for fourth serial port)
saves the port status pin states in Grub variable MCE, in hexadecimal, without a leading 0x.  The four low bits should be zero.  The high four bits correspond to CTS (bit 4), DSR (bit 5), RI (bit 6), and DCD (bit 7).  On an 9-pin serial connector, CTS is pin 8, DSR is pin 6, RI is pin 9, and DCD is pin 1; except that pin 1 and/or pin 9 may be connected to a positive supply voltage.

So, let's say you connect a SPDT switch, common to pin 8 on the 9-pin serial port connector, and the two options to pin 5 (signal ground) and pin 1 or 9, whichever has a positive voltage on it.  In your Grub configuration file,
    serial --unit=0
    inb -v MCE 0x3FE
    set MCE=0x$MCE
    if [ $MCE -eq 16 -o $MCE -eq 48 -o $MCE -eq 80 -o $MCE -eq 112 -o $MCE -eq 144 -o $MCE -eq 176 -o $MCE -eq 204 -o $MCE -eq 240 ]; then
        set default=1
    else
        set default=0
    fi
and the default will be either the first or the second boot entry, depending on the position of the switch.

If you do the same for pin 6 as you did for pin 8 above, then
    serial --unit=0
    inb -v MCE 0x3FE
    set MCE=0x$MCE
    if [ $MCE -eq 16 -o $MCE -eq 80 -o $MCE -eq 144 -o $MCE -eq 208 ]; then
        set default=1
    elif [ $MCE -eq 32 -o $MCE -eq 96 -o $MCE -eq 160 -o $MCE -eq 224 ]; then
        set default=2
    elif [ $MCE -eq 48 -o $MCE -eq 112 -o $MCE -eq 176 -o $MCE -eq 240 ]; then
        set default=3
    else
        set default=0
    fi
gives you four possibilities.  Note that one switch could be for a "fast boot" to the selected OS, with no wait in Grub, and the other just selects the boot entry.

I got my windows and Linux up and running and with the use of keyboard i can select which OS I want to boot. Everything good so far.

First i tried to add the set default="2" at the beginning of the grub.cfg file(located in /boot/grub/grub.cfg) and it didn't select the windows as default.
After some more tries I added the line just after the 00_header END and it worked. It did select the windows as default and after the timeout it booted just fine. So far so good.

The problems started after. There is no voltage on the pin 1(DCD) or 9(RI) so I used 12V from the MB in series with a 470Ω resistor. Common pin from spdt to DB-9 pin 8(CTS), one pin from spdt to DB-9 pin 5(GND) and the other pin from spdt to one 470Ω resistor and then 12V.

As seen in the attached picture, i wrote the other lines of code and un-commented the single set default="2" line.
It doesn't work. I flipped the switch to any position and did some restarts with no change.

Did I load the iorw module at the right time? is there any may to debug this using some print commands?

Thanks again for all the support.

**EDIT: the "sudo ls /boot/grub/i386-pc/" command show the the iorw.mod file is there. I have ubuntu server 20.04
« Last Edit: October 23, 2020, 09:40:39 pm by georgian »
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2329
  • Country: 00
Re: Hardwere switch for dual boot.
« Reply #30 on: October 24, 2020, 12:22:18 am »
"I want to have a windows server and Linux saver to learn and play with. I don't plan to keep the server near my working PC"

Why not using windows WLS, you can have both running at the same time,
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6762
  • Country: fi
    • My home page and email address
Re: Hardwere switch for dual boot.
« Reply #31 on: October 24, 2020, 01:00:50 pm »
After some more tries I added the line just after the 00_header END and it worked. It did select the windows as default and after the timeout it booted just fine. So far so good.
Yes, you do need to examine the entire Grub startup script and see when default is set; it can also be set by a load_env command.  I recommend you get familiar with the Grub manual.

The problems started after. There is no voltage on the pin 1(DCD) or 9(RI) so I used 12V from the MB in series with a 470Ω resistor. Common pin from spdt to DB-9 pin 8(CTS), one pin from spdt to DB-9 pin 5(GND) and the other pin from spdt to one 470Ω resistor and then 12V.
Right; if you look at my post just before yours, you'll see a much better approach.  The idea is to use serial --unit N to initialize the serial port (but not used as an input if there is no corresponding terminal_input command); this causes RTS and DTR to go high, so they can be used as the positive supply voltage.

It doesn't work. I flipped the switch to any position and did some restarts with no change.
Right, we need a debugging print right about here.  That would be echo, as listed in the Grub manual. For example,
Code: [Select]
insmod iorw
serial --port=0x3F8
serial --port=0x2E8
serial --port=0x2F8
serial --port=0x3E8
sleep 1
inb -v com1 0x3FE
inb -v com2 0x2EE
inb -v com3 0x2FE
inb -v com4 0x3EE
echo "COM1=${com1} COM2=${com2} COM3=${com3} COM4=${com4}"
This will display the four COM port's status bytes, as obtained by inb.  I don't think the sleep is necessary, but it would be a good idea to verify it makes no difference.

Why not using windows WLS, you can have both running at the same time,
Because WSL is not Linux, it is a compatibility layer effort by Microsoft to stop developers from switching from Windows to Linux?  It is equivalent to using Wine on Linux.
Most things work, a lot of things do not.  Learning the native environment – both ways, mind you! – is better than learning just the compatibility layer and thinking its quirks are normal part of that OS.
« Last Edit: October 24, 2020, 01:03:19 pm by Nominal Animal »
 

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: Hardwere switch for dual boot.
« Reply #32 on: October 24, 2020, 05:12:40 pm »
I got it working!
Thank you for all your help and information so far.
Here is what I have added to the grub.cfg file
Code: [Select]
echo -e "Loading iorw.mod Module\n"
insmod iorw
serial --port=0x3F8
inb -v com1 0x3FE
echo -e "COM1 state: ${com1}\n"
inv -v com1 0x3FE
#There should one space between [ and $ otherwise grub throws command error and the if will be true!
#"-eq" means is equal -> in C "=="
#"-o" means or -> in C "||"
if [ $com1 -eq 10 -o $com1 -eq 11]; then
  echo -e "Switch is ON!\nCTS is HIGH, We should boot Windows now!\n"
  set default="2"
else
  echo -e "Switch is OFF!\nCTS is LOW, We should boot Ubuntu now!\n"
  set default="0"
fi
echo "Booting auto-selected OS"
sleep 3

The reason i have to check if port is 10 or 11 is because first time i read the port gives 11, sometimes other number and second time it gives the correct number. I have tried in the grub command line all 4 inputs (CTS, DSR, RI, DCD) and they all "work".
in grub command line i first type:
Code: [Select]
insmod iorw
serial --port=0x3F8
inb -v com1 0x3FE
echo -e "COM1 state: ${com1}\n"
everything is low, so i get a 0. I set CTS HIGH, all other LOW (with 10k pull-down)
Code: [Select]
inb -v com1 0x3FE
echo -e "COM1 state: ${com1}\n"
and ii get 11. No change on the switches, read the port again
Code: [Select]
inb -v com1 0x3FE
echo -e "COM1 state: ${com1}\n"
and ii get 10. No metter how many time i read the port i get 10. No set the CTS LOW and DSR HIGH. All other LOW. Again, read the port one and echo the result.
Code: [Select]
inb -v com1 0x3FE
echo -e "COM1 state: ${com1}\n"
I get 23. Read again and echo the result i get 20. Read again and still 20. DSR LOW and RI HIGH, all other LOW. Read port and echo the result i get 46. Read again and echo the result I get 40 and so on for all other pins.
Why do i have to read twice? must be something that i'm doing wrong.
Attached is a photo with the way i send the commands.
« Last Edit: October 24, 2020, 05:18:53 pm by georgian »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6762
  • Country: fi
    • My home page and email address
Re: Hardwere switch for dual boot.
« Reply #33 on: October 24, 2020, 06:02:49 pm »
Part D of Ralf Brown's Interrupt List explains the following in PORTS.B file for the hardware serial port registers:
Code: [Select]
PORT 03F8-03FF - Serial port (8250,8250A,8251,16450,16550,16550A,etc.) COM1
Range: PORT 02E8h-02EFh (COM2), PORT 02F8h-02FFh (typical non-PS/2 COM3), and
  PORT 03E8h-03EFh (typical non-PS/2 COM4)
Note: chips overview:
8250  original PC, specified up to 56Kbd, but mostly runs
       only 9600Bd, no scratchregister, bug: sometimes shots
       ints without reasons
8250A, 16450, 16C451: ATs, most chips run up to 115KBd,
       no bug: shots no causeless ints
8250B: PC,XT,AT, pseudo bug: shots one causeless int for
compatibility with 8250, runs up to 56KBd
16550, 16550N, 16550V: early PS/2, FIFO bugs
16550A,16550AF,16550AFN,16550C,16C551,16C552: PS/2, FIFO ok
82510: laptops & industry, multi emulation mode
(default=16450), special-FIFO.
8251: completely different synchronous SIO chip, not compatible!
SeeAlso: INT 14/AH=00h"SERIAL"

03F8  -W  serial port, transmitter holding register (THR), which contains the
  character to be sent. Bit 0 is sent first.
bit 7-0   data bits when DLAB=0 (Divisor Latch Access Bit)
03F8  R-  receiver buffer register (RBR), which contains the received
  character. Bit 0 is received first
bit 7-0   data bits when DLAB=0 (Divisor Latch Access Bit)
03F8  RW  divisor latch low byte (DLL) when DLAB=1 (see #P0876)
03F9  RW  divisor latch high byte (DLM) when DLAB=1 (see #P0876)
03F9  RW  interrupt enable register (IER) when DLAB=0 (see #P0877)
03FA  R-  interrupt identification register (see #P0878)
Information about a pending interrupt is stored here. When the ID
  register is addressed, thehighest priority interrupt is held, and
  no other interrupts are acknowledged until the CPU services that
  interrupt.
03FA  -W  16650 FIFO Control Register (FCR) (see #P0879)
03FB  RW  line control register (LCR) (see #P0880)
03FC  RW  modem control register (see #P0881)
03FD  R-  line status register (LSR) (see #P0882)
03FE  R-  modem status register (MSR) (see #P0883)
03FF  RW  scratch register (SCR)
(not used for serial I/O; available to any application using 16450,
  16550) (not present on original 8250)

(Table P0876)
Values for serial port divisor latch registers:
 Some baudrates (using standard 1.8432 Mhz clock):
       baudrate    divisor DLM  DLL
    50    2304   09h 00h
    75    1536   06h 00h
   110    1047   04h 17h
   134,5    857   03h 59h
   150     768   03h 00h
   300     384   01h 80h
   600     192   00h C0h
  1200      96   00h 60h
  1800      64   00h 40h
  2000      58   00h 3Ah
  2400      48   00h 30h
  3600      32   00h 20h
  4800      24   00h 18h
  7200      16   00h 10h
  9600      12   00h 0Ch
19200       6   00h 06h
38400       3   00h 03h
57600       2   00h 02h
115200       1   00h 01h
Note: MIDI baudrate 32250Bd with 4Mhz quarz for c't MIDI interface
  following c't 01/1991:   '14400'   00h 08h

Bitfields for serial port interrupt enable register (IER):
Bit(s) Description (Table P0877)
 7-6 reserved (0)
 5 (82510) "timer"
(other) reserved (0)
 4 (82510) "transmit machine"
(other) reserved (0)
 3 modem-status interrupt enable
 2 receiver-line-status interrupt enable
 1 transmitter-holding-register empty interrupt enable
 0 received-data-available interrupt enable
  (also 16550(A) timeout interrupt)
Note: 16550(A) will interrupt with a timeout if data exists in the FIFO
  and isn't read within the time it takes to receive four bytes or if
  no data is received within the time it takes to receive four bytes
SeeAlso: #P0878

Bitfields for serial port interrupt identification register (IIR):
Bit(s) Description (Table P0878)
 7-6 =00  reserved on 8250, 8251, 16450
=01  if FIFO queues enabled but unusable (16550 only)
=11  if FIFO queues are enabled (16550A only) (see also #P0879)
 6-5 used by 82510 for bank select (00 = default bank0)
 5-4 reserved (0)
 3-1 identify pending interrupt with the highest priority
110 (16550,82510) timeout interrupt pending
101 (82510) timer interrupt (see #P0877)
100 (82510) transmit machine (see #P0877)
011 receiver line status interrupt. priority=highest
010 received data available register interrupt. pr.=second
001 transmitter holding register empty interrupt. pr.=third
000 modem status interrupt. priority=fourth
 0 =0 interrupt pending. contents of register can be used as a pointer
  to the appropriate interrupt service routine
=1 no interrupt pending
Notes: interrupt pending flag uses reverse logic, 0=pending, 1=none
interrupt will occur if any of the line status bits are set
THRE bit is set when THRE register is emptied into the TSR
SeeAlso: #P0877

Bitfields for serial port FIFO control register (FCR):
Bit(s) Description (Table P0879)
 7-6 received data available interrupt trigger level (16550)
00  1 byte
01  4 bytes
10  8 bytes
11 14 bytes
 6-5 =00  (used to enable 4 byte Rx/Tx FIFOs on 82510???)
=10 ???
 5-4 reserved (00)
 3 change RXRDY  TXRDY pins from mode 0 to mode 1
 2 clear XMIT FIFO
 1 clear RCVR FIFO
 0 enable clear XMIT and RCVR FIFO queues
 4-0 (other purpose on 82510???)
Notes: bit 0 must be set in order to write to other FCR bits
bit 1 when set the RCVR FIFO is cleared and this bit is reset
  the receiver shift register is not cleared
bit 2 when set the XMIT FIFO is cleared and this bit is reset
  the transmit shift register is not cleared
due to a hardware bug, 16550 FIFOs don't work correctly (this
  was fixed in the 16550A)
SeeAlso: #P0878

Bitfields for serial port Line Control Register (LCR):
Bit(s) Description (Table P0880)
 7 =1  divisor latch access bit (DLAB)
=0  receiver buffer, transmitter holding, or interrupt enable register
  access
 6 set break enable. serial ouput is forced to spacing state and remains
  there.
 5-3 PM2 PM1 PM0
x   x 0 = no parity
0   0 1 = odd parity
0   1 1 = even parity
1   0 1 = high parity (sticky)
1   1 1 = low parity (sticky)
x   x 1 = software parity
 2 stop bit length (STB/SBL)
0  one stop bit
1  2 stop bits with (word length 6, 7, 8)
   1.5 stop bits with word length 5
 1-0 (WLS1-0, CL1-0)
00 word length is 5 bits
01 word length is 6 bits
10 word length is 7 bits
11 word length is 8 bits
SeeAlso: #P0881,#P0882,#P0883

Bitfields for serial port Modem Control Register (MCR):
Bit(s) Description (Table P0881)
 7-6 reserved (0)
 5 (82510 only) state of OUT0 pin
 4 loopback mode for diagnostic testing of serial port
output of transmitter shift register is looped back to receiver
  shift register input. In this mode, transmitted data is received
  immediately so that the CPU can verify the transmit data/receive
  data serial port paths.
If OUT2 is disabled, there is no official way to generate an IRQ
  during loopback mode.
 3 auxiliary user-designated output 2 (OUT2)
because of external circuity OUT2 must be 1 to master-intr-enableing.
BUG: Some Toshiba Laptops utilize this bit vice versa, newer Toshiba
  machines allow assignment of the bit's polarity in system setup.
82050: This bit is only effective, if the chip is being used with an
  externally-generated clock.
 2 =1/0  auxiliary user-designated output 1 (OUT1)
should generally be cleared!!
Some external hardware, e.g. c't MIDI interface (and compatibles) use
  this bit to change the 8250 input clock from 1,8432 MHz to 4Mhz
  (enabling MIDI-conformant baudrates) and switching to
  MIDI-compatible current loop connectors.
 1 force request-to-send active (RTS)
 0 force data-terminal-ready active (DTR)
SeeAlso: #P0880,#P0882,#P0883

Bitfields for serial port Line Status Register (LSR):
Bit(s) Description (Table P0882)
 7 =0  reserved
=1  on some chips produced by UMC
 6 transmitter shift and holding registers empty
 5 transmitter holding register empty (THRE)
Controller is ready to accept a new character to send.
 4 break interrupt. the received data input is held in the zero bit
  state longer than the time of start bit + data bits + parity bit +
  stop bits.
 3 framing error (FE). the stop bit that follows the last parity or data
  bit is a zero bit
 2 parity error (PE). Character has wrong parity
 1 overrun error (OE). a character was sent to the receiver buffer
  before the previous character in the buffer could be read. This
  destroys the previous character.
 0 data ready. a complete incoming character has been received and sent
  to the receiver buffer register.
SeeAlso: #P0880,#P0881,#P0883

Bitfields for serial port Modem Status Register (MSR):
Bit(s) Description (Table P0883)
 7 data carrier detect (-DCD)
 6 ring indicator (-RI)
 5 data set ready (-DSR)
 4 clear to send (-CTS)
 3 delta data carrier detect (DDCD)
 2 trailing edge ring indicator (TERI)
 1 delta data set ready (DDSR)
 0 delta clear to send (DCTS)
Notes: bits 0-3 are reset when the CPU reads the MSR
bit 4 is the Modem Control Register RTS during loopback test
bit 5 is the Modem Control Register DTR during loopback test
bit 6 is the Modem Control Register OUT1 during loopback test
bit 7 is the Modem Control Register OUT2 during loopback test
SeeAlso: #P0880,#P0881,#P0882

The most important one is the last table, explaining the eight bits of port 0x3FE, Modem Status Register (MSR):
  • Bit 7 (128): DCD. This reflects the DCD pin state.
  • Bit 6 (64): RI. This reflects the RI pin state.
  • Bit 5 (32): DSR. This reflects the DSR pin state.
  • Bit 4 (16): CTS. This reflects the CTS pin state.
  • Bit 3 (8): Delta DCD. This is set when the DCD state has changed since last read of this register.
  • Bit 2 (4): Trailing edge RI. This is set when RI has transitioned from low to high since this register was read last.
  • Bit 1 (2): Delta DSR.  This is set if DSR has changed since last read of this register.
  • Bit 0 (1): Delta CTS.  This is set if CTS has changed since last read of this register.
I'm no longer convinced I know whether the four high bits are inverted or not... so check that.  However, inb sets the environment variable value to hexadecimal without a leading 0x, so the values you see (10, 11, 20, 23) are actually 0x10=16, 0x11=17, 0x20=32, 0x23=35.  And yes, those values make perfect sense.  (I hope this post explains why and how.)

Code: [Select]
if [ $com1 -eq 10 -o $com1 -eq 11]; then

Before you do this, you need to add
    com1=0x$com1
so that Grub parses it correctly as a hexadecimal number.  It definitely is a hexadecimal number, as Grub uses grub_snprintf(buf, sizeof (buf), "%x", value) to construct it.

The reason i have to check if port is 10 or 11 is because first time i read the port gives 11, sometimes other number and second time it gives the correct number.
Yes, this is because the four low bits (right-side hexadecimal digit) is a "delta" value, telling whether the status lines have changed since the last read of the register.

Essentially, if you read it twice in succession, and the input pin states do not change in between, the low bits should be all zeros (so you get 0x10, 0x20, 0x30, ..., 0xF0).
It is perfectly okay to read the register twice in succession, e.g.
    inb -v com1 0x3FE
    inb -v com1 0x3FE
    com1=0x$com1
to hopefully clear the low four bits that aren't that interesting.  I don't think Grub has built-in arithmetic or binary operators, otherwise com1=$[0x$com1 & 0xF0] would have been extremely useful for this.  Also note that the value you are treating as a decimal is actually hexadecimal, because inb does not set the leading 0x, the values you get just happen to look like normal decimal values!

We could rely on the regexp command, though:
    inb -v com1 0x3FE
    regexp --set 1:com1 '^[0-9A-Fa-f]*([0-9A-Fa-f])[0-9A-Fa-f]$' 00$com1
    com1=0x$com1
in which case com1 matches a number between 0-15, as if it had been divided by 16.  The idea is that the POSIX extended regular expression in single quotes matches any number of hex digits, then remembers one hex digit, then matches one hex digit; and the command stores the first parenthesized match back to com1.  The string it operates on has two zeros prepended, so that the regexp works correctly even when com1 contains only a single hex digit.  (But do check it for bugs, I haven't tested it.)
 

Offline LeonR

  • Regular Contributor
  • *
  • Posts: 158
  • Country: br
  • PC hardware enthusiast
Re: Hardwere switch for dual boot.
« Reply #34 on: October 24, 2020, 11:18:47 pm »
Is there any specific reason to go for a complex solution to a very simple problem?

Grab a couple of those or similar and just turn on the one with the OS you need booting:

https://www.aliexpress.com/item/32814146574.html

Alternatively, if it is a server-grade equipment you'll probably have IPMI, so you can remotely manage the system's BIOS and toggle the boot disk. Or even choose whichever OS you want to boot using GRUB, etc.
 

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: Hardwere switch for dual boot.
« Reply #35 on: October 25, 2020, 09:11:07 am »
Is there any specific reason to go for a complex solution to a very simple problem?

Grab a couple of those or similar and just turn on the one with the OS you need booting:

https://www.aliexpress.com/item/32814146574.html

Alternatively, if it is a server-grade equipment you'll probably have IPMI, so you can remotely manage the system's BIOS and toggle the boot disk. Or even choose whichever OS you want to boot using GRUB, etc.
I don't want to have 2 HDDs. I want one with more partitions. It's just a motherboard, so no remote access to bios.
This solutions is not complex at all. It's just a few lines of code on the grub config file. So far  ;D
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3759
  • Country: nl
Re: Hardwere switch for dual boot.
« Reply #36 on: October 31, 2020, 05:01:10 am »
TL:DR.

Addition:
The simplest way is probably to use your BIOS to select a boot disk.
You select one disk as default, and with holding a button during boot (usually F8 I think) you can get a boot menu to select a disk to boot from.

No extra hardware needed.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf