Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NVMe and MMC devices #5

Open
oldfred opened this issue Apr 22, 2017 · 6 comments
Open

Support NVMe and MMC devices #5

oldfred opened this issue Apr 22, 2017 · 6 comments

Comments

@oldfred
Copy link

oldfred commented Apr 22, 2017

I would like to add entry to search of Boot_Files_Fat= lines.
/EFI/ubuntu/grub.cfg
Not sure what other distributions use. I have seen /EFI/grub but not then sure now if grub.cfg or other. And each distribution like Mint uses that. Not sure if DISTRIB_ID= would cover other cases or not.

Also need search of newer drives as part of All_Hard_Drives=
/dev/nvme0n1
/dev/mmcblk0

@arvidjaar
Copy link
Owner

I added search for custom.cfg on FAT in v0.77.

As for NVMe - they are not usually even bootable with legacy BIOS and BIS is only partially useful for EFI anyway. In any case, NVMe supports needs patch from someone who owns this hardware and can test it. I change subject so someone can pick it up for implementation.

@arvidjaar arvidjaar changed the title Feature Requests Support NVMe and MMC devices Jun 10, 2018
@baedacool
Copy link

NVMe is just another medium on which an OS can be installed. I installed a legacy Windows 10 system on an NVME drive and adjusted the bootinfoscript to detect it. Maybe you can take over my changes. Following the changed script:
bootinfoscript.tar.gz

@arvidjaar
Copy link
Owner

@baedacool

Thank you, but please, submit pull request or at least attach patch in diff -up format.

@oldfred
Copy link
Author

oldfred commented Jan 26, 2019

I also added these lines to my version.

-	/grldr		/grub.exe
+	/grldr		/grub.exe  /EFI/ubuntu/grub.cfg
+	/EFI/grub2/grub.cfg
+	/EFI/fedora/grub.cfg
+        /EFI/grub/grub.cfg 

@oldfred
Copy link
Author

oldfred commented Feb 17, 2019

diff to baedacool's version.

fred@bionic-z97:~/Downloads$ sudo diff -up bootinfoscript_2019-02-17_22\:04\:35  bootinfoscript
[sudo] password for fred: 
--- bootinfoscript_2019-02-17_22:04:35	2019-02-17 16:04:36.140554000 -0600
+++ bootinfoscript	2019-01-23 05:50:32.000000000 -0600
@@ -1,8 +1,8 @@
 #!/bin/bash
 VERSION='0.77';
 RELEASE_DATE='10 June 2018';
-LAST_GIT_COMMIT_SHORTLOG='Prepare for release, update CHANGELOG';
-LAST_GIT_COMMIT_DATE='2018-06-10T07:08:02Z';
+LAST_GIT_COMMIT_SHORTLOG='';
+LAST_GIT_COMMIT_DATE='';
 ################################################################################
 #                                                                              #
 # Copyright (c) 2009-2010      Ulrich Meierfrankenfeld                         #
@@ -626,8 +626,7 @@ exec 2> ${Error_Log};
 #
 #   Support more than 26 drives.
 
-All_Hard_Drives=$(ls /dev/hd[a-z] /dev/hd[a-z][a-z] /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/xvd[a-z] /dev/vd[a-z] /dev/vd[a-z][a-z] 2>> ${Trash});
-
+All_Hard_Drives=$(ls /dev/hd[a-z] /dev/hd[a-z][a-z] /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/xvd[a-z] /dev/vd[a-z] /dev/vd[a-z][a-z] /dev/nvme[0-9]n[0-9] /dev/nvme[0-9]n[0-9][0-9] /dev/nvme[0-9][0-9]n[0-9] /dev/nvme[0-9][0-9]n[0-9][0-9] 2>> ${Trash});
 
 ## Add found RAID disks to list of hard drives. ##
 
@@ -1090,6 +1089,7 @@ ReadPT () {
   local HI=$1 StartEx=$2 N=$3 PT_file=$4 format=$5 EPI=$6 Base_Sector;
   local LinuxIndex=$7 boot size start end type drive system;
   local i=0 boot_hex label limit MBRSig;
+  local LinuxIndexExt;
 
   drive=${HDName[${HI}]};
   limit=${HDSize[${HI}]};
@@ -1143,15 +1143,18 @@ ReadPT () {
 	     fi
 
 	     LinuxIndex=$((${LinuxIndex}+1));
+	     if [ "${drive:0:9}" = "/dev/nvme" ]; then
+	         LinuxIndexExt="p$LinuxIndex"
+	     fi
 	     end=$((${start}+${size}-1));
 
 	     [[ "${HDPT[${HI}]}" = 'BootIt' ]] && label="${NamesArray[${EPI}]}_" || label=${drive};
 
 	     system=$(HexToSystem ${type});
 
-	     printf "${format}" "${label}${LinuxIndex}" "${boot}" $(InsertComma ${start}) "$(InsertComma ${end})" "$(InsertComma ${size})" "${type}" "${system}" >> ${PT_file};
+	     printf "${format}" "${label}${LinuxIndexExt}" "${boot}" $(InsertComma ${start}) "$(InsertComma ${end})" "$(InsertComma ${size})" "${type}" "${system}" >> ${PT_file};
 
-	     NamesArray[${PI}]="${label}${LinuxIndex}";
+	     NamesArray[${PI}]="${label}${LinuxIndexExt}";
 	     StartArray[${PI}]=${start};
 	     EndArray[${PI}]=${end};
 	     TypeArray[${PI}]=${type};
@@ -1161,7 +1164,7 @@ ReadPT () {
 	     DriveArray[${PI}]=${HI};
 	     ParentArray[${PI}]=${EPI};
 
-             ( [[ x"${EPI}" = x'' ]] || [[ x"${DeviceArray[${EPI}]}" != x'' ]] ) && DeviceArray[${PI}]=${drive}${LinuxIndex};
+             ( [[ x"${EPI}" = x'' ]] || [[ x"${DeviceArray[${EPI}]}" != x'' ]] ) && DeviceArray[${PI}]=${drive}${LinuxIndexExt};
 
 	     if [[ "${type}" = '5' || "${type}" = 'f' ]] ; then
 	        ReadPT ${HI} ${start} 2 ${PT_file} "${format}" ${PI} 4;
@@ -3196,7 +3199,7 @@ for drive in ${All_Hard_Drives} ; do
   PrintBlkid ${drive};
 
   if [ 0 -lt ${size} 2>> ${Trash} ] ; then
-     if [ x"$(blkid  ${drive})" = x'' ] || [ x"$(blkid  | grep ${drive}:)" = x'' ] ; then
+     if [ x"$(blkid  ${drive})" = x'' ] || [ x"$(blkid -p -s USAGE ${drive})" = x'' ] ; then
 	# Drive is not a filesytem.
 
 	size=$((2*size));
@@ -3793,4 +3796,3 @@ else
 fi
 
 exit 0;
-

@unphased
Copy link

@oldfred it looks like your diff is not the right diff. When i tried to patch it on the tarball linked by @baedacool it told me

File bootinfoscript is read-only; trying to patch anyway
patching file bootinfoscript
Reversed (or previously applied) patch detected!  Assume -R? [n] y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants