How to create a USB that Linux and Win10 installer and winpe can boot UEFI

Introduction

The first article.

Main subject

If you have only one Win machine in your house, you have to make two USBs, and if the Win machine breaks for some reason, you have to fix it. ex. I broke the boot area

environment

Win10 and Ubuntu dual boot You can do it only on Linux, but since install.wim is 4GB or more, Takes up storage space

Get iso

https://tb.rg-adguard.net/public.php You can get past Winiso from here You can also get the latest version of the iso from the Media creation tool.

Shrink /source/install.wim

You can skip this step if you downloaded it with the Mediacreation tool </ b>

Dism /Get-WimInfo /WimFile:D:\sources\install.wim
Dism /Get-WimInfo /WimFile:{ESD file path} or {WIM file path}

Then the edition number will come out, so make a note of it.

Dism /Export-Image /SourceImageFile:{ESD file path} /SourceIndex:{Index number} /DestinationImageFile:{WIM file path} /Compress:max /CheckIntegrity

Please change the extension to .wim or .esd as appropriate.

grub-install Create a fat32 partition of at least 100MB

mount /dev/100MB partition/mnt
mkdir /mnt/boot
grub-install --target=x86_64-efi --efi-directory=/mnt --boot-directory=/mnt/boot --removable --recheck

grub version 2.04 bug

grub version 2.04 cannot chainload iso Overwrite /efi/* with 2.02 .efi I extracted from lubuntu 18.04 iso

How to partition

スクリーンショット_2020-06-22_12-55-41.png The partition that stores the ISO must be fat32 /GRUB/boot/grub/grub.cfg

touch /USB_mountpoint/boot/grub/grub.cfg

grub.cfg

insmod all_video
insmod fat
insmod ntfs

if [ x$feature_platform_search_hint = xy ]; then
   	search --no-floppy --fs-uuid --set=root  XXXX-XXXX #ISO partition UUID
else
   	search --no-floppy --fs-uuid --set=root XXXX-XXXX #ISO partition UUID
fi

# System shutdown
menuentry "System shutdown" {
	echo "System shutting down..."
	halt
}

# System restart
menuentry "System restart" {
	echo "System rebooting..."
	reboot
}

# Firmware setup
menuentry "Firmware setup" {
	fwsetup
}

# Xubuntu
menuentry '[loopback]xubuntu-20.04-desktop-amd64' {
	set isofile='/iso/xubuntu-20.04-desktop-amd64.iso'
    loopback loop $isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile
    initrd (loop)/casper/initrd
}

# Kail Linux
menuentry "[loopback]kali-linux-2019.4-lxde-amd64" {
	set isofile='/iso/kali-linux-2019.4-lxde-amd64.iso'
	loopback loop $isofile
	linux (loop)/live/vmlinuz boot=live findiso=$isofile noconfig=sudo username=root hostname=kali
	initrd (loop)/live/initrd.img
}

# Ubuntu Server
menuentry '[loopback]ubuntu-20.04-live-server-amd64' {
    set isofile='/iso/ubuntu-20.04-live-server-amd64.iso'
    loopback loop $isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile
    initrd (loop)/casper/initrd
}

# WinPE
menuentry '[chain]Hiren’s BootCD PE' {
	insmod chain
    if [ x$feature_platform_search_hint = xy ]; then
   	    search --no-floppy --fs-uuid --set=root  XXXXXXXXXXXXXX #WinPE partition UUID
   	else
   	    search --no-floppy --fs-uuid --set=root XXXXXXXXXXXXXX #WinPE partition UUID
   	fi
        chainloader /EFI/Boot/bootx64.efi #bootx64.efi PATH
}

# Win10
menuentry '[chain]Win10_1909_Japanese_x64' {
	insmod chain
    if [ x$feature_platform_search_hint = xy ]; then
   	    search --no-floppy --fs-uuid --set=root  XXXXXXXXXXXXXX #Win Installer partition UUID
   	else
   	    search --no-floppy --fs-uuid --set=root XXXXXXXXXXXXXX #Win Installer partition UUID
   	fi
        chainloader /efi/boot/bootx64.efi #bootx64.efi PATH
}

Get partition UUID

lsblk -f /dev/sda
lsblk -f | grep MOUNT_POINT

Quote

https://qiita.com/SkyLaptor/items/7f2bf545e3d0a9170303 https://wiki.archlinux.jp/index.php/%E3%83%9E%E3%83%AB%E3%83%81%E3%83%96%E3%83%BC%E3%83%88_USB_%E3%83%89%E3%83%A9%E3%82%A4%E3%83%96 https://qiita.com/roamer7038/items/b61cc70404a4e5ab181b

At the end

Thank you for reading such a hard-to-read article

Recommended Posts

How to create a USB that Linux and Win10 installer and winpe can boot UEFI
How to create a shortcut command for LINUX
How to install Linux on a 32bit UEFI PC
How to create a local repository for Linux OS
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
How to create a property of relations that can be prefetch_related by specific conditions
How to write a metaclass that supports both python2 and python3
How to start a simple WEB server that can execute cgi of php and python
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
Overview of how to create a server socket and how to establish a client socket
Command to create Linux Live USB
How to create a Conda package
How to create a virtual bridge
[C language] How to create, avoid, and make a zombie process
How to create a Dockerfile (basic)
How to create a config file
How to make a rock-paper-scissors bot that can be easily moved (commentary)
How to create a wrapper that preserves the signature of the function to wrap
Create a permanent write area on Kali Linux with USB memory boot
How to create a clone from Github
[Linux] How to subdivide files and folders
How to split and save a DataFrame
How to create a git clone folder
How to create a repository from media
I tried to create a class that can easily serialize Json in Python
I want to create a priority queue that can be updated in Python (2.7)
A spell that eliminates non-Japanese characters and symbols to create a Japanese plaintext corpus
How to install a Python library that can be used by pharmaceutical companies
Create a web app that converts PDF to text using Flask and PyPDF2
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
How to create a Python virtual environment (venv)
How to create a function object from a string
How to create explanatory variables and objective functions
How to create a JSON file in Python
Try to create a new command on linux
How to switch between Linux and Mac shells
[Note] How to create a Ruby development environment
How to create a Kivy 1-line input box
How to create a multi-platform app with kivy
How to create a Rest Api in Django
[Note] How to create a Mac development environment
What you can understand because you are a beginner How to create a file (first post)
[GCF + Python] How to upload Excel to GCS and create a new table in BigQuery
How to use a tp-link wireless LAN slave unit that does not support Linux
Notes on how to use StatsModels that can use linear regression and GLM in python
How to execute sleep command, command that takes time as a test [bash, linux, mac]
Read the Python-Markdown source: How to create a parser
Install Grub on USB memory (UEFI) ~ Boot Linux from grub on USB memory ~
Beginners! Basic Linux commands and how to use them!
How to create a submenu with the [Blender] plugin
[Python] How to write a docstring that conforms to PEP8
[Python] How to create Correlation Matrix and Heat Map
How to create a simple TCP server / client script
[Python] How to create a 2D histogram with Matplotlib
Fixed a way to force Windows to boot in UEFI
How to build a Python environment on amazon linux 2
How to create a kubernetes pod from python code
[Linux] How to put your IP in a variable
[Linux] Create a self-signed certificate with Docker and apache
[Linux] How to monitor logs that are constantly added
[Linux] [C / C ++] How to get the return address value of a function and the function name of the caller