LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-20-2018, 03:47 AM   #1
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Rep: Reputation: 144Reputation: 144
Question nvme boot on qemu howto?


hi all, I have an nvme disk on real hardware booting from the bios in csm mode using (a patched version of) lilo, and it works fine. however, I am trying to test the patch on a virtual machine as well, just to make sure it (the patch) is ok. I am using qemu.
If I have just nvme drive/s in the vm, how can I specify to boot on that drive?. According to some qemu mail log, nvme boot support was added in 2016, but I haven't been able to find the parameters to use. I don't want to use uefi as I am testing my lilo patch on csm. I know I can add a second none-nvme drive to the vm and do it that way, but that defeats the point of testing booting off nvme only, with lilo on the nvme mbr.
Any hints would be appreciated.
 
Old 02-21-2018, 09:39 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Hi:

I know you said that you don't want to use UEFI but don't you have to use it in order for a Volatile Memory Host Controller Interface to boot?

This technoligy is new to me. Looking here as I go.
https://wiki.archlinux.org/index.php...ate_Drive/NVMe

This might help; that is if your mobo recognizes the nvme as a bootable device.

https://delightlylinux.wordpress.com...en-using-nvme/

I've read on a handful of Arch pages that you can do it with a efi partition with grub and systemd.
I can't even begin to think on how you would get it to play nice with lilo.

I searched for a while and couldn't find anything, sorry.
 
Old 02-21-2018, 10:05 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Another thought:-

Depending on your nvme Intel? Samsung? Kingston? or other model, go to the manufactures website for the device and see if they offer any tips for getting it to boot in a vm.

Hope this helps.
https://openchannelssd.readthedocs.i...ettingstarted/

Good Luck-
 
Old 02-22-2018, 12:25 PM   #4
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
my real nvme is adata (the right price, but still fast). I got that to boot initially using sys/etxlinux, and then after patching lilo, got it to boot with lilo (the real bios is eufi but running in legacy (csm) mode. an ami bios on an asrock a320m-hdv)
I have found ovmf for qemu (on sbo) which has a csm module, and offers to boot from nvme, but I havn't got it working yet, and am not sure whether it is my patch, or the bios. I'll keep this LQ thread open, and update it with progress..
Just to clarify, I have it working on real nvme hardware already with patched lilo, I am just tring to test my patch with virtual hardware now, (it is easier for remote testing, and repeatability, without messing up my real development pc, and I want more testing before submitting the patch to Pat)
 
Old 02-22-2018, 12:34 PM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by timsoft View Post
my real nvme is adata (the right price, but still fast). I got that to boot initially using sys/etxlinux, and then after patching lilo, got it to boot with lilo (the real bios is eufi but running in legacy (csm) mode. an ami bios on an asrock a320m-hdv)
I have found ovmf for qemu (on sbo) which has a csm module, and offers to boot from nvme, but I havn't got it working yet, and am not sure whether it is my patch, or the bios. I'll keep this LQ thread open, and update it with progress..
Just to clarify, I have it working on real nvme hardware already with patched lilo, I am just tring to test my patch with virtual hardware now, (it is easier for remote testing, and repeatability, without messing up my real development pc, and I want more testing before submitting the patch to Pat)
Good luck with your patch on a vm.

Kind Regards

Ztcoracat
 
Old 02-22-2018, 01:11 PM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,048

Rep: Reputation: Disabled
I didn't want to comment before Tim get other answers, but I have tried his patch on a VirtualBox VM, to no avail so far. The patched lilo runs with no errors after having edited the boot= option of /etc/lilo.conf but still the virtual machine didn't reboot yet.

Maybe Tim you could either post your patch as an attachment (just give it a .txt extension then so it be accepted by LQ) or upload it somewhere and provide a link to there.

This way others could have a chance to test it in more contexts (like another virtualization program, or another mobo on bare metal).

Last edited by Didier Spaier; 02-23-2018 at 04:36 AM.
 
Old 02-23-2018, 04:27 AM   #7
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
good idea Didier, attached is the patch so far. just apply the patch to the lilo source and build. it doesn't patch liloconfig yet, just lilo, but allows it to write to nvme disks. copy patch to lilo.Slackbuild folder, and add
Code:
patch -p1 < $CWD/mylilo.patch.txt
to the slackbuild, just after the other patch. run the script and install the package. To run from boot, replace existing lilo package with this one and re-create your dvd iso.
You will need to manually edit lilo.conf and replace /dev/sdva references with your /dev/nvme0n1 references.

if anyone can test it on a vm I would be grateful. (I can't get qemu to boot with ovmf yet, and the standard qemu bios does not give the option to boot from the nvme). I can boot from sda with nvme present, but that doesn't really test lilo installing to nvme. Any imput from someone who has done this successfully would be wonderful.
as I mentioned earlier, it is booting on real hardware. I will remove the other disks on the real hardware just leaving the nvme and see if it still boots, just to make sure.
Attached Files
File Type: txt mylilo.patch.txt (2.6 KB, 54 views)
 
Old 02-23-2018, 01:48 PM   #8
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
i can boot to the ovmf uefi shell. the ouput of map shows the nvme as blk4, and dblk blk4 shows the lilo string in the boot sector of the virtual nvme disk. unfortunately, I think I need the nvme blk device aliased to an fs device to get legacy (csm) boot to work. any input on legacy booting from uefi shell is appreciated...
 
Old 02-23-2018, 02:14 PM   #9
chemfire
Member
 
Registered: Sep 2012
Posts: 414

Rep: Reputation: Disabled
I am not posting to be judgemental. I think "because I want to" is a perfectly good reason to justify about anything one might do with a computer but...Can I ask why you want to boot with the CSM? Again more curious than anything?

elilo is really quite nice, IMHO with its text config and not needing to be re-installed to change kernels and initrds....
 
Old 02-23-2018, 04:35 PM   #10
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
since you asked,I am of the view "if it ain't broke, don't fix it". Apart from gpt support, which could have been added to regular bios, uefi is overkill, and has all sorts of ideas - such as safeboot, which sound nice, but are overkill, and make it harder for people to use linux. -most bioses only have microsoft certs in them, and anyone who likes playing around with kernels will have great difficulties with this extra secuirty features, unless they are bypassed, in which case - what's the point!.

having said all that, I don't like having to learn new stuff all the time, and it is easier for me to patch lilo to work with nvme disks, than to learn another boot manager; well, i'll delay it as long as i can - call me a troglodyte, i don't mind :-)
As a number of modern motherboards work with nvme in legacy mode (including my own), it is worth while emulating that, so that testing can be done. I already have it working on my hardware. it is emulation that I am having difficulties with. If you can contribute in this it would be appreciated.
 
Old 02-24-2018, 12:41 PM   #11
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
Smile success :-)

i re-tested my real hardware with just nvme drive and sata cdrw, and it boots fine.

good news :-). an updated version of qemu is available from sbo, and the newer version works. ie. I can boot from single virtual nvme drive (and virtual cdrom attached for the installation), using my patched lilo - using non-uefi bios!
For those interested in testing, I used the following qemu parameters
Code:
qemu-system-x86_64 -cpu qemu64 -m 6G -cdrom /data/images/slack64patched.iso \
-machine q35 \
 -net nic,macaddr=02:00:00:11:11:17,model=i82551 \
-net bridge,br=br0 -enable-kvm -k en-gb -display vnc=:3 \
-monitor telnet:localhost:7102,server,nowait,nodelay \
-device pcie-root-port,id=pcie_r0,bus=pcie.0,chassis=0,slot=0 \
-device nvme,bootindex=1,drive=nvdisk1,serial=foo,bus=pcie_r0 \
-drive file=/data/images/testnvme.qcow2,format=qcow2,if=none,media=disk,cache=none,aio=native,discard=unmap,id=nvdisk1
(obviously for installing, I added
Code:
-boot menu=on
to paramter list to get the bios boot menu and booted from the cdrom.)
defining a pcie root port is probably overkill, although you can use it if you want multiple nvme drives define another port the same bus but different id and slot, and change the second nvme device to point to the id of the second "bus". see here http://lists.gnu.org/archive/html/qemu-devel/2018-02/msg00022.html for details.
see attachements for lilo boot screen on the vm, and once booted and logged in.
Attached Thumbnails
Click image for larger version

Name:	liloboot.jpg
Views:	77
Size:	46.1 KB
ID:	27073   Click image for larger version

Name:	booted.jpg
Views:	57
Size:	30.9 KB
ID:	27074  

Last edited by timsoft; 02-25-2018 at 12:18 PM.
 
Old 02-25-2018, 04:39 PM   #12
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
Smile liloconfig patch

for those interested, a patch for liloconfig is attached. When applied along with the lilo patch and package created, and used in place of the original, the installation "just works". - at least testing with a single nvme drive and sata cd/dvd.
to apply, copy attachment to same directory as liloconfig, cd to that directory and run
Code:
patch liloconfig myliloconfig.patch.txt
add the lilo patch into the slackbuild, (after the other patch) and run it. replace the old lilo package with the new one and create a new bootable dvd and enjoy :-)
If you find any problems, please let me know so I can fix them.

The only omission I would like to do is change the lba32 option to make it the default if the bios is more recent than 2000 (all bioses after 1998 should support lba32). something like...
Code:
BIOSDATE=`dmidecode -t bios|grep -i date|awk -F"/" '{print $3}'`
if [ $BIOSDATE -gt 2000 ]; echo "lba32">>$T_PX/etc/lilo.conf
Attached Files
File Type: txt myliloconfig.patch.txt (3.2 KB, 42 views)
 
2 members found this post helpful.
  


Reply

Tags
boot, nvme, qeme


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to Dual Boot Windows 10 and Slackware on NVME SSD ALVAN Slackware 8 05-30-2017 04:39 AM
[SOLVED] Boot Slackware on NVME SSD? jkaidor Slackware 48 08-17-2016 11:56 AM
[SOLVED] qemu - guest network howto lupe Linux - Virtualization and Cloud 1 06-27-2011 07:40 PM
DSL-Qemu-Howto linus72 LinuxAnswers Discussion 1 07-27-2009 01:46 PM
qemu howto exodist Linux - Software 2 02-23-2005 03:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration