So I've compiled my kernel and initrd. How can I then create an image and install grub to actually load this image from a disk? My goal isn't to create a livecd out of it that is bootable from USB, as there are plenty of articles on that. My goal is to create an image (I know
dd if=/dev/zero of=linux.img ... is what I need to create an overall image) and simply write that image to the first sector of the disk using dd and have it just boot from there. However, where does my kernel and initrd go in that img? Right behind each other? This disk isn't going to have any partitions. It's a custom kernel and minimal busybox setup that is stripped down. I therefore do not need a /boot partition and all the "files" aren't going to live on another partition because there isn't going to be one or much of any files.
I know the MBR is 512 bytes and I assume
grub is also just going to overwrite 512 bytes to the first sector. But how do I even get grub installed on the image? Would
grub-install linux.img even work? I know that
grub knows where to load the kernel and initrd from a normal setup because those live in /boot but this "image" doesn't have partitions on it to look in
/boot . Do I just set root to itself?
Any help would be appreciated
Initrd creation procedure: https://pastebin.com/ti9LXakx
Current init script within initrd:
#!/bin/sh mount -t sysfs sysfs /sys mount -t proc proc /proc mount -t devtmpfs udev /dev exec /bin/sh