03.02.2017 23:49, Shaun Reitan пишет: > Andrei, > > Tried to build a kernel image using the following. > > ./bin/grub-mkstandalone -O i386-pc -o grub2.img grub.cfg --fonts="" > --locales="" --themes="" --install-modules="acpi adler32 affs ahci > all_video aout ata at_keyboard biosdisk blocklist boot bufio cat cbfs > cbls cbmemc cbtable cbtime chain cmosdump cmp configfile cpio_be cpio > cpuid crc64 cryptodisk crypto date datetime diskfilter disk div div_test > dm_nv drivemap echo efiemu ehci elf eval exfat exfctest ext2 extcmd fat > file gettext gfxmenu gfxterm_background gfxterm_menu gfxterm gptsync > gzio halt hashsum help iorw iso9660 keylayouts keystatus ldm legacycfg > legacy_password_test linux16 linux loadenv loopback lsacpi lsapm lsmmap > ls lspci lzopio macbless macho memdisk memrw minicmd mmap morse mpi > mul_test multiboot2 multiboot nativedisk net newc nilfs2 normal ntldr > odc offsetio ohci part_gpt password pata pcidump pci priority_queue > probe procfs random read reboot regexp relocator romfs scsi > search_fs_file search_fs_uuid search_label search sendkey serial setjmp > setpci shift_test signature_test sleep syslinuxcfg tar terminal terminfo > test_blockarg testload test tga time trig tr true udf uhci usb_keyboard > usb usbms usbtest vbe verify vga vga_text video_cirrus video xfs xzio" > > basically i took every module from the i386-pc/*.mod directory and > attempted to add it. The image was too large so i went through the > module list and removed stuff that i was pretty sure i didnt need. > > When i boot the image, i see nothing but the memdisk, i'm also in that > same grub2 shell. I should see a (hd0) along with my (memdisk) >
You need to include biosdisk into image (or in memory disk and load explicitly from grub.cfg). PC BIOS offers alternative disk driver so this is image-build-time option. bor@bor-Latitude-E5450:~/build/grub$ echo "insmod biosdisk" > /tmp/grub.cfg bor@bor-Latitude-E5450:~/build/grub$ pkgdatadir=$PWD ./grub-mkstandalone -d grub-core -O i386-pc -o grub.img --locales= --themes= --fonts= --install-modules="all_video boot btrfs cat chain configfile echo ext2 fat font gettext gfxmenu gfxterm gfxterm_background gzio halt hfsplus iso9660 jpeg keystatus loadenv loopback linux memdisk minicmd normal part_apple part_msdos part_gpt password_pbkdf2 png reboot search search_fs_uuid search_fs_file search_label sleep squash4 test true video zfs zfscrypt zfsinfo biosdisk echo linux linux16 ls" /boot/grub/grub.cfg=/tmp/grub.cfg bor@bor-Latitude-E5450:~/build/grub$ qemu-system-x86_64 -m 1G -device virtio-scsi-pci -drive file=/home/bor/vm/tw/hd0.img,if=none,id=hd0,discard=on,format=raw -device scsi-hd,drive=hd0 -drive file=/home/bor/vm/tw/test1.img,if=virtio,format=raw -drive file=/home/bor/vm/tw/test2.img,if=virtio,format=raw -net user -net nic,model=virtio -kernel grub.img And "ls" in CLI shows me all disks. Of course you also need to manually load suitable partition drivers to access partitions. Alternative is to use grub-mkstandalone ... --modules=biosdisk. May be we should add --disk-module option of grub-install to other high level tools. Oh, and $prefix in standalone image is set to (memdisk)/boot/grub, which means you need to put grub.cfg in /boot/grub if you want it to be executed automatically; you use graft syntax for this grub-mkstandalone ... /boot/grub/grub.cfg=/path/to/your/config/file _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
