Compiling and installing Grub. USB boot. The goal here, is to produce the necessary set of files, to be written to an USB Flash Drive using dd (rather than using the Grub installer), so that it will boot through Grub 2. As usual, we start from nothing. I'll also assume that you know nothing about the intricacies of Grub 2 with regards to the creation of a bootable USB, so let me start with a couple of primers: For a BIOS/USB boot, Grub 2 basically works on the principle of a standard MBR (boot.
MBR (sector 1, or 0x. UFD) and which is a flat compressed image containing the Grub 2 kernel plus a user hand- picked set of modules (. These modules, which get added to the base kernel, should usually limit themselves to the ones required to access the set of file systems you want Grub to be able to read a config file from and load more individual modules (some of which need to be loaded to parse the config, such as normal. As you may expect, the modules you embed with the Grub kernel and the modules you load from the target filesystem are exactly the same, so you have some choice on whether to add them to the core image or load them from the filesystem. You most certainly do NOT want to use the automated Grub installer in order to boot an UFD. This is because the Grub installer is designed to try to boot the OS it is running from, rather than try to boot a random target in generic fashion. I recently attempted to install ubuntu 14.04 on a USB flash drive so I can use it on the go. Unable to boot Windows without USB in. Copy your mbr.bak to your hdd. Seeing nothing but the grub rescue prompt? Did Windows mess up your Master Boot Record? Complete Re-install of GRUB 2 from Live USB. How to Create a Bootable Ubuntu 13.10 USB Flash Drive - Duration. Thus, if you try to follow the myriad of quick Grub 2 guides you'll find floating around, you'll end up nowhere in terms of booting a FAT or NTFS USB Flash Drive, that should be isolated of everything else. Today, I'm going to use Linux, because my attempts to try to build the latest Grub 2 using either Min. GW3. 2 or cygwin failed miserably (crypto compilation issue for Min. GW, Python issue for cygwin on top of the usual CRLF annoyances for shell scripts due to the lack of a . I sure wish I had the time to produce a set of fixes for Grub guys, but right now, that ain't gonna happen . To do just that, we need to use the Grub utility grub- mkimage. Now that last part (telling grub that it should look at the USB generically and in isolation, and not give a damn about our current OS or disk setup) is what nobody on the Internet seems to have the foggiest clue about, so here goes: We'll want to tell Grub to use BIOS/MBR mode (not UEFI/GPT) and that we'll have one MBR partition on our UFD containing the boot data that's not included in boot. And with BIOS setting our bootable UFD as the first disk (whatever gets booted is usually the first disk BIOS will list), we should tell Grub that our disk target is hd. Furthermore, the first MBR partition on this drive will be identified as msdos. Grub calls MBR- like partitions msdos#, and GPT partitions gpt#, with the index starting at 1, rather than 0 as is the case for disks). Thus, if we want to tell Grub that it needs to look for the first MBR partition on our bootable UFD device, we must specify (hd. With this being sorted, the only hard part remaining is figure out the basic modules we need, so that Grub has the ability to actually identify and read stuff on a partition that may be FAT, NTFS or ex. FAT. To cut a long story short, you'll need at least biosdisk and part. Hence the complete command: cd grub- core/. O i. 38. 6- pc - d. That's because if you want to keep it safe and stay compatible with the largest choice of disk partitioning tools, you sure want to have core. KB - 5. 12 bytes. The reason is there still exists a bunch of partitioning utilities out there that default to creating their first partition on the second . And for most modern disks, including flash drives, a track will be exactly 6. What this all means is, if you don't want to harbour the possibility of overflowing core. E0. 0 bytes. The one thing you want to pay attention to here is, while copying core. MBR, you need to make sure that only the first 4. MBR and that has already been filled. So please pay close attention to the bs values below: dd if=boot. MBR). Side note: Of course, instead of using plain old dd, one could have used Grub's custom grub- bios- setup like this./grub- bios- setup - d. Thus I'd rather demonstrate that a dd copy works just as good as the Grub tool for this. Isn't that nice? FINAL NOTE: In case you're using this to try boot an existing Grub 2 based ISO from USB (say Aros), be mindful that, since we are using the very latest Grub code, there is a chance that the modules from the ISO and the kernel we use in core may have some incompatibility. Especially, you may run into the obnoxious: error: symbol 'grub. To fix that you will need to use kernel and modules from the same source.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |