a1ive grub2 notes

Command list

The a1ive grub2 version may not fully support all 'official' grub2 commands but it also supports additional commands and features.

The notes below may not be 100% accurate.

Chinese manual for a1ive grub2 here.

[EXPRESSION]

Same as "test"

acpi [OPTIONS] FILE1 [FILE2…]

Load ACPI Table

Modern BIOS systems typically implement ACPI and define various tables to describe the interface between ACPI-compliant operating systems and firmware. In some cases, the tables provided by default apply only to certain operating systems, and it may be necessary to replace some of them.

In general, this command replaces the root system description pointer (RSDP) in the extended BIOS data area to point to the new table. If you use the –no-ebda option, only GRUB gets the new table, but GRUB's EFI emulation can use the new table.

  • --exclude = TABLE1, TABLE2, ..., -x do not load the list

  • --load-only = TABLE1, TABLE2, ..., -n load list

  • --v1, -1 import version 1 tables into the operating system

  • --v2, -2 Import version 2 and 3 tables into the operating system

  • --oemid = STRING, -o set OEMID of RSDP, XSDT and RSDT

  • --oemtable = STRING, -t set OEMTABLE ID for RSDP, XSDT and RSDT

  • --oemtablerev = n, -r set OEMTABLE version of RSDP, XSDT and RSDT

  • --oemtablecreator = STRING, -c Set OEMTABLE creator for RSDP, XSDT and RSDT.

  • --oemtablecreatorrev = n, -d Set the OEMTABLE creator version of RSDP, XSDT, and RSDT.

  • --no-ebda, -e Do not update EBDA. It can prevent some BIOS from crashing and has no effect on the OS that cannot receive RSDP from GRUB.

  • --slic, -s Load as SLIC, automatically modify OEMID and OEMTABLE ID.

  • --msdm display / load MSDM tables

appleloader CMDLINE

Apple legacy boot loader.

authenticate [userlist]

Check if the user is listed in the user list or in the value of the variable “superusers”

If Superuser is empty, this command returns true.

background_color COLOR

Set the background color of the active terminal

You can only change the background color when using "gfxterm". This command sets the color of the blank area without text. The text background color is controlled by the environment variables color_normal, color_highlight, menu_color_normal, menu_color_highlight.

background_image [OPTIONS] [FILE]

Set a background image for the active terminal

By default the image will be stretched to fill the entire screen (--mode = stretch)

Without parameters, the currently loaded background image will be deleted.

  • --mode = stretch / normal, -m set the background image mode to stretch or normal

backtrace

Print traceback information

badram ADDR1, MASK1 [, ADDR2, MASK2 [,…]]

Shield bad memory

This command tells the memory manager that the specified area of ​​RAM should be filtered out. As long as the loaded kernel gets its memory map from GRUB, it remains valid after the kernel is loaded. The kernels that support this feature usually include Linux, GNU Mach, FreeBSD kernel and Multiboot kernel.

The syntax is the same as that provided by Memtest86 +: a list of address / mask pairs. Given a page-aligned address and a base address / mask pair, if all bits of the page-aligned address enabled by the mask match the base address, it means that the page will be filtered.

blocklist FILE

Print the block list of the file

blscfg FILE

Import BootLoaderSpec (BLS) configuration

bls_import FILE

Same as "blscfg"

boot

Start the loaded operating system

btrfs-info DEVICE

Show device btrfs partition information

btrfs-mount-subvol DEVICE DIRECTORY SUBVOL

Set the btrfs device DIRECTORY directory as the mount point of the subvolume SUBVOL

btrfs-list-subvols [OPTIONS] DEVICE

Show all subvolumes on device DEVICE

  • --output = VARIABLE, -o save output as a variable

  • --path-only, -p only show the paths of subvolumes

  • --id-only, -i show only the ids of the subvolumes

btrfs-get-default-subvol [OPTIONS] DEVICE

Show default subvolume on device DEVICE

  • Same parameters as btrfs-list-subvols

cat [OPTIONS] FILE

Show text file content

  • --dos allow DOS format line breaks (CR-LF)

  • --set = VARIABLE, -s save the contents to a variable

chainloader [–force | –bpb] FILE [ADDR]

Start another bootloader, the default load address is 0x7c00

chainloader [OPTIONS] FILE CMDLINE

Launch EFI executable

Warning: Use this command may cause security issues

  • --alt, -a use GRUB 2's built-in EFI loader

  • --text, -t Convert to text mode before starting EFI

  • --boot, -b execute boot immediately

checktime minute hour day month day_of_week

Check whether the current time meets the requirements, if yes, returns 0, otherwise returns 1. The syntax is similar to cron under unix.

clear

Clear Screen

clear_menu

Clear the current menu

Warning: Be sure to disable before using this command ESC export grub_disable_esc = 1

cmosclean byte: bit

Clear the value of the CMOS bit: byte: bit

Only available on platforms that support CMOS.

cmosdump

Show raw CMOS data

cmostest byte: bit

Test the value of CMOS at byte: bit

If the bit is set, true (0) is returned, otherwise non-zero.

cmp FILE1 FILE2

Compare two files

If the two files have different sizes, the sizes are displayed separately. If the size is the same but the data is different, the first different position and data will be displayed. If they are identical, there is no output.

commandline

Enter the GRUB command line

configfile FILE

Load GRUB2 configuration file

crc32 FILE [VARIABLE]

Calculate the CRC32 check code of the file

cpuid [OPTIONS]

Checking CPU characteristics

Without parameters, the default parameter is -l. If the CPU supports this feature, it returns 0.

  • --long-mode, -l Check if the CPU supports 64-bit long mode

  • --pae, -p Check if the CPU supports physical address extension (PAE)

cryptomount DEVICE | -u UUID | -a | -b

Mount the encryption device (supports LUKS / geli), in some cases you need to enter the password interactively

  • --uuid, -u mount device by UUID

  • --all, -a mount all devices

  • --boot, -b mount all devices marked with "boot"

cutmem FROM [K | M | G] TO [K | M | G]

Delete all memory areas in the specified range

date [OPTIONS] [[year-] month-day] [hour: minute [: second]]

Show / set current time

  • --set = VARIABLE, -s save time to variable

decrement VARIABLE

Decrement the value of a variable by one

devicetree FILE

Load device tree blob (.dtb)

dd OPTIONS

Write file / string / hex to file

Warning: This command will cause the loss of data

  • --if = FILE, -i specify input file

  • --str ="STRING", -s specify input string

  • --hex = HEX, -h specify input hexadecimal number

  • --of = FILE, -o specify output file

  • --bs = BYTES, -b specify block size

  • --count = n, -c specify the number of blocks

  • --skip = n skip the first n blocks of input

  • --seek = n skip the first n blocks of output

--if=(proc) = 00 bytes (equivalent to /dev/zero).

distrust PUBKEY_ID

Remove PUBKEY_ID from the trust list

dp FILE / DEVICE

UEFI Device Path for output device or file

dump ADDR [SIZE]

Show memory contents

echo [OPTIONS] STRING…

Show string

If you do not add the -n option, it will automatically wrap. Backslash escaping supports the following sequences:

\\ \\ – backslash \ a – alarm (BEL) \ c – no trailing newline \ f – form feed

\ N – line feed \ r – ​​carriage return \ t – horizontal tab \ v – vertical tab

  • -n does not wrap

  • -e enable backslash escape parsing

efi-export-env VARIABLE

Save the GRUB variable to the EFI environment variable GRUB_ENV

Warning: Use this command to modify UEFI environment variables

efi-load-env

Read variables from the EFI environment variable GRUB_ENV

efiload [OPTIONS] FILE

Load UEFI driver

  • --nc, -n Load driver only, not connect

eval STRING ...

Concatenate arguments together using single space as separator and evaluate result as sequence of GRUB commands.

exit

Exit GRUB

export VARIABLE [= VALUE] …

Set variables to global environment variables

expr [OPTIONS] EXPRESSION

Calculate mathematical expressions, support +-* \% operator

Warning: Division by zero results in unexpected situations such as crash or restart

  • --set = VARIABLE, -s save result to variable

fakebios

Create Legacy-BIOS-like structure for compatibility with existing systems

false

Returns false

file OPTIONS FILE

Check file type

  • --is-i386-xen-pae-domu

  • --is-x86_64-xen-domu

  • --is-x86-xen-dom0

  • --is-x86-multiboot

  • --is-x86-multiboot2

  • --is-arm-linux

  • --is-arm64-linux

  • --is-ia64-linux

  • --is-mips-linux

  • --is-mipsel-linux

  • --is-sparc64-linux

  • --is-powerpc-linux

  • --is-x86-linux

  • --is-x86-linux32

  • --is-x86-kfreebsd

  • --is-i386-kfreebsd

  • --is-x86_64-kfreebsd

  • --is-x86-knetbsd

  • --is-i386-knetbsd

  • --is-x86_64-knetbsd

  • --is-i386-efi

  • --is-x86_64-efi

  • --is-ia64-efi

  • --is-arm64-efi

  • --is-arm-efi

  • --is-riscv32-efi

  • --is-riscv64-efi

  • --is-hibernated-hiberfil

  • --is-x86_64-xnu

  • --is-i386-xnu

  • --is-xnu-hibr

  • --is-x86-bios-bootsector

fix_video

Fixed image display issues

fwsetup

Restart into UEFI firmware settings

getargs OPTIONS STRING VARIABLE

Get parameters from command line received from GRUB 2 EFI file

If the command is executed successfully (parameter / value exists), it returns 0.

  • --key, -k Get whether to set this parameter

  • --value, -v get the value of the parameter

getenv [OPTIONS] EFI_ENV VARIABLE

Get UEFI environment variables

  • --guid = GUID, -g Set the GUID of the variable to be queried. The default is a global variable.

  • --type = string / uint8 / hex, -t specifies that the variable type is string / 8 bit unsigned integer / hex data, default is hex data

getkey [-n] [VARIABLE]

Wait for the key and output the keyboard scan code

gettext STRING

Translate strings into the current language

The current language code is stored in the "lang" variable in the GRUB environment. Translation files in MO format are read from "locale_dir", usually / boot / grub / locale.

gptprio.next OPTIONS [DEVICE]

Select the next partition where the GPT disk will boot

  • --set-device = VARIABLE, -d save partition name to variable

  • --set-uuid = VARIABLE, -u save partition UUID to variable

gptrepair DEVICE

Check and repair the GPT partition table of the device

Warning: Use this command may cause data loss

gptsync DEVICE [PARTITION [+/- [TYPE]]]…

Modify the MBR compatible partition table of the GPT partition table hard disk

TYPE is the MBR partition type code. "+" Means activate the partition, "-" means deactivate the partition.

halt [–no-apm]

Shut down the computer

If you add the "--no-apm" parameter, the APM BIOS call will not be executed. Otherwise, the computer will be shut down using APM.

hashsum -h HASH [OPTIONS] [-c FILE [-p PREFIX]] [FILE1 [FILE2…]]

Calculate or check the hash value. If the hash check is successful, it returns 0.

  • --hash = HASH, -h Specify the hash value type, support 'adler32', 'crc64', 'crc32', 'crc32rfc1510', 'crc24rfc2440', 'md4', 'md5', 'ripemd160', 'sha1' , 'sha224', 'sha256', 'sha512', 'sha384', 'tiger192', 'tiger', 'tiger2', 'whirlpool'

  • --check = FILE, -c specify a hash list file (generated using md5sum under UNIX)

  • --prefix = PREFIX, -p specify file directory

  • --keep-going, -k Do not stop checking after the first error, stop checking without this

  • --uncompress, -u decompress files before verifying

hdparm [OPTIONS] DISK

Get / Set ATA Disk Parameters

  • --apm = n, -B Set advanced power management (APM), 1 = low, ..., 254 = high, 255 = off

  • --power, -C show power mode

  • --security-freeze, -F freeze ATA security settings until reset

  • --health, -H show SMART health status

  • --aam = n, -M set automatic noise management (AAM), 0 = off, 128 = quiet, ..., 254 = fast

  • --standby-timeout = n, -S Set the standby timeout, 0 = off, 1 = 5s, 2 = 10s, ..., 240 = 20m, 241 = 30m, ...

  • --standby, -y set to standby mode

  • --sleep, -Y set to sleep mode

  • --identify, -i display device identification and settings

  • --dumpid, -I display the original contents of the ATA IDENTIFY sector

  • --smart = n disable / enable SMART (0/1)

  • --quiet, -q do not display information

help [PATTERN…]

Show help information for built-in commands. Without parameters, all available commands are displayed.

hexdump [OPTIONS] FILE / DEVICE [VARIABLE]

Shows the hexadecimal data of a file or device. (mem) is a memory device.

  • --skip = n, -s skip the first n bytes

  • --length = n, -n set the number of bytes read

  • --quiet, -q do not display output

hiddenentry “TITLE” [OPTIONS] [arg…] {COMMAND;…}

Add hidden menu, only valid for gfxmenu

Same parameters as “menuentry”

inb [OPTIONS] PORT

Read 8-bit value from the port

  • -v = VARIABLE Write the read value to a variable

increment VARIABLE

Increment the value of a variable by one

ini_get [OPTIONS] FILE [SECTION:] KEY

Get data from ini file

  • --set = VARIABLE, -s save data to variables

initrd FILE ...

Load Linux initial memory disk, use after linux

initrd16 FILE…

Load Linux initial memory disk for use after linux16

initrdefi FILE

Load Linux initial memory disk for use after linuxefi

inl [OPTIONS] PORT

Read 32-bit value from the port with the same parameters as “inb”

insmod MODULE

Load GRUB2 module

inw [OPTIONS] PORT

Read 16-bit value from the port with the same parameters as “inb”

keymap FILE

Load keyboard layout

keystatus [OPTIONS]

If the Shift / Ctrl / Alt key is pressed, it returns 0

Only some platforms support the detection of the modifier key state. If no parameter is added, this command is used to detect whether the modifier state is supported.

  • --shift, -s detect the Shift key

  • --ctrl, -c detect Ctrl key

  • --alt, -a detect Alt key

kfreebsd [OPTIONS] FILE [CMDLINE]

Load FreeBSD Kernel

kfreebsd_loadenv FILE

Load FreeBSD environment variables

kfreebsd_module FILE [CMDLINE]

Load FreeBSD module

kfreebsd_module_elf FILE [CMDLINE]

Load FreeBSD Module (ELF)

knetbsd [OPTIONS] FILE [CMDLINE]

Load the NetBSD kernel

knetbsd_module FILE [CMDLINE]

Load NetBSD Module

knetbsd_module_elf FILE [CMDLINE]

Load NetBSD Module (ELF)

kopenbsd [OPTIONS] FILE [CMDLINE]

Load the OpenBSD kernel

kopenbsd_ramdisk FILE

Load OpenBSD memory disk

linuxefi FILE [CMDLINE]

Load the Linux kernel

list_env [OPTIONS]

List all variables in the environment block file

  • --file = FILE, -f specify file name, default file name is $ {prefix} / grubenv

  • --skip-sig, -s Skip signature checking of environment files

list_trusted

List a list of trusted keys

load_env [OPTIONS] [VARIABLE…]

Load variables from the environment block file with the same parameters as "list_env"

loadbios BIOS_DUMP [INT10_DUMP]

Load BIOS dump

loopback [OPTIONS] DEVICE FILE

Mount the file as a virtual disk

  • --delete, -d delete the specified virtual disk

  • --mem, -m Copy files to memory and mount, allowing write operations

ls [OPTIONS] [FILE…]

List device or file

Without parameters, all devices are listed. If the parameter is a device name enclosed in parentheses, the name of the device file system is printed. If the argument is a directory specified as an absolute file name, the contents of that directory are listed.

  • --long, -l show more detailed information

  • --human-readable, -h show file size in readable format (KB, MB…)

  • --all, -a list all files

lsacpi [OPTIONS]

Show ACPI information

    • --v1, -1 show version 1 ACPI table only

    • --v2, -2 Display only version 2 and version 3 ACPI tables

lspci [OPTIONS]

List PCI devices

  • --iospace, -i show I / O space

lsefi

Show EFI handle

lsefienv

List all EFI environment variables

lsefimmap

Show EFI memory map

lsefisystab

Show EFI system tables

lua [FILE]

Execute Lua script

map [OPTIONS] FILE

Create UEFI virtual disk and boot

  • --mem, -m load into memory

  • --pause, -p Pause to view information before starting

  • --type = CD / HD / FD, -t specify disk type as CD / HDD / Floppy

  • --disk, -d simulate the entire disk

  • --rw, -w Allow writing to virtual disk, only effective for memory disk

  • --nb, -n Do not start this virtual disk

md5sum arg ...

That is “hashsum –hash md5 arg…”

menuentry “TITLE” [OPTIONS] [arg…] {COMMAND;…}

Define the GRUB menu item, the menu name is TITLE

After the menu item is selected for execution, if --id is specified, the value of the environment variable chosen will be set to the value of --id. The commands in the braces will be executed. If the last command is successfully executed and the kernel has been loaded, the boot command will be automatically executed.

All parameters including TITLE (arg…) are passed as positional parameters, and TITLE is assigned to $ 1.

  • --class = STRING classify menu items, display icons by different categories

  • --users = UESR [, USER] lists the users allowed to execute this menu

  • --hotkey = KEY set hotkey

  • --source = STRING Use STRING as menu entry body.

  • --id = STRING Associates a unique identifier with a menu item. id cannot start with a number, only ASCII alphanumerics, underscores, and hyphens are supported

  • --unrestricted allow all users to execute this menu

Special Hotkeys:

  • backspace

  • tab

  • delete delete key

  • insert

  • esc exit

  • f1 ~ f12 function keys

moksbset

Temporarily disable shim security verification, you need to restart

Warning: Use this command to modify UEFI environment variables

Warning: Use this command may cause security issues

ntboot [OPTIONS] FILE

Start NT6 + VHD / VHDX / WIM

  • --gui, -g enable graphics startup information

  • --pause, -p Pause before starting

  • --vhd, -v specify file type as VHD / VHDX

  • --wim, -w specify file type as WIM

  • --win, -n Windows on boot disk

  • --efi = FILE, -e Specify the bootmgfw.efi path, default is /efi/microsoft/boot/bootmgfw.efi

  • --sdi = FILE, -s specify boot.sdi path, default is /boot/boot.sdi

outb PORT VALUE [MASK]

Write 8-bit value to the port

outl PORT VALUE [MASK]

Write a 32-bit value to the port

outw PORT VALUE [MASK]

Write a 16-bit value to the port

partnew OPTIONS DISK PARTNUM

Create a primary partition for the disk of the msdos partition table

Warning: Use this command may cause data loss

  • --active, -a activate the partition

  • --file = FILE, -f use file as partition content

  • --type = HEX, -t specifies the partition type, 0x00 is automatic, 0x10 is automatically hidden

  • --start = n, -s specify start address (unit is sector)

  • --length = n, -l specify length (unit is sector)

pcidump OPTIONS

Show raw dump of PCI configuration space

  • -d [vendor]: [device] Select devices by vendor and device ID

  • -s [bus]: [slot] [. func] selects a device based on its position on the bus

play FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2]…

Use PC Speaker to play tunes

If the parameter is a file, the tune recorded by the file is played.

pop_env VARIABLE…

Pass the variables in the submenu to the previous menu

probe OPTIONS DEVICE

Test equipment information

  • --set = VARIABLE, -s set the return value to a variable

  • --driver, -d detect driver

  • --partmap, -p detect partition table type

  • --fs, -f detect file system type

  • --fs-uuid, -u detect file system UUID

  • --label, -l detect file system volume label

  • --partuuid, -g detect partition UUID (GPT partition table)

  • --bootable, -b detect if activated (msdos partition table)

  • --quiet, -q do not display an error

rand [OPTIONS] VARIABLE

Generate Pseudo-Random Numbers

  • --from = n, -f set the lower bound of random numbers

  • --to = n, -t set the upper bound of random numbers

rdmsr [OPTIONS] ADDR

Read a model-specific register at address ADDR.

Please note that on SMP systems, reading from a MSR that has a scope per hardware thread, implies that the value that is returned only applies to the particular cpu / core / thread that runs the command.

Also, if you specify a reserved or unimplemented MSR address, it will cause a general protection exception (which is not currently being handled) and the system will reboot.

  • -v VARIABLE save the value to a variable

read [VARIABLE]

Read a line of user input

read_byte [OPTIONS] ADDR

Read 8-bit value from ADDR

  • -v VARIABLE save the value to a variable

read_dword [OPTIONS] ADDR

Read 32-bit value from ADDR with the same parameters as “read_byte”

read_file FILE VARIABLE…

Read the file and set the contents of the file as variables line by line

read_word [OPTIONS] ADDR

Read 16-bit value from ADDR with the same parameters as “read_byte”

regexp [OPTIONS] 'REGEXP' “STRING”

Test whether the regular expression REGEXP matches the string STRING

Supported regular expressions are POSIX.2 extended regular expressions.

If the -set option is given, the first matching subexpression is stored in the variable var. Subexpressions are numbered starting from 1 with their opening parentheses. The number defaults to 1.

--set = [NUMBER:] [VARIABLE], -s save the nth matching string to a variable

# check date - reset if TESTDATE (YYYYMMDD) is equal to or smaller than current date

set TESTDATE=20210130

unset now;date -s now;regexp -s sdate '(........)' "$now"

# display RTC date and time in human form (optional)

date -m

if [ "${sdate}" -ge "${TESTDATE}" ]; then echo "ERROR: THIS SOFTWARE HAS EXPIRED ($sdate >= $TESTDATE) - rebooting..."; sleep 5; reset -w; fi

unset now;unset TESTDATE;unset sdate


save_env [OPTIONS] VARIABLE…

Save the variables from the GRUB environment to the environment block file with the same parameters as "load_env"

sbpolicy [OPTIONS]

Install security policies that bypass Secure Boot

Warning: Use this command may cause security issues

  • --install, -i install security policy

  • --uninstall, -u uninstall security policy

  • --status, -s show security policy status

search OPTIONS STRING

Search Disk

  • --file, -f search by file

  • --label, -l Search by file system volume label

  • --fs-uuid, -u Search by file system UUID

  • --part-label, -L Search by partition volume label

  • --part-uuid, g Search by partition UUID (GPT)

  • --disk-uuid, U Search by disk UUID (GPT)

  • --set = VARIABLE, -s save the first device found to a variable

  • --no-floppy, -n Do not detect floppy disks

  • --quiet, -q If there is no match, no error is displayed

  • --hint = HINT, -h specifies that the search starts from a device first, and if it ends with a comma, the subpartition will also be searched

  • --hint-ieee1275 = HINT If running under the IEEE1275 environment, specify to start searching from a device first

  • --hint-bios = HINT If running in BIOS environment, specify to search from a device first

  • --hint-baremetal = HINT If running in baremetal environment, specify to search from a device first

  • --hint-efi = HINT If running in EFI environment, specify to start searching from a device first

  • --hint-arc = HINT If running in ARC environment, specify to search from a device first

serial [OPTIONS]

Configure the serial port

setenv [OPTIONS] EFI_ENV VALUE

Write to UEFI environment variable

Warning: Use this command to modify UEFI environment variables

Warning: Use this command may cause security issues

  • --guid = GUID, -g Set the GUID of the variable to be written. The default is a global variable.

  • --type = string / uint8 / hex, -t specifies that the variable type is string / 8 bit unsigned integer / hex data, default is hex data

setpci [OPTIONS] REGISTER [= VALUE [: MASK]]

Operate PCI devices

  • -d [vendor]: [device] Select devices by vendor and device ID

  • -s [bus]: [slot] [. func] selects a device based on its position on the bus

  • -v VARIABLE save data to a variable

setup_var offset [setval]

Read / Write specific (byte) offset of setup variable.

Warning: Use this command to modify UEFI environment variables

Warning: Use this command may cause security issues

sha1sum arg…

That is “hashsum –hash sha1 arg…”

sha256sum arg…

That is "hashsum –hash sha256 arg…"

sha512sum arg…

That is “hashsum –hash sha512 arg…”

shell [OPTIONS] CMDLINE

Launch UEFI Shell

  • --nostartup Do not execute the default startup script

  • --noconsoleout not display terminal output

  • --noconsolein does not accept user input

  • --delay = n Set the wait time before executing the startup script

  • --nomap do not display the device mapping list

  • --noversion not show version information

  • --startup executes the default startup script

  • --nointerrupt disable interrupt execution

  • --exit automatically exit after execution

  • --device = DEVICE specifies the default Device Path

sleep [OPTIONS] n

Wait for n seconds

If the countdown ends, it returns 0. If the countdown is interrupted by ESC, it returns 1.

  • --verbose, -v show countdown seconds

  • --interruptible, -i allow ESC interrupt countdown

smbios [OPTIONS]

Retrieve SMBIOS Information

  • --type = TYPE, -t Match structures with the given type.

  • --handle = HANDLE, -h Match structures with the given handle.

  • --match = MATCH, -m Select a structure when several match.

  • --get-byte = OFFSET, -b Get the byte's value at the given offset.

  • --get-word = OFFSET, -w Get two bytes' value at the given offset.

  • --get-dword = OFFSET, -d Get four bytes' value at the given offset.

  • --get-qword = OFFSET, -q Get eight bytes' value at the given offset.

  • --get-string = OFFSET, -s Get the string specified at the given offset.

  • --get-uuid = OFFSET, -u Get the UUID's value at the given offset.

  • --set = VARIABLE save data to a variable

strconv [OPTIONS] STRING

String UTF-8 / GBK encoding conversion

  • --gbk, -g UTF-8-> GBK

  • --utf8, -u GBK-> UTF-8 (default)

  • --set = VARIABLE, -s set the return value to a variable

submenu “TITLE” [OPTIONS] {MENU…}

Define a submenu. When this item is selected for execution, a new menu containing the menu items in braces will be displayed

Same parameters as “menuentry”

submenu_exit

Exit from the current submenu

terminfo [OPTIONS] [TERM]

Set terminal type

test EXPRESSION

Calculate expression, if the result is true, return zero, otherwise return non-zero status

Supports the following expressions

    • string1 ==string2

      • the strings are equal

    • string1 !=string2

      • the strings are not equal

    • string1 <string2

      • string1 is lexicographically less than string2

    • string1 <=string2

      • string1 is lexicographically less or equal than string2

    • string1 >string2

      • string1 is lexicographically greater than string2

    • string1 >=string2

      • string1 is lexicographically greater or equal than string2

    • integer1 -eqinteger2

      • integer1 is equal to integer2

    • integer1 -geinteger2

      • integer1 is greater than or equal to integer2

    • integer1 -gtinteger2

      • integer1 is greater than integer2

    • integer1 -leinteger2

      • integer1 is less than or equal to integer2

    • integer1 -ltinteger2

      • integer1 is less than integer2

    • integer1 -neinteger2

      • integer1 is not equal to integer2

    • prefixinteger1 -pgtprefixinteger2

      • integer1 is greater than integer2 after stripping off common non-numeric prefix.

    • prefixinteger1 -pltprefixinteger2

      • integer1 is less than integer2 after stripping off common non-numeric prefix.

    • file1 -ntfile2

      • file1 is newer than file2 (modification time). optionally numeric bias may be directly appended to -ntin which case it is added to the first file modification time.

    • file1 -otfile2

      • file1 is older than file2 (modification time). optionally numeric bias may be directly appended to -otin which case it is added to the first file modification time.

    • -d file

      • file exists and is a directory

    • -e file

      • file exists

    • -f file

      • file exists and is not a directory

    • -s file

      • file exists and has a size greater than zero

    • -n string

      • the length of string is nonzero

    • string

      • string is equivalent to -n string

    • -z string

      • the length of string is zero

    • ( expression )

      • expression is true

    • ! expression

      • expression is false

    • expression1 -aexpression2

      • both expression1 and expression2 are true

    • expression1 expression2

      • both expression1 and expression2 are true. This syntax is not POSIX-compliant and is not recommended.

    • expression1 -oexpression2

      • either expression1 or expression2 is true

testspeed [OPTIONS] FILE

Test file read speed

  • --size = n, -s specify the size of each read

tetris

Tetris game. Please execute terminal_output console first

tr [OPTIONS] [SET1] [SET2] [STRING]

Replace the characters SET1 in the string STRING with SET2

If you enter two parameters, the input string must be specified by the --set option.

  • --set = VARIABLE, -s save the return value to a variable

  • --upcase, -U convert to uppercase

  • --downcase, -D convert to lower case

true

Returns TRUE (0) directly

Used for if or while statements.

trust [OPTIONS] PUBKEY_FILE

Add PUBKEY to the list of trusted keys

  • --skip-sig, -s skip signature checking of public key files

uuid4 VARIABLE

Generate UUID String

vboot harddisk = FILE floppy = FILE cdrom = FILE boot = harddisk / floppy / cdrom

Perform vboot boot, specify hard disk image / floppy disk image / disc image and default boot device

Vbootinsmod must first be executed to load vbootcore.mod.

The vboot file is required on the hard disk.

The default path for vboot is / vboot / vboot. Modify the variable vbootloader to specify the path.

vbootinsmod FILE

Load the vboot core file vbootcore.mod

verify_detached [OPTIONS] FILE SIGNATURE_FILE [PUBKEY_FILE]

Verify detached signature.

Same parameters as "trust"

version

Show GRUB version information

vfat OPTIONS

UEFI Virtual FAT Disk Operation

    • --create, -c create virtual FAT disk

    • --add = NAME FILE, -a specifies that the file FILE is added to the virtual disk, and the file name in the virtual disk is NAME

    • --mem, -m specify the file to be loaded into memory, allowing writing to the file

    • --install, -i make the virtual disk visible in UEFI

    • --boot, -b boot virtual disk

    • --ls, -l list all files in the virtual disk

    • --patch = FILE STRING, -p specifies the name of the file to be modified, the file must be in memory

    • --offset = n, -o specify modified offset

    • --search = STRING, -s search string

    • --count = n, -c specify the number of searches

      • Search and replace strings support the following formats

vhd [OPTIONS] DEVICE FILE

Mount the vhd file as a virtual disk

  • --delete, -d delete virtual disk

  • --partitions -p simulate hard drives with partitions

wimboot [OPTIONS] @: NAME: FILE

Start WIM file

  • --gui, -g enable graphics startup information

  • --rawbcd, -b Disable BCD automatic modification (.exe changed to .efi)

  • --rawwim, -w disable WIM automatic modification

  • --index = n, -i specify the WIM volume number to start

  • --pause, -p Pause before starting

  • --inject = WIN32_PATH, -j specify the injection folder, the default is \ Windows \ Syatem32

write_bytes ADDR VALUE…

Write a series of 8-bit values ​​to the address ADDR

Warning: Use this command may cause security issues

-------------------------

2020-02-23 FAT File commands

http://bbs.wuyou.net/forum.php?mod=viewthread&tid=418985

http://elm-chan.org/fsw/ff/00index_e.html

Destination should be FAT (all platforms) or exFAT (x86_64-efi/arm64-efi).

need to load the fatfs.mod module.

FAT partitions need to be mounted for use. Currently supports a maximum of 9 partitions mounted at the same time, the drive letter is 1 :, 2 :, ..., 9:

You need to mount a fat partition first.

e.g.

mount (hd0,1) 1

cp (hd0,2)/xxx/yyy.img 1:/zzz/www.img

cp 1:/abc/def.zip 1:/qwe/rty.zip

If dest_file not exist, it will be created.

If dest_file exists, it will be truncated and overwritten.

Works like normal os (win copy and linux cp).

Unmount

umount NUM [1-9]

Example:

umount 2

Unmount 2: /

mount status

mkdir 1: / new_dir

Create a folder named 'new_dir' under 1: /

rename 1: /WContig.zip 1: /qwert/test.zip

Move WContig.zip under 1: / to qwert / and rename it test.zip

rm PATH

Note: You cannot delete non-empty folders

Example:

rm 1: /qwert/test.zip

Move file

mv FILE1 FILE2

Note: Not moving across disks is equivalent to a rename operation.

Example:

mv 1: /aaa.txt 2: /bbb.txt

Create or touch date of file

touch FILE [YEAR MONTH DAY HOUR MINUTE SECOND]

Modify the file timestamp to the current time. If the file does not exist, create an empty file

Example:

touch 1: /aaa.txt

touch 1: /aaa.txt 2000 1 1

Change the modification time of 1: /aaa.txt to January 1, 2000

Modify the file

write_file FILE STRING [OFFSET]

Write to the file at the file offset OFFSET String. If the file size is insufficient, the file size will be automatically expanded.

Example:

write_file 1: /qwert/bbb.txt "xxxxxxx"

set installiso="${grubfm_path}"; tr --set=installiso "/" "\\"; set "iso1=[IsoInfo]\x0d\x0aIsoName=${installiso}\x0d\x0a"; mount (hd0,1) 1; touch 1:/Win10PESE.ini; write_file 1:/Win10PESE.ini "${iso1}";

===============================================================================================

variable

theme

Enable dynamic themes

export grub_frame_speed=110

Among them, 110 is the frame rate, and the unit is milliseconds per frame.

Using animation containers in theme.txt

+ animation { dir_name = "IMAGE_DIR" image_format = png/jpg/jpeg/tga frame_number = n left = p% width = p% top = p% height = p% size_ratio = n start_x = n start_y = n move_speed = n move_direction = up/down/left/right play_once = pause/disappear hit_wall = pause/stop/disappear bind_menu = fixed_position/follow_single/foll_variety/full_screen bind_direction = left/right }

Attribute description

dirname = "IMAGE_DIR"

The folder where the animation sequence picture is located refers to the folder under the theme.txt

image_format = png / jpg / jpeg / tga

Specify the extension of the animation picture, support png, jpg, jpeg, tga

frame_number = n

Total number of animated sequence pictures

The name of the picture file must be a number plus an extension. The number starts from 1, such as 1.jpg, 2.jpg, 3.jpg ...

left / top / width / height = x / p% / p% + x

The left margin / top margin / width / height of the container in the screen

Supported formats: percentage (p%), pixel (x), percentage + pixel (p% + x)

size_ratio = n

Proportion of animation size to container

start_x / start_y = n

The offset of the x / y coordinate of the animation in the container

If the animation follows the position of the main menu selection item, start_y has no effect.

move_direction = up / down / left / right

Set the initial moving direction of the animation, only valid in random moving animation

move_speed = n

Set the animation moving speed

A value of 0 will play the animation in place. Value cannot be negative.

play_once = pause / disappear

Set to pause the last frame or disappear after the animation plays once

If this is not set, it is loop playback.

hit_wall = pause / stop / disappear

Set the behavior when the animation hits the container wall

Pause-Pause animation

Stop-stop moving and resume animation

Disappear

bind_menu = fixed_position / follow_single / foll_variety / full_screen

Set the animation as a logo that changes with menu options

If the parameter is not follow_single, the animation sequence should be placed in each subdirectory of the dir_name parameter directory. The subdirectory name is the same as the parameter of menuentry -class.

Fixed_position-Play animation with menu items at a fixed position

Follow_single – follow the menu item and display the same set of animations in different positions

Follow_variety-follow menu items and play different animations in different positions

Full_screen-full screen display of animations that change with menu items

bind_direction = left / right

After enabling the following menu item animation, set the position of the animation to the left or right of the left border of the main menu

Menu sound

Set the variable grub_sound_speed to enable sound effects. The unit is milliseconds per note

export grub_sound_speed=110

Set looping sound effect

export grub_sound_start="freq1 freq2 freq3 ..."

Set up and down keys to select menu sound effects

export grub_sound_select="freq1 freq2 freq3 ..."

Where freq1, freq2, freq3… are frequencies in Hertz

Default sound

grub_sound_start="220 277 330 440 185 220 277 370 294 370 440 587 330 415 494 659" grub_sound_select="880 0 880 0 880 698 1046"

Build grubfm

May need

sudo apt-get install -y xorriso

sudo apt-get install -y gettext

Download and Build script

#! /bin/bash

rm -frdv ./grub2-filemanager/

ls ./grub2-filemanager

git clone --recursive https://github.com/a1ive/grub2-filemanager.git

cd grub2-filemanager

./update_grub2.sh

#./release.sh

echo 3 | ./build.sh

mv ./grubfmia32.efi ./grubia32.efi

#make new folder with todays date and copy over files

mkdir /home/steve/Desktop/sf_MINT/"$(date +"%d-%m-%Y")"

cp ./*.7z /home/steve/Desktop/sf_MINT/"$(date +"%d-%m-%Y")"

cp ./*.efi /home/steve/Desktop/sf_MINT/"$(date +"%d-%m-%Y")"

cp ./*.iso /home/steve/Desktop/sf_MINT/"$(date +"%d-%m-%Y")"

ls -l /home/steve/Desktop/sf_MINT/"$(date +"%d-%m-%Y")"/*