Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]HOWTO liveUSB with grub and serial console support
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
NiceGuy
Guru
Guru


Joined: 12 Jun 2006
Posts: 449
Location: Canada

PostPosted: Mon May 11, 2009 8:22 pm    Post subject: [SOLVED]HOWTO liveUSB with grub and serial console support Reply with quote

Hi everyone,

Just wanted to know if it was possible to convert the isolinux boot loader on the Gentoo minimal liveCD to the grub boot loader?
I would like to make a liveUSB.
Thanks
_________________
success is the ability to go from one failure to the next without any loss of enthusiasm


Last edited by NiceGuy on Tue May 12, 2009 6:56 pm; edited 2 times in total
Back to top
View user's profile Send private message
booleandomain
n00b
n00b


Joined: 02 May 2009
Posts: 62

PostPosted: Mon May 11, 2009 8:43 pm    Post subject: Reply with quote

I think all you have to do is:
1) mount the .iso image to /mnt/cdrom or something like that
2) mount your usb flash drive partition to /mnt/usb or something like that
3) copy everything from /mnt/cdrom to /mnt/usb
4) emerge --config grub and insert /mnt/usb as the path where to install files
5) configure /mnt/usb/boot/grub/grub.conf
Back to top
View user's profile Send private message
neysx
Retired Dev
Retired Dev


Joined: 27 Jan 2003
Posts: 795

PostPosted: Mon May 11, 2009 10:51 pm    Post subject: Reply with quote

Use unetbootin
Back to top
View user's profile Send private message
NiceGuy
Guru
Guru


Joined: 12 Jun 2006
Posts: 449
Location: Canada

PostPosted: Tue May 12, 2009 6:48 pm    Post subject: Reply with quote

Hi everyone,

I am spending sometime this afternoon closing some of my posts and passing on the information to all gentoo users. I decided to rename this post to "Build a gentoo liveUSB with grub serial console support".
My GOAL was to build a Gentoo LiveUSB that utilizes grub as its boot loader (not isolinux, etxlinux etc ... ) and with Serial Console support and Grub Serial Console Support (both @115200 baud)

Assumptions
* Note I assume your usb is /dev/sdb (changw where appropriate)
** Note I assume your usbstick is mounted at /media/disk (change where appropriate)

Prepare USB :
For < 4Gig USB disk
Code:
user@laptop$ mkdosfs -F 16 /dev/sdb1

For >= 4Gig USB disk
Code:
user@laptop$ mkdosfs -F 32 /dev/sdb1


First, to get grub the cd I had to remaster the iso
1. Download gentoo.iso
2. mount gentoo.iso /mnt/isoimage/ -t iso9660 -o loop
3. cp -rf /mnt/isoimage/* /media/disk
4. umount /mnt/isoimage
5. cd /media/disk
6. mkdir -p /home/squashfs
7. mkdir -p /mnt/newsquashfs
8. mount -t squashfs -o loop /media/disk/image.squashfs /mnt/newsquashfs
9. cp -rf /mnt/newsquashfs/* /home/newsquashfs
10. umount /mnt/squashfs
11. Edit /home/newsquashfs/etc/securetty to:
Code:
tt/s0
ttyS0

12. Edit /home/newsquashfs/etc/inittab
Code:
#SERIAL CONSOLE
s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 115200 ttyS0 vt100

13. cd /media/disk
14. rm image.squashfs
15 mksquashfs /home/newsquashfs image.squashfs
16. verify /media/disk
Code:
ls -l
username@laptop:$ ls /media/disk
gentoo.efimg  gentoo.efimg.mountPoint  image.squashfs  isolinux  livecd

17. For completness say hi to your cd/usb kernel ... labeled "gentoo" inside isolinux folder
Code:
user@laptop:$ ls /media/disk/isolinux
boot.cat  elilo.efi  gentoo  gentoo.igz  isolinux.bin  isolinux.cfg  memtest86  System.map-gentoo

18. From the home Gentoo system copy over the boot folder into /media/disk (aka usb) directory -- special thanks to DONAHUE from Goose Creek SC for step 16
Code:
user@laptop:$  cp -rf /boot .
echo "usbstick" > /media/disk/boot/grub/usbstick
ls -l  /media/disk                 # verify boot folder copied
ls -l  /media/disk/boot         # verify the boot folder contents
ls -l  /media/disk/boot/grub # verify the /boot/grub contents
grub
find /boot/usbstick
# return should be formatted like (hdx,y)
root (hdx,y) # substitute the returned digits for x,y
setup (hdx) # substitute the returned digits for x
quit

19. For this post ... verify /media/disk structure .. note the new boot directory added to the /media/disk folder
Code:
name@laptop:/media/disk$ ls
boot  gentoo.efimg  gentoo.efimg.mountPoint  image.squashfs  isolinux  livecd

20. USB directory structure (/media/disk/boot)
Code:

user@laptop:/media/usbdisk/boot$ ls
grub  usbstick

21. USB directory structure (/media/disk/boot/grub)
Code:
name@laptop:/media/usbdisk/boot/grub$ ls
e2fs_stage1_5  ffs_stage1_5   grub.conf         jfs_stage1_5  minix_stage1_5     stage1  stage2_eltorito  vstafs_stage1_5
fat_stage1_5   glidevice.map  iso9660_stage1_5  menu.lst      reiserfs_stage1_5  stage2  ufs2_stage1_5    xfs_stage1_5

20. Edit liveUSB /media/disk/boot/grub/grub.conf and /media/disk/boot/grub/menu.lst
Code:
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=15 serial console

default 0
timeout 10

title=USB disk - Serial Console
root(hd0,0)
kernel /isolinux/gentoo root=/dev/ram0 init=/linuxrc slowusb looptype=squashfs loop=/image.squashfs cdroot console=ttyS0,115200
initrd /isolinux/gentoo.igz

title=USB disk - Terminal
root(hd0,0)
kernel /isolinux/gentoo root=/dev/ram0 init=/linuxrc slowusb looptype=squashfs loop=/image.squashfs cdroot vga=791
initrd /isolinux/gentoo.igz


21. For gentoo forum completeness:
Of course I still had to modify the /etc/securetty to allow for ttyS0 and tts/0 logins
/etc/securetty
Code:
tts/0
ttyS0

I had to modify /etc/inittab
Code:
#SERIAL CONSOLE
s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 115200 ttyS0 vt100

22. umount /media/disk
23. Change BIOS to boot to USB HDD
24. Reboot
25. Done .. if all goes well you should have booted into the liveUSB

Really hope that helps at least one other person .. and if I made a mistake re-typing this I apologize in advance as I wrote this from pure memory
Thanks and enjoy
_________________
success is the ability to go from one failure to the next without any loss of enthusiasm
Back to top
View user's profile Send private message
pilla
Administrator
Administrator


Joined: 07 Aug 2002
Posts: 7209
Location: Pelotas, BR

PostPosted: Wed May 13, 2009 2:42 pm    Post subject: Reply with quote

Moved from Other Things Gentoo to Documentation, Tips & Tricks.
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
pilla
Administrator
Administrator


Joined: 07 Aug 2002
Posts: 7209
Location: Pelotas, BR

PostPosted: Wed May 13, 2009 2:44 pm    Post subject: Reply with quote

Moved from Other Things Gentoo to Documentation, Tips & Tricks.
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
BlackLodge
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2004
Posts: 131
Location: SP-Vig/IT-Ben

PostPosted: Tue May 08, 2012 2:17 pm    Post subject: Reply with quote

Hi,

I tried this method for building an USB bootable stick to run in a headless machine, but I'm stuck in the part where the grub is intalled to the MBR of the stick.

Are these lines still working?

Quote:

18. From the home Gentoo system copy over the boot folder into /media/disk (aka usb) directory -- special thanks to DONAHUE from Goose Creek SC for step 16
Code:

user@laptop:$  cp -rf /boot .
echo "usbstick" > /media/disk/boot/grub/usbstick
ls -l  /media/disk                 # verify boot folder copied
ls -l  /media/disk/boot         # verify the boot folder contents
ls -l  /media/disk/boot/grub # verify the /boot/grub contents
grub
find /boot/usbstick
# return should be formatted like (hdx,y)
root (hdx,y) # substitute the returned digits for x,y
setup (hdx) # substitute the returned digits for x
quit



If the bootable kernel is /media/disk/isolinux/gentoo , I don't get how is this location passed to grub :)
_________________
Linux, lass es einfach gehen!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum