Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on Grub. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/grub.e> # or at <http://angg.twu.net/e/grub.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.mailing-lists» (to "mailing-lists") # «.grub-debian» (to "grub-debian") # «.grub-shell-demo» (to "grub-shell-demo") # «.grub-shell» (to "grub-shell") # «.grub-emu» (to "grub-emu") # «.grub-upstream» (to "grub-upstream") # «.grub-modules» (to "grub-modules") # «.mail-about-chainloader» (to "mail-about-chainloader") # «.mail-about-chainloader-2» (to "mail-about-chainloader-2") # «.chainload-grub-to-grub» (to "chainload-grub-to-grub") # «.irc-channel» (to "irc-channel") # «.syslinux.cfg» (to "syslinux.cfg") # «.syslinux_configfile» (to "syslinux_configfile") # «.grub-2012» (to "grub-2012") # «.uuids» (to "uuids") # «.grub-adjust» (to "grub-adjust") # «.menu.lst» (to "menu.lst") # «.grub-floppy» (to "grub-floppy") # «.grub-floppy-old» (to "grub-floppy-old") # «.grub» (to "grub") # «.grub-src» (to "grub-src") # «.netbsd» (to "netbsd") # «.floppy_images» (to "floppy_images") # «.invaders» (to "invaders") # «.update-grub» (to "update-grub") # «.40_custom» (to "40_custom") # «.non-chainloader-usb» (to "non-chainloader-usb") # «.chainloader-usb» (to "chainloader-usb") # «.chainloader» (to "chainloader") # «.chainloader-old» (to "chainloader-old") # «.device.map» (to "device.map") # «.partition.map» (to "partition.map") # «.grub-install» (to "grub-install") # «.grub-install-old» (to "grub-install-old") # «.grub:find» (to "grub:find") # «.grub:setup» (to "grub:setup") # «.grub-1.95» (to "grub-1.95") # «.grub2» (to "grub2") # «.grub2-on-test.img» (to "grub2-on-test.img") # «.grub-on-hd-image» (to "grub-on-hd-image") # «.grub2-on-iso» (to "grub2-on-iso") # «.grub-on-iso-2018» (to "grub-on-iso-2018") # «.grub-pen-drive-2018» (to "grub-pen-drive-2018") # «.embedding-not-possible» (to "embedding-not-possible") # «.ext2-embedding-not-possible» (to "ext2-embedding-not-possible") # «.grub2-on-a-floppy» (to "grub2-on-a-floppy") # «.grub2-menu-interface» (to "grub2-menu-interface") # «.supergrubdisk» (to "supergrubdisk") # «.parsing-proc-cmdline» (to "parsing-proc-cmdline") # «.grub2-svn» (to "grub2-svn") # «.lua-support» (to "lua-support") # «.flavio-2012» (to "flavio-2012") # «.grub2-trisquel» (to "grub2-trisquel") # «.etc-grub.d» (to "etc-grub.d") # «.grub-efi» (to "grub-efi") # «.payloads» (to "payloads") # «.seabios» (to "seabios") # «.grub-install-target» (to "grub-install-target") # «.libreboot-irc» (to "libreboot-irc") # «.libreboot-x200» (to "libreboot-x200") # «.libreboot-x200-cbfs» (to "libreboot-x200-cbfs") # «.libreboot-x200-save-rom» (to "libreboot-x200-save-rom") # «.libreboot_grub.cfg» (to "libreboot_grub.cfg") # «.libreboot_grub.cfg-sda1» (to "libreboot_grub.cfg-sda1") # «.libreboot-change-grub.cfg» (to "libreboot-change-grub.cfg") # «.libreboot-change-grubtest.cfg» (to "libreboot-change-grubtest.cfg") # «.libreboot-grub-sda1» (to "libreboot-grub-sda1") # «.libreboot-grub-sda6» (to "libreboot-grub-sda6") # «.grub-install-sda6» (to "grub-install-sda6") # «.bootinfoscript» (to "bootinfoscript") # «.menuentry» (to "menuentry") # «.marking-grub.cfgs» (to "marking-grub.cfgs") # «.os-prober» (to "os-prober") ##### # # Grub mailing lists # 2018mai21 # ##### # «mailing-lists» (to ".mailing-lists") # https://lists.gnu.org/archive/html/grub-devel/ # https://lists.gnu.org/archive/html/help-grub/ # https://lists.gnu.org/mailman/listinfo/grub-devel # https://lists.gnu.org/mailman/listinfo/help-grub # https://www.gnu.org/software/grub/grub-mailinglist.html # https://mail.google.com/mail/ca/u/0/#inbox/163a41d35449abd6 welcome to help-grub 2018mai27 # https://lists.gnu.org/archive/html/help-grub/2018-05/msg00038.html # https://lists.gnu.org/archive/html/help-grub/2024-02/msg00007.html Booting an ISO file from GRUB ##### # # Grub packages in Debian # 2018mai21 # ##### # «grub-debian» (to ".grub-debian") # (find-zsh "installeddebs | sort | grep grub") # (find-zsh "availabledebs | sort | grep grub") # (find-sh "locate grub") # (find-zsh "apt-file search bin/grub") # (find-zsh "apt-file search grub-emu") grub-common grub-coreboot-bin grub-coreboot-dbg grub-coreboot grub-disk grub-doc grub-efi-amd64-bin grub-efi-amd64-dbg grub-efi-amd64 grub-efi-ia32-bin grub-efi-ia32-dbg grub-efi-ia32 grub-efi grub-emu-dbg grub-emu grub-firmware-qemu grub-gfxpayload-lists grub-ieee1275-bin grub-ieee1275-dbg grub-ieee1275 grub-imageboot grub-invaders grub-ipxe grub-legacy-doc grub-legacy-ec2 grub-linuxbios grub-pc-bin grub-pc-dbg grub-pc grub-rescue-pc grub-splashimages grub-theme-starfield grub-xen-bin grub-xen-dbg grub-xen grub2-common grub2-splashimages grub2 grub kde-config-grub2 pv-grub-menu sabily-grub-artwork # (find-man "1 grub-editenv") # (find-man "1 grub-file") # (find-man "1 grub-fstest") # (find-man "1 grub-glue-efi") # (find-man "1 grub-kbdcomp") # (find-man "1 grub-menulst2cfg") # (find-man "1 grub-mkfont") # (find-man "1 grub-mkimage") # (find-man "1 grub-mklayout") # (find-man "1 grub-mknetdir") # (find-man "1 grub-mkpasswd-pbkdf2") # (find-man "1 grub-mkrelpath") # (find-man "1 grub-mkrescue") # (find-man "1 grub-mkstandalone") # (find-man "1 grub-mount") # (find-man "1 grub-render-label") # (find-man "1 grub-script-check") # (find-man "1 grub-syslinux2cfg") # (find-man "8 grub-install") # (find-man "8 grub-macbless") # (find-man "8 grub-mkconfig") # (find-man "8 grub-mkdevicemap") # (find-man "8 grub-probe") # (find-man "8 grub-reboot") # (find-man "8 grub-set-default") # (find-man "8 update-grub") # (find-man "8 update-grub2") ##### # # grub shell demo # 2000dec10 # ##### # «grub-shell-demo» (to ".grub-shell-demo") #* tr T \\t > $EEG <<'---' help cat (hdT0,T0)/Tboot/Tgrub/ cat (hd0,0)/boot/grub/menu.lst root (hd1,T0) 0xFF root (hd1,0,a) 0xFF kernel (hd0,0)/boot/grub/kernel # boot chainloader (hd1,T0) quit --- eeg grub #* # (find-grubnode "") # (find-grubnode "Command-line-specific commands") # (find-grubnode "Command-line-specific commands" "Command: chainloader") # (find-grubnode "Command-line-specific commands" "Command: setup") # (find-grubnode "Command-line-specific commands" "Command: install") # (find-grubnode "Invoking grub-install") # (find-grubnode "Bootstrap tricks") ##### # # grub-emu # 2018mai21 # ##### # «grub-emu» (to ".grub-emu") # (find-status "grub-emu") # (find-vldifile "grub-emu.list") # (find-udfile "grub-emu/") # (find-man "1 grub-emu") # (find-man "1 grub-emu" "Texinfo") # Where are the texinfo docs? # https://unix.stackexchange.com/questions/110015/how-can-i-preview-the-grub2-boot-screen # https://askubuntu.com/questions/381613/how-to-return-from-grub-prompt-to-the-grub-menu # https://lists.gnu.org/archive/html/help-grub/2023-07/msg00009.html # https://lists.gnu.org/archive/html/help-grub/2023-07/msg00019.html normal user ##### # # Does the grub shell still exist in grub2? # 2018mai21 # ##### # «grub-shell» (to ".grub-shell") # https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux # http://gnu.huihoo.org/grub-0.90/html_chapter/grub_14.html # https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux # (find-grubnode "Changes from GRUB Legacy") ##### # # Grub sources upstream # 2018mai21 # ##### # «grub-upstream» (to ".grub-upstream") # https://www.gnu.org/software/grub/ # https://www.gnu.org/software/grub/grub-download.html # git://git.savannah.gnu.org/grub.git * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/grub/ cd ~/usrc/ git clone git://git.savannah.gnu.org/grub.git cd ~/usrc/grub/ ./autogen.sh |& tee oa ./configure |& tee oc make docs |& tee omd cd ~/usrc/grub/docs/ make |& tee om # (find-grubsrcgrep "grep -nH -e doc Makefile") # (find-grubsrcgrep "grep -niH -e doc Makefile") # (find-grubsrcgrep "grep -nH -e SUBDIRS Makefile") # (find-grubsrcgrep "grep -nrH payload *") # (find-grubsrcgrep "grep -nrH 'unrecognised payload' *") # (find-grubsrcgrep "grep -nrH 'you need to load the kernel first' *") # (find-grubsrcgrep "grep --color -nH -e syslinux_configfile *") # (find-grubsrcgrep "grep --color -nRH -e syslinux_configfile *") # (find-fline "~/usrc/grub/") # (code-c-d "grubsrc" "~/usrc/grub/") # (find-grubsrcfile "") # (find-grubsrcfile "INSTALL") # (find-grubsrcsh "find * | sort") # (find-grubsrcsh "find * | sort | grep emu") # (find-grubsrcsh "find * | sort | grep chainload") # (find-grubsrcsh "find * | sort | grep module") # (find-grubsrcfile "grub-core/loader/i386/pc/chainloader.c") # (find-gitk "~/usrc/grub/") # (find-grubsrcfile "grub-core/osdep/unix/emuconsole.c") ##### # # grub modules # 2018mai27 # ##### # «grub-modules» (to ".grub-modules") # (find-grubsrcsh "find * | sort | grep chainload") # (find-grubsrcsh "find * | sort | grep module") # (find-grubsrcfile "grub-core/loader/i386/pc/chainloader.c") # (find-fline "/boot/grub/i386-pc/") ##### # # My e-mail to help-grub about chainloading # 2018mai27 # ##### # «mail-about-chainloader» (to ".mail-about-chainloader") # (find-es "live" "live-build-chrome") # (find-es "grub" "chainloader") # (find-es "grub" "grub-upstream" "payload") # (find-es "grub" "grub-modules") # (find-es "grub" "bootinfoscript") # (find-es "grub" "mailing-lists") # (find-sh "grub-install --help") # (find-sh "grub-install --version") # (find-librebootutilfile "libreboot-myrom/grub.cfg" "libreboot_grub.cfg") # http://lists.gnu.org/archive/html/help-grub/2018-05/threads.html # http://lists.gnu.org/archive/html/help-grub/2018-05/index.html # https://mail.google.com/mail/ca/u/0/#sent/163a44aa6fe01593 # http://lists.gnu.org/archive/html/help-grub/2018-05/msg00037.html my question # http://lists.gnu.org/archive/html/help-grub/2018-05/msg00038.html pascal's answer Subj: Chainloading on a LibreBoot X200 Hi List, I have a LibreBoot X200 - with its Grub in flash memory updated to the version from 20160907 - and I am not being able to make it boot a bootable pen drive by chainloading. Let me tell the whole story. I built the pen drive using live-build and this script (sorry for the format!): http://angg.twu.net/e/live.e.html#live-build-chrome The pen drive boots fine in my neighbor's computer, but when I try to make the grub from flash memory boot it by doing something like this (note: I tried several devices), set root=(usb0) chainloader +1 boot I get the error "unrecognised payload type"... I tried to add these commands, insmod chain insmod ntfs insmod ext2 but nothing changed; and I also tried to install a more recent grub in /dev/sda6 and chainload to it; grub is version "2.02~beta2-9ubuntu1.14+7.0trisquel5" here, and /dev/sda6 is my root partition nowadays (it is ext4). I tried this, sudo grub-install -v /dev/sda6 which gave this error: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged. Then I tried this, sudo grub-install -v --force /dev/sda6 and checked the installation with bootinfoscript, who said: sda6: _____________________________________________________________ File system: ext4 Boot sector type: Grub2 (v1.99) Boot sector info: Grub2 (v1.99) is installed in the boot sector of sda6 and looks at sector 102116496 of the same hard drive for core.img. core.img is at this location and looks in partition 112 for . Operating System: Trisquel GNU/Linux 7.0 Boot files: /boot/grub/grub.cfg /etc/fstab but when I try to chainload from the grub from flash memory to /dev/sda6 by doing something like this, insmod chain insmod ntfs insmod ext2 set root=(ahci0,6) chainloader +1 boot I also get the error "unrecognised payload type", plus "you need to load the kernel first"... Any hints? I really hope I'm missing something trivial... Cheers, Eduardo Ochs http://angg.twu.net/ ##### # # My e-mail to help-grub about chainloading: my answer # 2018mai30 # ##### # «mail-about-chainloader-2» (to ".mail-about-chainloader-2") Hi Pascal, > I guess the pendrive is set up to be booted from BIOS (or UEFI) ? > AFAIK BIOS chainloading works only if BIOS services are available. > Do Libreboot provide BIOS services and can its GRUB payload use them ? > The device names you use such (usb0) and (ahci0) indicate that GRUB > uses native (or coreboot ?) drivers, not BIOS drivers which would give > names such as (hd0). > > (...) > > I guess this is grub-pc (for BIOS) too ? > Maybe you need to use grub-coreboot ? > How do yo boot the main OS from Libreboot/GRUB payload ? sorry... it took me many hours of research, and some hours on the IRC channel, to understand that libreboot - that is coreboot-based - does have a chainloader command but it is not fully functional, and libreboot people are quite happy without chainloader because they have workarounds that I didn't understand before... Here are the working entries in my grub.cfg. To discover how to make an entry for booting the pen drive I had to understand the files in its isolinux/ directory, especially isolinux/live.cfg. menuentry 'Boot /dev/sda6 (with home on /dev/sda7)' --hotkey='m' { set root=(ahci0,6) linux /vmlinuz root=/dev/sda6 rw initrd /initrd.img boot } menuentry 'Boot a pen drive made with live-build without chainloading' --hotkey='b' { set root=(usb0,gpt1) linux /live/vmlinuz boot=live components quiet splash initrd /live/initrd.img boot } I've made a page about all this: http://angg.twu.net/grub.html Cheers and thanks =), Eduardo Ochs ##### # # chainload-grub-to-grub # 2023mar06 # ##### # «chainload-grub-to-grub» (to ".chainload-grub-to-grub") # https://lists.gnu.org/archive/html/help-grub/2023-03/msg00002.html ##### # # Irc channels: #grub and #libreboot # 2018mai26 # ##### # «irc-channel» (to ".irc-channel") # «libreboot-irc» (to ".libreboot-irc") # https://libreboot.org/ # https://webchat.freenode.net/?channels=libreboot # (find-rcirc-intro "5. `find-freenode-links'") # (find-freenode-links "l" "#libreboot") # (find-freenode-links "g" "#grub") (setq ee-freenode-ichannels "#eev #grub #libreboot") (defun g2 () (interactive) (find-freenode-2a "#grub")) (defun g3 () (interactive) (find-freenode-3a "#grub")) (defun l2 () (interactive) (find-freenode-2a "#libreboot")) (defun l3 () (interactive) (find-freenode-3a "#libreboot")) ##### # # syslinux.cfg # 2018mai22 # ##### # «syslinux.cfg» (to ".syslinux.cfg") # «syslinux_configfile» (to ".syslinux_configfile") # https://unix.stackexchange.com/questions/73564/chainload-syslinux-from-grub2-show-syslinux-cfg-menu # (find-grubsrcgrep "grep --color -nRH -e syslinux_configfile *") # (find-grubsrcgrep "grep --color -nRH -e grub_cmd_syslinux_source *") # (find-grubsrcfile "grub-core/commands/syslinuxcfg.c" "syslinux_configfile") ##### # # grub-2012 # 2012oct31 # ##### # «grub-2012» (to ".grub-2012") # (find-zsh "installeddebs | sort | grep grub") # (find-status "grub-common") # (find-vldifile "grub-common.list") # (find-udfile "grub-common/") # (find-status "grub-doc") # (find-vldifile "grub-doc.list") # (find-udfile "grub-doc/") # (find-status "grub-legacy-doc") # (find-vldifile "grub-legacy-doc.list") # (find-udfile "grub-legacy-doc/") # (find-status "grub-pc") # (find-vldifile "grub-pc.list") # (find-udfile "grub-pc/") unable to access dpkg status area: no such file or directory # (find-fline "/boot/") # (find-fline "/boot/grub/grub.cfg") ##### # # uuids # 2013sep09 # ##### # «uuids» (to ".uuids") # (find-fline "/etc/grub.d/") # (find-fline "/etc/grub.d/10_linux") # (find-fline "/etc/grub.d/10_linux" "GRUB_DISABLE_LINUX_UUID") # (find-fline "/etc/grub.d/README") # (find-fline "/etc/default/grub") # (find-fline "$ASROOT/etc/default/grub") # (find-node "(grub)Simple configuration") # (find-node "(grub)Simple configuration" "GRUB_DISABLE_LINUX_UUID") # (find-man "8 grub-mkconfig") # (find-node "(grub)Invoking grub-mkconfig") ##### # # Just recopy the new kernels and adjust menu.lst # 2000jul20 # ##### # «grub-adjust» (to ".grub-adjust") # (find-es "dpkg" "all-installed-.debs") # (find-fline "~/oinstalleddebs" "kernel-image") # (find-status "kernel-image-2.2.15") # (find-vldifile "kernel-image-2.2.15.list") # (find-fline "/usr/doc/kernel-image-2.2.15/") # (find-status "kernel-image-2.2.16-edrx") # (find-vldifile "kernel-image-2.2.16-edrx.list") # (find-fline "/usr/doc/kernel-image-2.2.16-edrx/") # (find-fline "/boot/") #* mount -o remount,rw /hda1 # mkdir -p /hda1/boot/grub/ cp -iv /boot/vmlinuz-2.2.16-edrx /hda1/boot/grub/ cp -iv /boot/vmlinuz-2.2.17-edrx /hda1/boot/grub/ cp -iv /boot/vmlinuz-2.2.18-edrx /hda1/boot/grub/ cp -iv /boot/vmlinuz-2.2.19-edrx /hda1/boot/grub/ cp -iv /gnu/boot/gnumach.gz /hda1/boot/grub/ cp -iv /gnu/boot/serverboot.gz /hda1/boot/grub/ cp -iv /gnu/boot/servers.boot /hda1/boot/grub/ cp -iv /freebsd/boot/{loader*,support.4th} /hda1/boot/grub/ cp -iv /freebsd/kernel /hda1/boot/grub/ #* # «menu.lst» (to ".menu.lst") mount -o remount,rw /hda1 cat > /hda1/boot/grub/menu.lst <<'---' timeout 5 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.19-edrx kernel (hd0,0)/boot/grub/vmlinuz-2.2.19-edrx root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.18-edrx kernel (hd0,0)/boot/grub/vmlinuz-2.2.18-edrx root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.17-edrx kernel (hd0,0)/boot/grub/vmlinuz-2.2.17-edrx root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.16-edrx kernel (hd0,0)/boot/grub/vmlinuz-2.2.16-edrx root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz kernel (hd0,0)/boot/grub/vmlinuz root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.4xx kernel (hd0,0)/boot/grub/vmlinuz-2.4xx root=/dev/hdd8 ro vga=1 title GNU/Hurd kernel (hd0,0)/boot/hurd-new/gnumach.gz root=device:hd0s2 module (hd0,0)/boot/hurd-new/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume) module (hd0,0)/boot/hurd-new/ld.so.1 /hurd/exec $(exec-task=task-create) title GNU/Hurd (using gnumach-edrx) kernel (hd0,0)/boot/hurd-new/gnumach-edrx.gz root=device:hd0s2 module (hd0,0)/boot/hurd-new/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume) module (hd0,0)/boot/hurd-new/ld.so.1 /hurd/exec $(exec-task=task-create) title GNU/Hurd (old, using serverboot) kernel (hd0,0)/boot/grub/gnumach.gz root=hd0s2 module (hd0,0)/boot/grub/serverboot.gz title NetBSD ELF (use "wd2a", "wd2b", generic) kernel --type=netbsd (hd0,0)/boot/grub/netbsd title The NetBSD "boot" file (not working) kernel (hd0,0)/boot/grub/netbsd_boot title RH 6.1 root=/dev/hdd5 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.12-20 kernel (hd0,0)/boot/grub/vmlinuz-2.2.12-20 root=/dev/hdd5 ro vga=1 title FreeBSD (hd1,0,a) 0xFF root (hd1,0,a) 0xFF kernel (hd0,0)/boot/grub/kernel title FreeBSD (hd2,2,a) 0xFF root (hd2,2,a) 0xFF kernel (hd0,0)/boot/grub/kernel title FreeBSD.angg (hd2,2,a) 0xFF root (hd2,2,a) 0xFF kernel (hd0,0)/boot/grub/kernel.ANGG title FreeBSD loader (use "show", "set currdev=disk2s1a", and "boot") root (hd1,0,a) 0xFF kernel (hd0,0)/boot/grub/loader title FreeBSD loader (hd2,2,a) root (hd2,2,a) 0xFF kernel (hd0,0)/boot/grub/loader title Invaders kernel (hd0,0)/boot/grub/invaders --- #* ##### # # grub floppy # 2004dec14 # ##### # «grub-floppy» (to ".grub-floppy") #* # (find-grubnode "Creating a GRUB boot floppy") # (find-fline "/lib/grub/i386-pc/") dd if=/dev/zero of=/tmp/floppy.img bs=1024 count=1440 cd /lib/grub/i386-pc/ dd if=stage1 of=/tmp/floppy.img bs=512 count=1 dd if=stage2 of=/tmp/floppy.img bs=512 seek=1 #* # (find-man "1 qemu") cd /tmp/linux-test/ qemu -m 64 -dummy-net \ -fda /tmp/floppy.img -boot a #* -kernel bzImage-2.4.21 \ -append "root=/dev/hda" linux.img ##### # # grub floppy # 2000aug12 # ##### # «grub-floppy-old» (to ".grub-floppy-old") #* superformat -V /dev/fd0 hd #* cd /hda1/boot/grub/ # dd if=stage1 of=/dev/fd0 bs=512 count=1 mcopy stage2 a: laf #* # (find-grubnode "Installation") # (find-grubnode "") # (find-grubnode "Automated install" "install (fd0)+1") # (find-grubnode "Commands" "install STAGE1-FILE") # (find-grubnode "Commands" "install STAGE1-FILE" "`d'") # (find-grubnode "Commands" "install STAGE1-FILE" "`p'") # (find-grubnode "Filename syntax") # (find-grubnode "Installing GRUB on a floppy") cd /hda1/boot/grub/ mcopy stage1 a: mcopy stage2 a: grub --batch <<'---' root (fd0) install (fd0)/stage1 (fd0) (fd0)/stage2 p quit --- #* install (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 p # (find-man "8 mke2fs" "Force") # From a mail by Okuji in the bug-grub list, circa 2000oct17: #* rm -Rv /tmp/grubflo/ mkdir /tmp/grubflo/ cd /tmp/grubflo/ dd if=/dev/zero of=floppy bs=512 count=2880 mke2fs -F floppy mount -o loop floppy /mnt mkdir -p /mnt/boot/grub/ cp -a /hda1/boot/grub/{*stage*,gnumach.gz,server*} /mnt/boot/grub/ # (to "menu.lst") cat > /mnt/boot/grub/menu.lst <<'---' timeout 5 title GNU/Hurd kernel (fd0)/boot/grub/gnumach.gz root=hd0s2 module (fd0)/boot/grub/serverboot.gz --- ls -lAF /mnt/boot df | grep -v /dev/hd umount /mnt echo "(fd0) /tmp/grubflo/floppy" > /tmp/map grub --device-map=/tmp/map --config-file='(fd0)/boot/grub/menu.lst' #* ##### # # grub # 2000jun17 # ##### # «grub» (to ".grub") # (find-status "grub") # (find-vldifile "grub.list") # (find-fline "/usr/share/doc/grub/") # (find-fline "/usr/share/doc/grub/README.debian" "copy the binary files") # (find-fline "/usr/share/grub/i386-pc/") #* mount -o remount,rw /hda1 rm -R /hda1/boot/grub/ mkdir /hda1/boot/grub/ cp -iv /usr/share/grub/i386-pc/* /hda1/boot/grub/ cp -iv /vmlinuz /hda1/boot/grub/ cp -iv /hdc5/boot/gnumach.gz /hda1/boot/grub/ cp -iv /hdc5/boot/serverboot.gz /hda1/boot/grub/ insmod ufs mount /hdd9 cp -iv /hdd9/kernel /hda1/boot/grub/freebsdkernel #* # (find-fline "/usr/share/doc/grub/menu.lst") cat > /hda1/boot/grub/menu.lst <<'---' timeout 5 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz kernel (hd0,0)/boot/grub/vmlinuz root=/dev/hdd8 ro vga=1 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz kernel (hd0,0)/boot/grub/vmlinuz root=/dev/hdd8 ro vga=1 title FreeBSD (hd2,2,a) root (hd2,2,a) kernel (hd0,0)/boot/grub/freebsdkernel title GNU/Hurd kernel (hd0,0)/boot/grub/gnumach.gz root=hd2s5 module (hd0,0)/boot/grub/serverboot.gz title GNU/Hurd single-user kernel (hd0,0)/boot/grub/gnumach.gz root=hd2s5 -s module (hd0,0)/boot/grub/serverboot.gz --- # (find-grubnode "Installation under UNIX" "/sbin/grub --batch") grub --batch <<'---' install (hd0,0)/boot/grub/stage1 (hd0) (hd0,0)/boot/grub/stage2 p (hd0,0)/boot/grub/menu.lst quit --- #* # But I haven't been able to configure freebsd's rootdev, # it always complains about not finding what it wants in "wd0s1`". # Partition check: (oops - date for this?) # hda: hda1 hda2 hda3 hda4 < hda5 hda6 > # hdc: hdc1 hdc2 hdc3 hdc4 < hdc5 hdc6 > # hdd: hdd1 hdd2 hdd3! hdd4 < hdd5 hdd6 hdd7 hdd8 > < hdd9 hdd10 hdd11 hdd12 > ##### # # grub source # 2000jul01 # ##### pdsc $SDEBIAN/dists/potato/main/source/base/grub_0.5.93.1.dsc cd /usr/src/grub-0.5.93.1/ debian/rules binary |& tee odr # strace -o ~/s grub/grub # The newly-compiled grub can read all my partions without disk errors # under Linux, but not when I boot using it... Try "cat (hd0,<tab>" in # both versions... # (code-c-d "grub" "/usr/src/grub-0.5.93.1/") # (find-grubfile "") # (find-grubfile "stage2/common.c" "Partition table invalid or corrupt") # (find-grubfile "stage2/disk_io.c" "ERR_BAD_PART_TABLE") # (find-grubfile "stage2/disk_io.c" '* 2 "ERR_BAD_PART_TABLE") # (find-grubfile "stage2/disk_io.c" '* 3 "ERR_BAD_PART_TABLE") cd /usr/src/grub-0.5.93.1/ for i in $(find * -name '*.c'); do echo "-- $i:" getstrings < $i | grep install done # (find-grubfile "stage2/builtins.c") # (find-grubfile "stage2/builtins.c" "struct builtin builtin_install =") # (find-grubfile "stage2/builtins.c" "install_func") # (find-grubfile "stage2/builtins.c" "install_func" "patched with new values") # It seems that I don't need to rerun Grub after changing my menu.lst; # Grub remembers only its location (partition/path) and will reread it # from there every time it boots. ##### # # grub 0.90 # 2001oct26 # ##### # «grub-src» (to ".grub-src") #* pdsc $SDEBIAN/pool/main/g/grub/grub_0.90-12.dsc cd /usr/src/grub-0.90/ find * | grep '\.[chsS]$' > .files.chS etags $(<.files.chS) debian/rules binary |& tee odrb #* cd /usr/src/grub-0.90/ make install |& tee omi #* # (code-c-d "grub" "/usr/src/grub-0.90/" "/usr/src/grub-0.90/docs/grub") # (code-c-d "grub" "/usr/src/grub-0.90/" "grub") # (find-grubfile "") # (find-grubnode "Top") # (find-grubnode "Invoking grub-install") mount -o remount,rw /dev/hda1 strace-to ~/s \ grub-install --root-directory=/hda1/boot/grub /dev/hda1 grub-install --root-directory=/hda1/boot/grub /dev/hda cp -v /usr/lib/grub/i386-pc/* /hda1/boot/grub/ # (find-grubfile "stage2/start.S") ##### # # Grub and NetBSD # 2001oct26 # ##### # «netbsd» (to ".netbsd") # (find-grubnode "NetBSD") # (find-grubnode "kernel") # (find-grubfile "stage2/builtins.c" "\"netbsd\", 6") ##### # # Grub and FreeBSD (now via "loader") # 2000aug30 # ##### # (find-grubnode "FreeBSD") # (find-fline "/freebsd/boot/") # (find-fline "/freebsd/var/src/sys/") # (find-fline "/freebsd/var/src/sys/boot/forth/") # (find-fline "/freebsd/var/src/sys/boot/i386/loader/") # But how does the loader discover where's the BSD partition? ##### # # Making Grub treat files as floppy images # 2000oct11 # ##### # «floppy_images» (to ".floppy_images") # (find-grubfile "netboot/3c90x.txt" "floppy image") # (find-grubnode "Network") # (find-grubfile "") # (find-grubfile "netboot/") # (find-grubfile "netboot/README.netboot") # (find-node "(multiboot)OS image format") ##### # # etherboot # 2000oct13 # ##### #* rm -Rv /usr/src/etherboot-4.7.6/ cd /usr/src/ tar -xvzf $S/http/etherboot.sourceforge.net/etherboot-4.7.6.tar.gz cd /usr/src/etherboot-4.7.6/ #* cd /usr/src/etherboot-4.7.6/src/ make |& tee om # (find-ethbtfile "src/om") # (progn (find-ethbtfile "src/om") (wrap 0)) #* # (code-c-d "ethbt" "/usr/src/etherboot-4.7.6/") # (find-ethbtfile "") # (find-ethbtfile "mknbi-1.0/") # (find-ethbtfile "mknbi-1.0/spec.txt" "/* load address") # (find-ethbtfile "mknbi-1.0/first-dos.S" "simulating either a floppy drive or a hard disk") # (find-ethbtfile "doc/text/") # (find-ethbtfile "doc/text/spec.txt") # (find-ethbtfile "doc/text/spec.txt" '* 2 "jump") # (find-ethbtfile "RELNOTES" "handles ROM, Linux, FreeDOS, and DOS images") # (find-ethbtfile "contrib/hdload/petr.msg") # (find-ethbtfile "contrib/mntnbi/mntnbi.pl") # (find-ethbtfile "mknbi-1.0/first-dos.S") # (find-ethbtfile "mknbi-1.0/first-dos.S" "function 02: read disk") ##### # # netboot # 2000oct13 # ##### #* rm -Rv /usr/src/netboot/ cd /usr/src/ tar -xvzf $S/http/www.han.de/~gero/netboot/files/netboot-0.9.0e.tar.gz cd /usr/src/netboot/ # (code-c-d "netbt" "/usr/src/netboot/") # (find-netbtfile "") # (find-netbtfile "README" "subscribe netboot") # (find-netbtfile "bootrom/netdrvr/dossim/") # (find-netbtfile "mknbi-dos/") #* ##### # # DEBUG_PRINT # 2000oct19 # ##### # From a mail by Okuji in the bug-grub list, circa 2000oct19: debug C code by inserting grub_printf calls into some places. For example, you write this: #define DEBUG_PRINT(msg) \ grub_printf("DEBUG: line %d in %s: %s\n", \ __LINE__, __FILE__, (msg)) ... DEBUG_PRINT ("before foo"); foo (); DEBUG_PRINT ("after foo"); # (find-grubfile "NEWS" "mini-debug") zcatinfo /usr/share/info/grub > /tmp/grub.info # (find-fline "/tmp/grub.info") cd /usr/src/grub-0.5.95/ agrep -i debug $(find *) ##### # # invaders # 2001may19 # ##### # «invaders» (to ".invaders") # http://www.erikyyy.de/invaders/ # http://www.erikyyy.de/invaders/invaders-1.0.0.tar.gz #* rm -Rv /usr/src/invaders/ cd /usr/src/ tar -xvzf $S/http/www.erikyyy.de/invaders/invaders-1.0.0.tar.gz cd /usr/src/invaders/ rm -v invaders find *.[chS] | sort > .files.chS etags $(<.files.chS) ./compile.sh |& tee oc #* mount -o remount,rw /dev/hda1 cd /usr/src/invaders/ cp -v invaders /hda1/boot/grub/ #* # (code-c-d "invaders" "/usr/src/invaders/") # (find-invadersfile "") # (find-invadersfile "README") # (find-invadersfile "oc") # (find-invadersfile "boot.S") # (find-invadersfile "boot.S" "#include <multiboot.h>") # (find-invadersfile "multiboot.h") # (find-fline "/hda1/boot/grub/") # (find-node "(binutils)objcopy") # (find-status "grub-invaders") # (find-vldifile "grub-invaders.list") # (find-udfile "grub-invaders/") # (find-udfile "grub-invaders/changelog.Debian.gz") # (find-udfile "grub-invaders/examples/grub-menu.lst") # (find-udfile "grub-invaders/copyright") # (find-udfile "grub-invaders/README") # (find-fline "/etc/grub.d/22_invaders") # (find-fline "/boot/invaders.exec") # (find-fline "/boot/grub/grub.cfg") ##### # # cvs # 2000dec10 # ##### # (find-grubnode "Obtaining and Building GRUB" "cvs -d") #* mkdir -p ~/usrc/grub/cvs/ cd ~/usrc/grub/cvs/ export CVS_RSH="ssh" cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/grub co grub tar -cvzf grub-cvs.tar.gz grub/ #* cd ~/usrc/grub/ tar -xvzf cvs/grub-cvs.tar.gz #* # (code-c-d "grub" "~/usrc/grub/grub/") # (find-grubfile "") # (find-grubfile "docs/") # (find-grubfile "docs/menu.lst") ##### # # update-grub # 2004sep06 # ##### # «update-grub» (to ".update-grub") # (find-es "kernel" "update-grub") # (find-status "grub") # (find-vldifile "grub-common.list") # (find-vldifile "grub2-common.list" "/usr/sbin/update-grub") # (find-fline "/usr/doc/grub/") # (find-fline "/usr/sbin/update-grub") # (find-man "8 update-grub") # (find-fline "/sbin/update-grub") # (find-fline "/sbin/update-grub" "menu.lst") # (find-fline "/sbin/update-grub" "/boot/boot/grub") # (find-fline "/sbin/update-grub" "BEGIN AUTOMAGIC KERNELS LIST") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /tmp/grub.cfg sudo grub-mkconfig -o /tmp/grub.cfg # (find-asrootfile "/etc/grub.d/40_custom") # (find-fline "/boot/grub/grub.cfg.new") sudo /usr/sbin/update-grub # (find-tkdiff "/tmp/grub.cfg" "/boot/grub/grub.cfg") update-grub locate update-grub ##### # # /etc/grub.d/40_custom # 2020mar06 # ##### # «40_custom» (to ".40_custom") # (find-fline "/boot/grub/grub.cfg" "### BEGIN /etc/grub.d/40_custom ###") # (find-fline "/etc/grub.d/") # (find-fline "/etc/grub.d/README") # (find-fline "/etc/grub.d/40_custom") # (find-asrootfile "/etc/grub.d/40_custom") # (find-fline "/sda5/etc/grub.d/40_custom") menuentry 'Debian pen drive' --hotkey='d' { set root=(hd1) set root=(usb0) linux install.amd/vmlinuz initrd install.amd/initrd.gz } # (find-sh0 "mount -l | grep ' on / '") # (find-sh0 "lsblk --fs") menuentry '(Edrx) We are in /sda5/boot/grub/grub.cfg' { insmod ext2 } menuentry '(We are on Circe)' { echo 'We are on Circe' } ##### # # Booting a pen drive without using chainloader # 2018mai29 # ##### # «non-chainloader-usb» (to ".non-chainloader-usb") # (find-es "grub" "libreboot_grub.cfg-sda1") # (find-asrootfile "/tmp/sda1/boot/grub/libreboot_grub.cfg") # (find-asrootfile "/tmp/sda1/boot/grub/libreboot_grub.cfg" "non-chainloader-usb") # https://libreboot.org/docs/gnulinux/grub_boot_installer.html # https://libreboot.org/docs/gnulinux/grub_boot_installer.html#debian-or-devuan-net-install # https://libreboot.org/docs/gnulinux/grub_boot_installer.html#booting-isolinux-images-automatic-method # https://libreboot.org/docs/gnulinux/grub_boot_installer.html#booting-isolinux-images-manual-method # (find-pen-links) # (find-fline "/dev/disk/by-id/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) mkdir /tmp/pen/ sudo mount -o ro /dev/sdb1 /tmp/pen/ # For the pen drive made with: (find-es "live" "live-build-chrome") # (find-fline "/tmp/pen/") # (find-fline "/tmp/pen/isolinux/isolinux.cfg") # (find-fline "/tmp/pen/isolinux/menu.cfg") # (find-fline "/tmp/pen/isolinux/stdmenu.cfg") # (find-fline "/tmp/pen/isolinux/live.cfg") # (find-fline "/tmp/pen/isolinux/live.cfg" "append boot=live") # (find-fline "/tmp/pen/isolinux/advanced.cfg") sudo umount /tmp/pen sync ##### # # Using chainloader to boot pen drives # 2018mai23 # ##### # «chainloader-usb» (to ".chainloader-usb") # «chainloader» (to ".chainloader") # https://superuser.com/questions/349633/boot-from-usb-using-grub # https://help.ubuntu.com/community/BootFromUSB # (find-grubnode "chainloader") # (find-grubnode "chainloader" "+1") # (find-grubnode "Chain-loading") # (find-grubnode "Special environment variables" "root") # (find-grubnode "Special environment variables" " root") # (find-grubnode "root") set root=(hd1,1) chainloader +1 boot ##### # # grub chainloading (old) # 2004sep11 # ##### # «chainloader-old» (to ".chainloader-old") # (find-grubnode "chainloader") # (find-grubnode "Chain-loading") # (find-grubnode "Invoking grub-install") # (find-grubnode "Invoking the grub shell") # (find-fline "/sbin/grub-install") # (find-fline "/sbin/grub-install" "grub_shell=${sbindir}/grub") ##### # # the device map # 2004sep11 # ##### # «device.map» (to ".device.map") # (find-grubnode "Basic usage" "`--device-map=FILE'") # (find-grubnode "Device map") # (find-fline "/sbin/grub-install" "device_map=${grubdir}/device.map") #* zcatinfo /usr/share/info/grub > /tmp/grub.info # (find-fline "/tmp/grub.info") #* # (find-fline "/sbin/grub-install" "# Create the device map file") # (find-fline "/usr/sbin/grub-install") rm -v /tmp/device.map echo quit \ | /sbin/grub --batch --device-map=/tmp/device.map cat /tmp/device.map #* ### The result will typically be something like this: # (fd0) /dev/fd0 # (hd0) /dev/hda # (hd1) /dev/hdb # «partition.map» (to ".partition.map") # Is there a way to produce a "partition map"? # Grub gives non-linuxish names to logical partitions and BSD partitions. # A workaround: # add a "/.id" file to each partition. # (find-angg ".zshrc" "partitionids") # Grub is able to browse and cat files. # (find-grubnode "cat") #* cat > $EEG <<'%%%' cat (hd0,0)/.id cat (hd0,1)/.id cat (hd0,2)/.id cat (hd0,3)/.id quit %%% # eeg grub --batch --device-map=/tmp/device.map eeg grub --device-map=/tmp/device.map #* ##### # # CDs with grub # 2004sep11 # ##### # (find-grubnode "Making a GRUB bootable CD-ROM") # mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ # -boot-load-size 4 -boot-info-table -o grub.iso iso # (find-man "mkisofs" " -b eltorito_boot_image") # (find-man "mkisofs" " -no-emul-boot") # (find-fline "/lib/grub/i386-pc/" "stage2") ##### # # grub-install # 2018mai23 # ##### # «grub-install» (to ".grub-install") # (find-grubnode "Installing GRUB using grub-install") # (find-grubnode "Invoking grub-install") ##### # # grub-install (old) # 2004sep13 # ##### # «grub-install-old» (to ".grub-install-old") # (find-grubnode "Installing GRUB using grub-install") # (find-grubnode "Invoking grub-install") # (find-fline "/sbin/grub-install" "# Create the device map file") #* cat > /tmp/dummygrubshell <<'%%%' #!/bin/sh -- echo Args: $* cat %%% chmod 777 /tmp/dummygrubshell rm -Rv /tmp/grubroot mkdir /tmp/grubroot #* mkdir -p /tmp/grubroot/boot/grub/ cd /tmp/grubroot/boot/grub/ rm -v device.map echo quit \ | sudo /sbin/grub --batch --device-map=device.map cat device.map #* # (find-fline "/sbin/grub-install" "The file $file not read correctly.") # (find-fline "/sbin/grub-install" "log_file") # (find-fline "/tmp/") grub-install --grub-shell=/tmp/dummygrubshell --root-directory=/tmp/grubroot \ /dev/hda2 #* # «grub:find» (to ".grub:find") # (find-grubnode "Installing GRUB natively" "not sure which partition" "find") # (find-grubnode "find") # (find-fline "/hda2/.id") cat /hda2/.id cat > $EEG <<'%%%' find /.id root (hd0,1) cat /.id quit %%% eeg sudo grub --device-map=/tmp/device.map #* # «grub:setup» (to ".grub:setup") # (find-grubnode "Installation under UNIX") # (find-grubnode "Installing GRUB natively" "instead of putting it in the MBR") # (find-grubnode "setup") # (find-grubnode "install") # (find-grubnode "Images") mkdir -p /hda2/boot/grub/ cp -v /lib/grub/i386-pc/* /hda2/boot/grub/ #* cat /hda2/.id cat > $EEG <<'%%%' root (hd0,1) cat /.id setup (hd0,1) quit %%% eeg sudo grub --device-map=/tmp/device.map #* # (find-fline "/hda1/boot/grub/menu.lst") # (find-fline "/hda2/boot/grub/menu.lst") cat > /hda2/boot/grub/menu.lst <<'%%%' title Linux root=/dev/hdb3 kernel=(hd1,2)/vmlinuz root (hd1,2) kernel /boot/vmlinuz-2.4.26-1-386 root=/dev/hdb3 ro initrd /boot/initrd.img-2.4.26-1-386 title chainloader /dev/hda chainloader (hd0)+1 title halt halt %%% #* # (find-status "grub") # (find-vldifile "grub.list") # (find-udfile "grub/") # (find-node "(grub)Installing GRUB natively" "setup") grub> root (hd0,0) If you are not sure which partition actually holds this directory, use the command `find' (*note find::), like this: grub> find /boot/grub/stage1 This will search for the file name `/boot/grub/stage1' and show the devices which contain the file. Once you've set the root device correctly, run the command `setup' (*note setup::): grub> setup (hd0) This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If you want to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into which you want to install GRUB: grub> setup (hd0,0) # (find-grubnode "Basic usage" "`--read-only'") # (find-man "grub-install") # (find-fline "/hdb2/wdc1/boot/grub/boot/grub/device.map") zcatinfo /usr/share/info/grub > /tmp/grub.info # (find-fline "/tmp/grub.info") ##### # # grub 1.95 (upstream) # 2007feb06 # ##### # «grub-1.95» (to ".grub-1.95") # http://en.wikipedia.org/wiki/GNU_GRUB # http://www.gnu.org/software/grub/ # http://www.gnu.org/software/grub/grub-2.en.html # http://www.gnu.org/software/grub/grub-2-download.en.html # ftp://alpha.gnu.org/gnu/grub/grub-1.95.tar.gz #* rm -Rv ~/usrc/grub-1.95/ tar -C ~/usrc/ -xvzf $S/ftp/alpha.gnu.org/gnu/grub/grub-1.95.tar.gz cd ~/usrc/grub-1.95/ # ./configure --help |& tee och ./configure |& tee oc make |& tee om #* # (code-c-d "grub2" "~/usrc/grub-1.95/") # (find-grub2sh "find | sort") # (find-grub2file "") # (find-grub2file "INSTALL" "LZO") # (find-grub2file "configure.ac" "-llzo2") # (find-debpkg-links "lzop") # (find-debpkg-links "liblzo-dev") # (find-grubsh "find") (find-zsh "grep-available lzo") ##### # # grub2 (upstream, CVS) # 2007sep25 # ##### # «grub2» (to ".grub2") # http://grub.enbug.org/ # http://grub.enbug.org/MailingLists # http://lists.gnu.org/mailman/listinfo/grub-devel # http://lists.gnu.org/archive/html/grub-devel/ #* rm -Rv ~/usrc/grub2/ mkdir ~/usrc/grub2/ cd ~/usrc/ tar -C ~/usrc/ -xvzf ~/tmp/grub2-cvs.tar.gz cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/grub co grub2 cd ~/usrc/ tar -cvzf ~/tmp/grub2-cvs.tar.gz grub2/ cd ~/usrc/grub2/ #* rm -Rv ~/usrc/grub2/ mkdir ~/usrc/grub2/ cd ~/usrc/ tar -C ~/usrc/ -xvzf ~/tmp/grub2-cvs.tar.gz cd ~/usrc/grub2/ find * | sort > .files find * -name '*.[ch]' | sort > .files.ch # My question: # Installing grub on an HD image # http://lists.gnu.org/archive/html/grub-devel/2007-09/msg00039.html # An answer: # [PATCH] do not require that device is a partition # http://lists.gnu.org/archive/html/grub-devel/2007-10/msg00030.html # http://lists.gnu.org/archive/html/grub-devel/2007-10/txtDXw8NsjObG.txt # (find-grub2file "normal/misc.c" "dev->disk->has_partitions") cp -iv normal/misc.c normal/misc.c.orig # patch -p0 normal/misc.c <<'%%%' # 43c43 # < else if (! dev->disk || ! dev->disk->has_partitions || dev->disk->partition) # --- # > else # %%% etags $(cat .files.ch) ./configure --help |& tee och mkdir ~/usrc/grub2/ulocal ./configure --prefix=$PWD/ulocal --enable-grub-emu |& tee oc make |& tee om make install |& tee omi #* # (code-c-d "grub2" "~/usrc/grub2/" :grep) # (find-grub2file ".files.ch") # (find-grub2file ".files") # (find-grub2file "") # (find-grub2file "och") # How to make grub2 work without (global) installation? # (find-grub2file "configure.ac") # (find-grub2file "grub-install") # (find-grub2file "grub-install" "prefix=/usr/local") # (find-grub2file "grub-install" "uses grub-setup to install grub") # (find-grub2file "grub-setup") # Aha: --prefix=$PWD/ulocal # (find-grub2grep "grep -nH -e modules $(cat .files.ch)") # (find-grub2grep "grep -nH -e device-map $(cat .files.ch)") # «grub2-on-test.img» (to ".grub2-on-test.img") # (find-es "plurall" "loop-fdisk-mke2fs") * (eepitch-shell) cd ~/usrc/grub2/ ./grub-install ./grub-install /tmp/test.img ./grub-install /tmp/test.img --root-directory=/tmp/dev1/boot/grub/ ./grub-install /tmp/test.img --root-directory=/tmp/dev1/boot/grub/ --modules= # ./grub-install $(cat /tmp/test.dev0) --root-directory=/tmp/dev1/ # grub-probe: error: cannot find a GRUB drive for /dev/hda1. # Auto-detection of a filesystem module failed. # Please specify the module with the option `--modules' explicitly. # (find-grub2file "") # (find-grub2grep "grep -nH -e modules $(cat .files.ch)") # (find-grub2file "grub-install" "--modules=MODULES") # (find-grub2file "grub-install" "Please specify the module") # (find-grub2file "grub-install" "$grub_probe --target=fs") # (find-grub2file "ulocal/lib/grub/i386-pc/") # (find-grub2file "boot/i386/pc/diskboot.S") # (find-grub2file "om") # (find-grub2file "util/grub-probe.c") sudo mkdir /tmp/dev1/boot/ sudo chown edrx:edrx /tmp/dev1/boot/ # /home/edrx/usrc/grub2(edrx:pe)# ./grub-install /tmp/test.img --root-directory=/tmp/dev1/boot/ # grub-probe: error: cannot find a GRUB drive for /dev/loop5. # Auto-detection of a filesystem module failed. # Please specify the module with the option `--modules' explicitly. # /home/edrx/usrc/grub2(edrx:pe)# # (find-grub2file "util/grub-probe.c") # (find-grub2file "util/grub-probe.c" "--target=") ##### # # Installing grub on an HD image # 2007oct05 # ##### # «grub-on-hd-image» (to ".grub-on-hd-image") # My question: # Installing grub on an HD image # http://lists.gnu.org/archive/html/grub-devel/2007-09/msg00039.html # An answer: # [PATCH] do not require that device is a partition # http://lists.gnu.org/archive/html/grub-devel/2007-10/msg00030.html # http://lists.gnu.org/archive/html/grub-devel/2007-10/txtDXw8NsjObG.txt ##### # # Grub2 on an ISO image # 2007oct29 # ##### # «grub2-on-iso» (to ".grub2-on-iso") # http://lists.gnu.org/archive/html/grub-devel/2007-08/msg00064.html # http://lists.gnu.org/archive/html/grub-devel/2007-08/msg00072.html # http://www.gnu.org/software/grub/manual/html_node/ ##### # # Grub on ISO (2018) # 2018mai01 # ##### # «grub-on-iso-2018» (to ".grub-on-iso-2018") # https://www.linuxjournal.com/content/grub-boot-iso ##### # # grub on a pen drive (2018) # 2018mai19 # ##### # «grub-pen-drive-2018» (to ".grub-pen-drive-2018") # https://www.pendrivelinux.com/install-grub2-on-usb-from-ubuntu-linux/ # (find-es "loop" "two-partitions") # (find-grubnode "Installing GRUB using grub-install" "--removable") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-man "dd") mount rm -v /tmp/pengrub1 rm -v /tmp/pengrub2 mkdir /tmp/pengrub1 mkdir /tmp/pengrub2 rm -v /tmp/pengrubs dd bs=1M count=100 if=/dev/zero of=/tmp/pengrubs laf -h /tmp/pengrubs sudo losetup /dev/loop4 /tmp/pengrubs sudo fdisk /dev/loop4 n p 1 +50M p n p 2 p w # (find-man "8 partprobe") sudo partprobe /dev/loop4 sudo mke2fs /dev/loop4p1 sudo mke2fs /dev/loop4p2 sudo losetup --detach /dev/loop4 # (find-man "8 partx" "are in 512-byte sectors") sudo partx --show /dev/loop4 sudo losetup /dev/loop4 /tmp/pengrubs sudo mount -o loop /dev/loop4p1 /tmp/pengrub1 sudo mount -o loop /dev/loop4p2 /tmp/pengrub2 # (find-grubnode "Invoking grub-install") sudo grub-install /dev/loop4 # sudo grub-install /dev/pengrub1 # (find-fline "/tmp/pengrub1/") # (find-fline "/tmp/pengrub2/") sudo umount /tmp/pengrub1 sudo umount /tmp/pengrub2 sudo losetup --detach /dev/loop4 qemu-system-x86_64 -usb \ -usbdevice disk:format=raw:/tmp/pengrubs ##### # # grub-install: warning: File system `ext2' doesn't support embedding. # 2018mai19 # ##### # «embedding-not-possible» (to ".embedding-not-possible") # «ext2-embedding-not-possible» (to ".ext2-embedding-not-possible") # (find-grubnode "BIOS installation") # Installing for i386-pc platform. # grub-install: warning: File system `ext2' doesn't support embedding. # grub-install: error: embedding is not possible, but this is required for cross-disk install. # https://unix.stackexchange.com/questions/174206/warning-file-system-ext2-doesnt-support-embedding-but-my-system-isnt-emb # https://superuser.com/questions/1213962/archlinux-installation-file-system-ext2-doest-support-embedding # (find-fline "~/LOGS/20180521.grub") <edrx> Hi... I am trying to build, for tests, a pen drive with two partitions and a grub in each one - and each of these grubs will have the option to chainload to the one in the other partition. Actually I am reworking scripts that I made a few years ago, that I didn't comment enough and that became unreadable with time... <edrx> I am using this to create two partitions on a loop device: http://angg.twu.net/e/loop.e.html#two-partitions <edrx> question: is it ok to format the partitions as ext2? what filesystem do you suggest? I got this warning... "grub-install: warning: File system `ext2' doesn't support embedding." # (find-fline "~/usrc/grub/") # (find-anggfile "usrc/grub/util/setup.c" "Partition style `%s' doesn't support embedding") # (find-anggfile "usrc/grub/util/setup.c" "File system `%s' doesn't support embedding") ##### # # Grub2 on a floppy image # 2007oct29 # ##### # «grub2-on-a-floppy» (to ".grub2-on-a-floppy") # Adapted from: # http://grub.enbug.org/TestingOnX86 # That page ("TestingOnX86") has a link to this mailing list message: # http://lists.gnu.org/archive/html/grub-devel/2004-09/msg00111.html # and the mailing list message contains a grub.cfg, that has these lines: # # #GNU/Linux # insmod linux # insmod boot # insmod multiboot # (find-fline "~/usrc/grub2/") # (find-grub2sh "./grub-mkimage -h") # (find-grub2sh "./grub-setup -h") # (find-man "8 mkdosfs") # (find-man "8 mkdosfs" "-C" "Create the file") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo umount /tmp/floppy cd ~/usrc/grub2/ ./grub-mkimage -d . -v -o /tmp/core.img _chain fat /sbin/mkdosfs -C /tmp/floppy.img 1440 mkdir /tmp/floppy/ sudo mount -o loop /tmp/floppy.img \ /tmp/floppy/ sudo mkdir -p /tmp/floppy/boot/grub/ sudo cp -v boot.img /tmp/core.img *.mod /tmp/floppy/boot/grub/ echo "(fd0) /tmp/floppy.img" \ > /tmp/device.map sudo ./grub-setup -v -r "(fd0)" \ -d /tmp/floppy/boot/grub/ \ -m /tmp/device.map \ "(fd0)" cat > /tmp/menu.lst <<'%%%' timeout 5 title Linux root=/dev/hdd8 kernel=(hd0,0)/boot/grub/vmlinuz-2.2.19-edrx kernel (hd0,0)/boot/grub/vmlinuz-2.2.19-edrx root=/dev/hdd8 ro vga=1 %%% sudo cp -v /tmp/menu.lst /tmp/floppy/boot/grub/ # What is grub.cfg? # test -f grub.cfg && sudo cp -f grub.cfg /mnt/loop/boot/grub/ sudo umount /tmp/floppy # (find-man "1 qemu") qemu -m 64 -fda /tmp/floppy.img ##### # # The command-line and menu interfaces in grub2 # 2007oct29 # ##### # «grub2-menu-interface» (to ".grub2-menu-interface") # Does grub2 have a CLI with tab completion and a menu interface like # grub-legacy? Yes, it's at normal/menu.c, but it's not running, it # seems - # (find-node "(grub)Command-line interface") # (find-node "(grub)Menu interface") # (find-grub2grep "grep -niH -e tab $(find *.c)") # (find-grub2grep "grep -niH -e 'list devices or files' $(find *)") # (find-grub2file "kern/rescue.c" "list devices or files") # (find-grub2grep "grep -niH -e 'grub_rescue_cmd_ls' $(find *)") # (find-grub2file "kern/rescue.c" "grub_rescue_cmd_ls" "print_devices") # (find-grub2file "ChangeLog") # (find-grub2file "ChangeLog" "When \"menu\" is not set") # (find-grub2file "normal/menu.c") # (find-grub2file "normal/completion.c") # (find-grub2file "normal/") # (find-grub2file "") # (find-grub2file "om") # Also: just "ls" is not printing any devices, just a blank line... ##### # # SuperGrubDisk # 2007oct29 # ##### # «supergrubdisk» (to ".supergrubdisk") # http://geocities.com/supergrubdisk/ # http://supergrub.forjamari.linex.org/ # https://listas.ensanjose.net/pipermail/supergrub/ # https://listas.ensanjose.net/pipermail/supergrub-es/ # http://forjamari.linex.org/projects/supergrub/ # http://forjamari.linex.org/frs/download.php/687/sgd_0.9664.iso.bz2 # http://forjamari.linex.org/frs/download.php/692/sgd_public_source_code_0.9664.tar.bz2 #* tar -tvjf $S/http/forjamari.linex.org/frs/download.php/692/sgd_public_source_code_0.9664.tar.bz2 #* bzcat $S/http/forjamari.linex.org/frs/download.php/687/sgd_0.9664.iso.bz2 > /tmp/sgd.iso #* rm -Rf /tmp/sgd_public_source_code_0.9664/ tar -C /tmp/ -xvjf $S/http/forjamari.linex.org/frs/download.php/692/sgd_public_source_code_0.9664.tar.bz2 cd /tmp/sgd_public_source_code_0.9664/ #* # (find-fline "/tmp/sgd_public_source_code_0.9664/") # (code-c-d "sgd" "/tmp/sgd_public_source_code_0.9664/") # (find-sgdfile "") # (find-sgdfile "boot/grub/") # It uses grub-legacy... # (find-sgdfile "dev_grub/ChangeLog") # 2013: # http://www.supergrubdisk.org/ ##### # # parsing /proc/cmdline # 2007oct29 # ##### # «parsing-proc-cmdline» (to ".parsing-proc-cmdline") # (find-fline "/proc/cmdline") # (find-sh "cat /proc/cmdline | tr ' ' '\n'") # The entries in /proc/cmdline are separated by spaces, not by NULLs. # On persephone: # auto BOOT_IMAGE=Linux ro root=301 # On an isolinux CD booting the Debian Etch DVD kernel and initrd: # vga=normal initrd=/initrd.gz -- BOOT_IMAGE=/vmlinuz ##### # # grub2: svn # 2008oct18 # ##### # «grub2-svn» (to ".grub2-svn") #* rm -Rfv ~/usrc/grub2/ mkdir ~/usrc/grub2/ cd ~/usrc/grub2/ tar -xvzf ~/tmp/grub2-svn.tgz svn info svn://svn.sv.gnu.org/grub/trunk/grub2 svn co svn://svn.sv.gnu.org/grub/trunk/grub2 tar -cvzf ~/tmp/grub2-svn.tgz grub2/ #* rm -Rfv ~/usrc/grub2/ mkdir ~/usrc/grub2/ tar -C ~/usrc/grub2/ -xvzf ~/tmp/grub2-svn.tgz cd ~/usrc/grub2/grub2/ ./configure |& tee oc make |& tee om # sudo make install #* # (code-c-d "grub2" "~/usrc/grub2/grub2/") # (find-grub2file "") cd ~/usrc/grub2/ ##### # # Lua support in grub-extras # 2011jan13 / 2020feb12 # ##### # «lua-support» (to ".lua-support") # (find-zsh "installeddebs | sort | grep grub") # (find-zsh "availabledebs | sort | grep grub") # https://superuser.com/questions/1088228/how-can-i-add-lua-support-to-grub2-or-at-least-file-copy-functionality *** # https://stackoverflow.com/questions/23670015/how-to-use-grub2-extra-lua-module # http://linux.xvx.cz/2010/03/using-grub2-and-lua-installed-on-usb.html # https://lists.gnu.org/archive/html/grub-devel/2009-11/msg00153.html # https://grub-devel.gnu.narkive.com/jS9DbziO/roadmap-for-lua-support-in-grub#post2 # https://launchpad.net/~grub-lua/+archive/ubuntu/grub * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "/tmp/grub-e/") rm -Rv /tmp/grub-e/ mkdir /tmp/grub-e/ cd /tmp/grub-e/ git clone git://git.sv.gnu.org/grub.git cd grub git clone git://git.sv.gnu.org/grub-extras.git 3) Edit autogen.sh to add grub-extras into the build by adding this: export GRUB_CONTRIB=/<absolute pathname to>/grub/grub-extras 4) Now build grub2 as you normally would: ./autogen.sh ./configure make make install ##### # # Ajuda pro Flavio # 2012oct17 # ##### # «flavio-2012» (to ".flavio-2012") # (find-grubnode "Commands") (hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) # (find-fline "/boot/grub/grub.cfg") /dev/sda1 (hd0,1) fat (dell utility) /dev/sda2 (hd0,2) ntfs, label "RECOVERY" /dev/sda3 (hd0,3) ntfs, label "OS" /dev/sda5 (hd0,5) ext2 / /dev/sda6 (hd0,6) ext2 - vmlinuz e pouca coisa a mais insmod part_msdos insmod ext2 set root=(hd0,5) linux /vmlinuz root=/dev/sda5 rw single initrd /initrd.img boot # http://www.cyberciti.biz/tips/10-boot-time-parameters-you-should-know-about-the-linux-kernel.html # http://oreilly.com/linux/excerpts/9780596100797/kernel-boot-command-line-parameter-reference.html http://www.supergrubdisk.org/wiki/Howto_Boot_Windows_without_problems http://www.cyberciti.biz/faq/grubconf-for-windows-vista-or-xp-dual-boot/ (hd0,6)/vmlinuz... ##### # # Grub2 on Trisquel # 2016feb13 # ##### # «grub2-trisquel» (to ".grub2-trisquel") # (find-es "kernel" "kernel-parameters") # (find-fline "/etc/grub.d/") # (find-fline "/etc/grub.d/README") # (find-asrootfile "/etc/grub.d/01_PASSWORD") # (find-fline "/etc/grub.d/05_debian_theme") # (find-fline "/etc/grub.d/06_trisquel_theme") # (find-fline "/etc/grub.d/10_linux") # (find-fline "/etc/grub.d/20_linux_xen") # (find-fline "/etc/grub.d/30_os-prober") # (find-fline "/etc/grub.d/30_uefi-firmware") # (find-fline "/etc/grub.d/40_custom") # (find-fline "/etc/grub.d/41_custom") # (find-zsh "installeddebs | sort | grep grub") # (find-zsh "availabledebs | sort | grep grub") # (find-available "grub-imageboot") # (find-status "grub-common") # (find-vldifile "grub-common.list") # (find-udfile "grub-common/") # (find-status "grub-gfxpayload-lists") # (find-vldifile "grub-gfxpayload-lists.list") # (find-udfile "grub-gfxpayload-lists/") # (find-status "grub-pc-bin") # (find-vldifile "grub-pc-bin.list") # (find-udfile "grub-pc-bin/") # (find-status "grub-pc") # (find-vldifile "grub-pc.list") # (find-udfile "grub-pc/") # (find-status "grub2-common") # (find-vldifile "grub2-common.list") # (find-udfile "grub2-common/") # (find-fline "/etc/init.d/grub-common") # (find-sh "find /etc/ | sort | grep grub") # (find-fline "/usr/share/bug/grub2-common/script") # (find-fline "/usr/share/bug/grub2-common/presubj") # (find-fline "/usr/share/grub/default/grub") # (find-fline "/usr/share/grub/default/grub.md5sum") # (find-node "(grub)Top") # (find-node "(grub-dev)Top") # (find-man "8 update-grub") # (find-man "8 update-grub2") # (find-fline "/usr/sbin/update-grub") # (find-fline "/usr/sbin/update-grub2") # (find-man "8 grub-install") # (find-fline "/usr/sbin/grub-install") # (find-man "8 grub-reboot") # (find-fline "/usr/sbin/grub-reboot") # (find-man "8 grub-set-default") # (find-fline "/usr/sbin/grub-set-default") # (find-udfile "grub2-common/") # (find-udfile "grub2-common/examples/") # (find-udfile "grub2-common/examples/grub.cfg") # (find-udfile "grub2-common/examples/grub.cfg" "root=") # (find-es "kernel" "kernel-parameters") # (find-fline "/boot/grub/") # (find-asrootfile "/boot/grub/") # (find-asrootfile "/boot/grub/grub.cfg") ##### # # The files in /etc/grub.d # 2020feb12 # ##### # «etc-grub.d» (to ".etc-grub.d") # (find-fline "/sda1/boot/grub/grub.cfg") # (find-fline "/sda1/boot/grub/grub.cfg" "/etc/grub.d/40_custom") # (find-asrootfile "/sda1/boot/grub/grub.cfg" "/etc/grub.d/40_custom") # (find-asrootfile "/sda5/boot/grub/grub.cfg" "/etc/grub.d/40_custom") # (find-asrootfile "/sda4/boot/grub/grub.cfg" "/etc/grub.d/40_custom") # (find-asrootfile "/boot/grub/grub.cfg" "/etc/grub.d/40_custom") # (find-fline "/etc/grub.d/") # (find-fline "/etc/grub.d/40_custom") # (find-fline "/etc/grub.d/README") # (find-fline "/boot/grub/grub.cfg") # (find-asrootfile "/etc/grub.d/40_custom") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo grub-install -v # grub-install: error: install device isn't specified. ##### # # grub-efi # 2018mai15 # ##### # «grub-efi» (to ".grub-efi") # (find-es "hd" "EFI") # (find-zsh "installeddebs | sort | grep grub") # (find-zsh "availabledebs | sort | grep grub-efi") # https://packages.debian.org/sid/grub-efi-amd64 # https://wiki.archlinux.org/index.php/GRUB/EFI_examples # https://en.wikipedia.org/wiki/GNU_GRUB # https://www.gnu.org/software/grub/grub-documentation.html # (find-node "(grub)Changes from GRUB Legacy" "GRUB Legacy: PC EFI") # (find-node "(grub)Installing GRUB using grub-install" "On EFI systems") # (find-node "(grub)BIOS installation" "(EFI)") # https://www.rodsbooks.com/efi-bootloaders/grub2.html # (find-status "efibootmgr") # (find-vldifile "efibootmgr.list") # (find-udfile "efibootmgr/") # (find-status "grub-efi-amd64-bin") # (find-vldifile "grub-efi-amd64-bin.list") # (find-udfile "grub-efi-amd64-bin/") # (find-status "grub-efi-amd64") # (find-vldifile "grub-efi-amd64.list") # (find-udfile "grub-efi-amd64/") # (find-status "grub-efi") # (find-vldifile "grub-efi.list") # (find-udfile "grub-efi/") # (find-fline "/usr/share/doc/" "grub-efi") # (find-man "8 efibootmgr") # (find-man "8 efibootmgr" "/sys/firmware/efi/vars") # (find-udfile "grub-efi-amd64-bin/examples/grub.cfg") # (find-fline "/sys/firmware/") sudo modprobe efivars ##### # # payloads # 2018mai28 # ##### # «payloads» (to ".payloads") # https://www.coreboot.org/Payloads # https://www.coreboot.org/Payloads#GRUB_2 # There are very few mentions of payloads in the manual... # (find-grubnode "Supported kernels") # (find-grubnode "Supported kernels" "payloads") # (find-grubnode "Chain-loading") # (find-grubnode "chainloader" "--force") # (find-grubnode "help") # (find-grubnode "Invoking grub-install") # (find-man "8 grub-install") # (find-man "8 grub-install" "--target=TARGET") # (find-grubsrcfile "") # (find-grubsrcsh "find * | sort") # (find-grubsrcsh "find * | sort | grep emu") # (find-grubsrcsh "find * | sort | grep chainload") # (find-grubsrcsh "find * | sort | grep module") # (find-grubsrcfile "grub-core/loader/i386/pc/chainloader.c") # (find-grubsrcfile "grub-core/loader/i386/pc/chainloader.c" "/* Check the signature. */") # (find-grubsrcfile "grub-core/loader/i386/pc/chainloader.c" "[--force|--bpb]") # Which file in the build tree is the boot sector/payload? # (find-fline "/boot/grub/") # (find-fline "/boot/grub/i386-pc/" "boot.img") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/grub/ find * -type f | sort file $(find * -type f | sort) |& tee of # (find-grubsrcfile "of") cut -b87- < of | sort | uniq # (find-grubsrcsh "cut -b87- < of | sort | uniq") # (find-grubsrcsh "cat of | grep data") cd ~/usrc/grub/; file $(find * -type f | sort) 2>&1 | tee of; cut -b87- < of | sort | uniq | tee oft # (find-sh "cd /boot/grub/i386-pc/ && file *") # (find-fline "/boot/grub/i386-pc/" "boot.img") # (find-fline "/boot/grub/i386-pc/" "core.img") ##### # # SeaBIOS # 2018mai28 # ##### # «seabios» (to ".seabios") # https://www.coreboot.org/SeaBIOS # http://www.seabios.org/ # https://www.seabios.org/SeaBIOS # (find-sh "locate -i seabios") # (find-status "seabios") # (find-vldifile "seabios.list") # (find-udfile "seabios/") ##### # # grub-install --target # 2018mai28 # ##### # «grub-install-target» (to ".grub-install-target") # (find-grubsrcsh "find * | sort") # (find-grubsrcgrep "grep -nrH -e i386-ieee1275 *") # (find-fline "~/LOGS/2018mai28.grub") # (find-fline "~/LOGS/2018mai28.grub" "i386-ieee1275") ##### # # The built-in grub in Libreboot X200 # 2018mai22 # ##### # «libreboot-x200» (to ".libreboot-x200") # (find-es "hardware" "X200") # https://mail.google.com/mail/ca/u/0/#search/leah+rowe/15e4af79d84ef544 # # https://libreboot.org/docs/gnulinux/ # # Specifically: # # https://libreboot.org/docs/gnulinux/grub_boot_installer.html # https://libreboot.org/docs/gnulinux/grub_cbfs.html # # If your order is that old, then you may also have an outdated version # of Libreboot. Refer to: # # https://libreboot.org/docs/#version # https://libreboot.org/docs/release.html # https://libreboot.org/docs/install/ * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) lsblk ##### # # The built-in grub in Libreboot X200: instructions in the "cbfs" page # 2018mai22 # ##### # «libreboot-x200-cbfs» (to ".libreboot-x200-cbfs") # (find-es "libreboot" "libreboot-util") # (find-angg ".emacs" "grub") # https://libreboot.org/docs/gnulinux/grub_cbfs.html # https://www.linuxjournal.com/content/libreboot-x60-part-iii-modify-boot-menu # (code-c-d "librebootutil" "~/usrc/libreboot_util/") # (code-c-d "librebootgrubs" "~/usrc/libreboot_util/libreboot_r20160907_grub_x200_8mb/") # (code-c-d "librebootgrub" "~/usrc/libreboot_util/libreboot-web/") # (find-librebootutilfile "") # (find-librebootgrubsfile "") # (find-librebootgrubfile "") # There's a "flashrom" in debian - from 2012, but it has a manpage. # https://www.flashrom.org/Flashrom # (find-status "flashrom") # (find-vldifile "flashrom.list") # (find-udfile "flashrom/") # (find-man "8 flashrom") # (find-man "8 flashrom" "-V, --verbose") # (find-man "8 flashrom" "-r, --read <file>") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # https://libreboot.org/docs/gnulinux/grub_cbfs.html#download-the-libreboot-utility-archive # https://www.mirrorservice.org/sites/libreboot.org/release/stable/20160907/libreboot_r20160907_util.tar.xz rm -Rfv ~/usrc/libreboot_r20160907_util/ rm -Rfv ~/usrc/libreboot_util/ tar -C ~/usrc/ -xvf \ $S/https/www.mirrorservice.org/sites/libreboot.org/release/stable/20160907/libreboot_r20160907_util.tar.xz mv -v ~/usrc/libreboot_r20160907_util \ ~/usrc/libreboot_util cd ~/usrc/libreboot_util/ # (find-librebootutilfile "") # (find-librebootutilfile "cbfstool/x86_64/" " cbfstool") # (find-librebootutilfile "flashrom/x86_64/") # You can find the flash chip size by running the following command: # flashrom -p internal -V # (find-man "8 flashrom" "-V, --verbose") sudo flashrom/x86_64/flashrom -p internal -V |& tee ofpiv # (find-librebootutilfile "ofpiv") # (find-librebootutilfile "ofpiv" "Found Macronix" "8192 kB") # https://libreboot.org/docs/gnulinux/grub_cbfs.html#create-an-image-from-the-current-rom # (find-man "8 flashrom" "-r, --read <file>") # cd ~/usrc/libreboot_util/ sudo flashrom/x86_64/flashrom -p internal -r libreboot-here.rom # https://libreboot.org/docs/gnulinux/grub_cbfs.html#download-a-pre-compiled-image-from-the-libreboot-website cd ~/usrc/libreboot_util/ # https://www.mirrorservice.org/sites/libreboot.org/release/stable/20160907/rom/grub/ # https://www.mirrorservice.org/sites/libreboot.org/release/stable/20160907/rom/grub/libreboot_r20160907_grub_x200_8mb.tar.xz cp -v $S/https/www.mirrorservice.org/sites/libreboot.org/release/stable/20160907/rom/grub/libreboot_r20160907_grub_x200_8mb.tar.xz . tar -xvf libreboot_r20160907_grub_x200_8mb.tar.xz # (find-librebootgrubsfile "") cp -v libreboot_r20160907_grub_x200_8mb/x200_8mb_ukqwerty_vesafb.rom \ libreboot-web.rom # (find-librebootutilfile "") # (find-librebootutilfile "" "libreboot-here.rom") # (find-librebootutilfile "" "libreboot-web.rom") # https://libreboot.org/docs/gnulinux/grub_cbfs.html#copy-grubtest.cfg-from-the-rom-image # (find-librebootutilsh "cbfstool/x86_64/cbfstool") # (find-librebootutilsh "cbfstool/x86_64/cbfstool" "print") # (find-librebootutilsh "cbfstool/x86_64/cbfstool" "extract") # (find-librebootutilsh "cbfstool/x86_64/cbfstool libreboot-here.rom print") # (find-librebootutilsh "cbfstool/x86_64/cbfstool libreboot-web.rom print") cd ~/usrc/libreboot_util/ rm -Rv libreboot-here/ mkdir libreboot-here/ mkdir libreboot-here/fallback/ FILES=( config revision grub.cfg grubtest.cfg fallback/romstage fallback/ramstage fallback/payload background.jpg ) for i in $FILES; do echo $i: cbfstool/x86_64/cbfstool \ libreboot-here.rom extract -m arm64 \ -n $i -f libreboot-here/$i echo "" done # (find-librebootutilfile "libreboot-here/") cd ~/usrc/libreboot_util/ rm -Rv libreboot-web/ mkdir libreboot-web/ mkdir libreboot-web/etc/ mkdir libreboot-web/fallback/ mkdir libreboot-web/img/ FILES=( config revision cmos.default cmos_layout.bin fallback/dsdt.aml bootorder etc/show-boot-menu etc/ps2-keyboard-spinup lbversion grub.cfg grubtest.cfg fallback/romstage fallback/ramstage fallback/payload img/grub2 background.jpg bootblock ) for i in $FILES; do echo $i: cbfstool/x86_64/cbfstool \ libreboot-web.rom extract -m arm64 \ -n $i -f libreboot-web/$i echo "" done # (find-librebootutilfile "libreboot-web/") # (find-librebootutilfile "libreboot-web/bootorder") # (find-librebootutilfile "libreboot-web/grub.cfg") # (find-librebootutilfile "libreboot-here/grub.cfg") # https://libreboot.org/docs/gnulinux/grub_cbfs.html#without-re-flashing-the-rom # https://libreboot.org/docs/gnulinux/grub_cbfs.html#flash-updated-rom-image # The last step of flashing the ROM requires us to change our current # working directory to libreboot_util: # # $ cd ~/Downloads/libreboot_util # # Now, all we have to do is use the flash script in this directory, with # the update option, using libreboot.rom as the argument: # # $ sudo ./flash update libreboot.rom # # Ocassionally, coreboot changes the name of a given board. If flashrom # complains about a board mismatch, but you are sure that you chose the # correct ROM image, then run this alternative command: # # $ sudo ./flash forceupdate libreboot.rom # # You will see the flashrom program running for a little while, and you # might see errors, but if it says Verifying flash... VERIFIED at the # end, then it's flashed, and should boot. If you see errors, try again # (and again, and again). The message, Chip content is identical to the # requested image is also an indication of a successful installation. # (find-librebootutilsh "sudo flashrom/x86_64/flashrom --help") # (find-librebootutilsh "sudo flashrom/x86_64/flashrom --help" "--write") # (find-librebootutilfile "flash") cd ~/usrc/libreboot_util/ sudo ./flash update libreboot-web.rom ##### # # Saving the image of the flash rom that came with the X200 # 2018mai22 # ##### # «libreboot-x200-save-rom» (to ".libreboot-x200-save-rom") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/libreboot_util/ Scp-np -v libreboot-here.rom edrx@angg.twu.net:/home/edrx/slow_html/tmp/libreboot-factory.rom Scp-np -v libreboot-here.rom edrx@angg.twu.net:/home/edrx/public_html/tmp/libreboot-factory.rom # (find-twusfile "tmp/" "libreboot-factory.rom") # (find-twupfile "tmp/" "libreboot-factory.rom") cd /tmp/ wget http://angg.twu.net/tmp/libreboot-factory.rom cmp /tmp/libreboot-factory.rom ~/usrc/libreboot_util/libreboot-here.rom cmp /tmp/libreboot-factory.rom ~/usrc/libreboot_util/libreboot-web.rom ##### # # Adding a "libreboot_grub.cfg" with my settings # 2018mai23 # ##### # «libreboot_grub.cfg» (to ".libreboot_grub.cfg") # «libreboot_grub.cfg-sda1» (to ".libreboot_grub.cfg-sda1") # (find-angg ".emacs" "grub") # (find-angg "grub/mygrub.cfg") # https://libreboot.org/docs/gnulinux/grub_cbfs.html#without-re-flashing-the-rom # (find-librebootgrubfile "grub.cfg") # (find-librebootgrubfile "grub.cfg" "function try_isolinux_config") # (find-librebootgrubfile "grub.cfg" "function try_isolinux_config" "libreboot_") # (find-librebootgrubfile "grub.cfg" "menuentry") # (find-librebootgrubfile "grub.cfg" "libreboot_") # (find-librebootgrubfile "menuentry") # (find-grubnode "menuentry") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) mount mkdir /tmp/sda1/ sudo mount /dev/sda1 /tmp/sda1/ # (find-fline "/tmp/sda1/") # (find-fline "/tmp/sda1/boot/grub/") # (find-asrootfile "/tmp/sda1/boot/grub/") # (find-asrootfile "/tmp/sda1/boot/grub/libreboot_grub.cfg") # Contents: # (find-es "grub" "libreboot_grub.cfg") menuentry 'Boot /dev/sda6 (with home on /dev/sda7)' --hotkey='m' { set root=(ahci0,6) # linux /vmlinuz root=/dev/sda6 rw linux /vmlinuz root=/dev/sda6 initrd /initrd.img boot } sudo umount /tmp/sda1 ##### # # Change the "grubtest.cfg" and "grub.cfg" in the flash rom # 2018mai23 # ##### # «libreboot-change-grub.cfg» (to ".libreboot-change-grub.cfg") # «libreboot-change-grubtest.cfg» (to ".libreboot-change-grubtest.cfg") # https://libreboot.org/docs/gnulinux/grub_cbfs.html#change-grubtest.cfg-in-rom * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/libreboot_util/ rm -Rv libreboot-myrom/ mkdir libreboot-myrom/ mkdir libreboot-myrom/etc/ mkdir libreboot-myrom/fallback/ mkdir libreboot-myrom/img/ FILES=( config revision cmos.default cmos_layout.bin fallback/dsdt.aml bootorder etc/show-boot-menu etc/ps2-keyboard-spinup lbversion grub.cfg grubtest.cfg fallback/romstage fallback/ramstage fallback/payload img/grub2 background.jpg bootblock ) for i in $FILES; do echo $i: cbfstool/x86_64/cbfstool \ libreboot-web.rom extract -m arm64 \ -n $i -f libreboot-myrom/$i echo "" done # (find-librebootutilfile "libreboot-myrom/grubtest.cfg") cd ~/usrc/libreboot_util/ cp -v libreboot-web.rom libreboot-myrom.rom cbfstool/x86_64/cbfstool libreboot-myrom.rom remove -n grubtest.cfg cbfstool/x86_64/cbfstool libreboot-myrom.rom add -n grubtest.cfg \ -f libreboot-myrom/grubtest.cfg -t raw # (find-librebootutilfile "libreboot-myrom/grub.cfg") cd ~/usrc/libreboot_util/ cp -v libreboot-web.rom libreboot-myrom.rom cbfstool/x86_64/cbfstool libreboot-myrom.rom remove -n grub.cfg cbfstool/x86_64/cbfstool libreboot-myrom.rom add -n grub.cfg \ -f libreboot-myrom/grub.cfg -t raw cd ~/usrc/libreboot_util/ sudo ./flash update libreboot-myrom.rom # (find-librebootutilfile "") # (find-sh "sudo fdisk -l /dev/sda") ##### # # Adding a grub to the /dev/sda6 partition and making it chainloadable # 2018mai24 # ##### # «libreboot-grub-sda1» (to ".libreboot-grub-sda1") # «libreboot-grub-sda6» (to ".libreboot-grub-sda6") # «grub-install-sda6» (to ".grub-install-sda6") # (find-grubnode "Images") # (find-grubnode "Images" "boot sector") # (find-grubnode "Device syntax" "boot sector") # (find-grubnode "Invoking grub-install") # (find-grubnode "Block list syntax") # (find-grubnode "Chain-loading") # (find-grubnode "Chain-loading" "root device") # (find-grubnode "GNU/Linux" "root device") # (find-man "8 grub-install") # (find-man "8 grub-install" "--force") # (find-man "8 grub-install" "-v, --verbose") # (find-man "8 grub-install" "--no-bootsector") # (find-grubnode "Invoking grub-install") # (find-sh "grub-install --help") # (find-sh "grub-install --help" "-v, --verbose") sudo grub-install /dev/sda6 sudo grub-install -v /dev/sda6 |& tee /tmp/ogi sudo grub-install -v --force /dev/sda6 |& tee /tmp/ogi # (find-fline "/tmp/ogi") # (find-fline "/tmp/ogi" "grub-mkimage") # (find-fline "/tmp/ogi" "--device-map='/boot/grub/device.map'") # grub-install: error: will not proceed with blocklists. # (find-anggfile "usrc/grub/util/setup.c" "blocklists are UNRELIABLE") # (find-grubsrcfile "util/setup.c") "Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged." # (find-fline "~/LOGS/2018mai26.grub") # (defun g () (interactive) (find-freenode-3a "#grub")) https://wiki.gentoo.org/wiki/GRUB2/Chainloading https://wiki.archlinux.org/index.php/GRUB https://www.linuxquestions.org/questions/debian-26/how-to-create-chainloading-in-grub2-917118/ https://richardfearn.wordpress.com/2008/03/14/chainloading-from-one-grub-to-another/ https://ubuntuforums.org/showthread.php?t=1952679 ##### # # bootinfoscript # 2018mai26 # ##### # «bootinfoscript» (to ".bootinfoscript") # http://bootinfoscript.sourceforge.net/ # https://github.com/arvidjaar/bootinfoscript # (find-status "boot-info-script") # (find-vldifile "boot-info-script.list") # (find-udfile "boot-info-script/") # (find-man "8 bootinfoscript") # (find-fline "/usr/sbin/bootinfoscript") # (find-sh "bootinfoscript -h") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo bootinfoscript /tmp/obis # (find-fline "/tmp/obis") ============================= Boot Info Summary: =============================== => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of the same hard drive for core.img. core.img is at this location and looks in partition 112 for . sda6: __________________________________________________________________________ File system: ext4 Boot sector type: Grub2 (v1.99) Boot sector info: Grub2 (v1.99) is installed in the boot sector of sda6 and looks at sector 102116496 of the same hard drive for core.img. core.img is at this location and looks in partition 112 for . Operating System: Trisquel GNU/Linux 7.0 Boot files: /boot/grub/grub.cfg /etc/fstab # (find-fline "/usr/sbin/bootinfoscript") # (find-fline "/usr/sbin/bootinfoscript" "# Display the boot sector type.") # (find-fline "/usr/sbin/bootinfoscript" "0020) BST='Grub2 (v1.99)'") ##### # # menuentry # 2020mar06 # ##### # «menuentry» (to ".menuentry") # (find-grubnode "menuentry") # (find-es "grub" "grub-upstream") # (find-grubsrcfile "grub-core/commands/menuentry.c") # (find-grubsrcgrep "grep --color -nRH -e grub_normal_add_menu_entry *") # (find-grubsrcgrep "grep --color -nRH -e grub_cmd_menuentry *") # (find-grubsrcgrep "grep --color -nRH -e grub_extcmd_context_t *") # (find-grubnode "source") # (find-grubnode "configfile") ##### # # Marking my "grub.cfg" files to distinguish their partitions # 2020mar06 # ##### # «marking-grub.cfgs» (to ".marking-grub.cfgs") # (find-grubnode "Configuration") # (find-fline "/boot/grub/grub.cfg" "Edrx") # (find-fline "/sda1/boot/grub/grub.cfg" "Edrx") # (find-fline "/sda4/boot/grub/grub.cfg" "Edrx") # (find-fline "/sda5/boot/grub/grub.cfg" "Edrx") # (find-asrootfile "/etc/grub.d/40_custom") # (find-asrootfile "/boot/grub/grub.cfg" "Edrx") # (find-asrootfile "/sda1/boot/grub/grub.cfg" "Edrx") # (find-asrootfile "/sda4/boot/grub/grub.cfg" "Edrx") # (find-asrootfile "/sda5/boot/grub/grub.cfg" "Edrx") # (find-fline "~/LOGS/2020mar05.grub") <edrx> hi all... my laptop has libreboot and three bootable partitions, at /dev/sda1 (Trisquel), /dev/sda4 (Debian), and /dev/sda5, and so it has at least four "grub.cfg"s - one in flash and the others in sda1, sda4, and sda5... <edrx> maybe there's also one in /dev/sda, but I don't even know how to access it if it exists <edrx> so - I decided to add an empty menuentry to each of the grub.cfgs that are easy to access, like this: <edrx> menuentry '(Edrx) We are in /sda5/boot/grub/grub.cfg' { <edrx> } <edrx> but when I navigate the grub menus on boot I can't see any of these entries <edrx> are empty menuentries ignored? <edrx> how does "menuentry" work? does it append a new entry to a list of entries that is displayed after the parsing of the config files? is there a command that empties that list? <edrx> I haven't been able to answers to this in the manual... I started here: <edrx> (info "(grub)menuentry") <edrx> https://www.gnu.org/software/grub/manual/grub/html_node/menuentry.html <edrx> I am also trying to understand this file in the source tree: grub-core/commands/menuentry.c ##### # # os-prober # 2022sep24 # ##### # «os-prober» (to ".os-prober") Setting up grub-pc (2.06-3~deb11u2) ... Installing for i386-pc platform. Installation finished. No error reported. Generating grub configuration file ... Found background image: /usr/share/images/desktop-base/desktop-grub.png Found linux image: /boot/vmlinuz-5.10.0-11-amd64 Found initrd image: /boot/initrd.img-5.10.0-11-amd64 Found linux image: /boot/vmlinuz-5.10.0-8-amd64 Found initrd image: /boot/initrd.img-5.10.0-8-amd64 Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. Found Debian GNU/Linux 11 (bullseye) on /dev/sda1 Found Debian GNU/Linux 10 (buster) on /dev/sda5 done # (find-fline "/usr/share/images/desktop-base/") # A very good message about trusted/treacherous Grub: # http://lists.gnu.org/archive/html/grub-devel/2007-10/msg00165.html # ``I can make arguments like these too: "A cluster bomb is a # technology. Like all technology, it has both benign and malignant # and antisocial usage cases."'' # http://www.pixelbeat.org/docs/disk/ # http://grub.enbug.org/TestingOnX86 Grub floppy: http://lists.gnu.org/archive/html/grub-devel/2008-09/msg00300.html init=/bin/sh: http://lists.gnu.org/archive/html/grub-devel/2008-10/msg00026.html # http://robertmh.wordpress.com/ # http://robertmh.wordpress.com/2009/08/05/my-view-on-linus-torvalds-statement/ # http://robertmh.wordpress.com/2008/02/03/debian-and-corporate-support/ https://help.ubuntu.com/community/Burg https://wiki.archlinux.org/index.php/Multiboot_USB_drive # Local Variables: # coding: utf-8-unix # End: