make grub udisk manually

Below is the steps how to make grub udisk manually

my udisk is /dev/sdc

  1. clean udisk information(mbr and partition information)

sudo dd if=/dev/zero of=/dev/sdc bs=1M count=1024 oflag=direct

  1. create dos partition table

sudo fdisk /dev/sdc

o create a new empty DOS partition table
n -> p -> default->default->204800
a toggle a bootable flag
w write table to disk and exit

  1. sudo mkfs.ext4 /dev/sdc1
    sudo mount /dev/sdc1 /media/wrsadmin/boot/
    sudo grub-install --root-directory=/media/wrsadmin/boot/ /dev/sdc

Installing for i386-pc platform.
Installation finished. No error reported.

  1. vi grub.cfg, add your menuentry
    menuentry ‘wrlinux-nfs-dhcp-rootfs3’ {
    recordfail
    load_video
    gfxmode l i n u x g f x m o d e i n s m o d g z i o i f [ x linux_gfx_mode insmod gzio if [ x grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_msdos
    insmod ext2
    set root=‘hd0,msdos1’
    linux /boot/bzImage rootfstype=nfs root=/dev/nfs rw nfsroot=128.224.162.154:/nfsroot/rootfs3,vers=3 ip=dhcp console=ttyUSB0,115200n8
    }
    5.copy bzImage to /boot/bzImage
    6.set pc bios boot from udisk
  2. about the rootfs
    for arm, you can build one with busybox by yourself;
    for x86, you can use yocto to build one.
发布了31 篇原创文章 · 获赞 11 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/Hsu_smile/article/details/80925542