Tiny Core Linux

Tiny Core Base => TCB Tips & Tricks => Topic started by: dmoerner on December 02, 2008, 03:29:39 PM

Title: Howto: Create Bootable USB Stick
Post by: dmoerner on December 02, 2008, 03:29:39 PM
This is a shameless modification of the old DSL instructions (written by SaidinUnleashed, to give full credit).  This was performed from a Debian Sid x86 system.  The USB stick is /dev/sdc1.

1) Install necessary tools.  On Debian this is syslinux, mtools, and dosfstools:

Code: [Select]
aptitude install syslinux mtools dosfstools
2) Partition the thumb drive.  I used fdisk to partition the thumb drive into one large FAT32 partition.  The following directions are from memory but should be correct.

Code: [Select]
umount /dev/sdc1 # Never use fdisk on a mounted partition
fdisk /dev/sdc1
d
1
d
2
d
3
d  # These commands delete all partitions currently on the device
n
p
1 # This makes a new primary partition
a
1 # This makes it bootable
t
1
b # This makes it FAT 32
w

Now, I always overwrite the drive's mbr in case it was used for booting from grub sometime in the past.  This is not normally necessary.

Code: [Select]
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdc
Now, make a FAT 32 partition:

Code: [Select]
mkfs.vfat -F 32 /dev/sdc1
3) Copy over the files

You will need to mount the iso image using loopback and then copy over the files.

Code: [Select]
mkdir /mnt/iso
mount -o loop tinycore_1.0rc1.iso /mnt/iso
mkdir /mnt/usb
mount /dev/sdc1 /mnt/usb
cp /mnt/iso/* /mnt/usb

4) Set up syslinux

Since the ISO uses isolinux, we will need to make some changes

Code: [Select]
mv /mnt/iso/boot/isolinux /mnt/iso/boot/syslinux
mv /mnt/iso/boot/syslinux/isolinux.cfg /mnt/iso/boot/syslinux/syslinux.cfg
rm -f /mnt/iso/boot/syslinux/isolinux.bin # This didn't stop it from working for me, but I'm not sure if this file is necessary.
syslinux /dev/sdc1

5) Cross your finger, unmount the flash drive, and reboot.  If you get an error like "image linux not found" when booting, you forgot to correctly rename the isolinux files to syslinux.

APPENDIX A: Using Grub

You can also use grub to manage booting the pendrive, as described at http://tinycorelinux.com/files/extensions/grub-0.97-splash.tce.info.  However, the process is a bit more involved than that.  After installing grub, you need to do the following:

Code: [Select]
mkdir -p /mnt/usb/boot/grub
rm -rf /mnt/usb/boot/isolinux
cp /usr/lib/grub/i386-pc/*stage* /mnt/usb/boot/grub
grub # now follow the instructions in the .info document
cat > /mnt/usb/boot/grub/menu.lst << EOF
default 0
timeout 5
title tinycorelinux
root (hdX,Y)
kernel /boot/bzImage quiet
initrd /boot/tinycore.gz
EOF

APPENDIX B: Persistent /home

I have not tested this yet, but if you want a persistent, encrypted /home on the thumb drive, the easy method would probably be to use fdisk to make one tiny FAT32 partition on the thumb drive and one larger ext2 partition.  Then specify the ext2 partition using the directions in the "help" file to use an encrypted home.

EDIT 12/2/08: Added grub appendix, corrently cited SaidinUnleashed after discussion on IRC :)
Title: Re: Howto: Create Bootable USB Stick
Post by: roberts on December 02, 2008, 09:20:51 PM
Bootable pendrive are always a challenge.

If the target is a bootable pendrive, then might try unetbootin from other OS (Windows or Linux).
It worked very for me:

1. format pendrive fat32 from other OS
2. download tc iso
3. run unetbootin

unetbootin is a single exe that does not need to be installed on the other OS.

Just choose iso image and specify full path
then specify the pendrive

After successful installation you can edit syslinux.cfg file to add/change boot options.

You can get unetbootin from:
http://unetbootin.sourceforge.net
Title: Re: Howto: Create Bootable USB Stick
Post by: SaidinUnleashed on December 03, 2008, 12:54:27 PM
Wow, that's useful, and much simpler than my hacked up w32 version of syslinux.

Editus: Except that I can't get it to boot...
Title: Re: Howto: Create Bootable USB Stick
Post by: paulc on December 05, 2008, 09:04:25 AM

Couldn't get the above going but did manage an "old style"  copy all files into the top directory of the pendrive and point the syslinux.cfg to the new location (i.e. delete /boot/ and directory structure). Then it flies...........

.......boots a variety of eBox's (including the 200MHz one) and an eee 701 beautifully.

Nice work.



Title: Re: Howto: Create Bootable USB Stick
Post by: cjgau on December 09, 2008, 11:14:11 AM
Unetbooting is really easy; I run it on my office M$ machine; and then boot my Asus901 right away under my desk. =o)

Thanks, Robert.
Title: Re: Howto: Create Bootable USB Stick
Post by: T_Hobbit on December 14, 2008, 07:16:10 AM
It works for me. Now, how can I make my USB stick boot with permanent definitions and programs and personal stuff?
Title: Re: Howto: Create Bootable USB Stick
Post by: jls on December 15, 2008, 06:14:03 AM
I installed unetbootin on the pendrive, it boots, but then nothing, it stops on the boot screen.
Title: Re: Howto: Create Bootable USB Stick
Post by: Juanito on December 15, 2008, 06:46:20 AM
I'm using extlinux.tce to create a bootable usb stick starting from a blank stick formatted ext2 - it works fine with freeware ext2 drivers in windows too.

/mnt/sda1/boot/tinycore.gz
/mnt/sda1/boot/bzImage
/mnt/sda1/boot/extlinux/extlinux.sys
/mnt/sda1/boot/extlinux/extlinux.conf

Quote
$ cat /mnt/sda1/boot/extlinux/extlinux.conf 

        kernel /boot/bzImage
        append initrd=/boot/tinycore.gz quiet vga=773 noswap laptop tce=sda1 waitusb=5 noscan text
Title: Re: Howto: Create Bootable USB Stick
Post by: T_Hobbit on December 17, 2008, 01:58:19 AM
If I create mydata.gz/tclocal/tce directory on my laptop HD and boot from CD I'm able to load my data and my programs.

If I boot from an USB stick made with unetbootin and create mydata.gz/tclocal/tce directory on the stick, after boot the definitions are lost.

How can this be solve so I can boot my USB stick and work directly with my files and programs?
Title: Re: Howto: Create Bootable USB Stick
Post by: curaga on December 17, 2008, 06:38:22 AM
Your usb stick might need an additional wait: add "waitusb=5" to your boot arguments, where 5 is the number of seconds to wait for slow usb devices.
Title: Re: Howto: Create Bootable USB Stick
Post by: T_Hobbit on December 17, 2008, 03:25:23 PM
Your usb stick might need an additional wait: add "waitusb=5" to your boot arguments, where 5 is the number of seconds to wait for slow usb devices.

I'm not sure if it was that or the tce=sda1 (or both) that solve the problem (will try each one separately), but it works now. Thanks a lot!

Next step: USB stick dual boot with Puppy!
Title: Re: Howto: Create Bootable USB Stick
Post by: jaygeetiny on February 04, 2009, 09:52:07 AM
Hi All

I'm a former DSL newbie and judged by my inability to achieve persistence with TC on a bootable USB stick I'm now a TC newbie as well :-(

Briefly; I've created a bootable 4GB USB stick using Unetbootin in WinXP - in fact I'm posting this via Opera 9.62 in Cloud/Internet mode - but I can't seem to get persistence in any of the available  modes.

Ideally I'd like to set up persitence in Mode 4 (PPI/TCE) and any help to achieve this along the lines of a dummies guide would be much appreciated.
Title: Re: Howto: Create Bootable USB Stick
Post by: cjgau on February 04, 2009, 11:01:59 AM
Did you try waitusb=7

Please refer to Robert's advice --- http://forum.tinycorelinux.net/index.php?topic=474.msg2969#msg2969
Title: Re: Howto: Create Bootable USB Stick
Post by: jaygeetiny on February 04, 2009, 03:55:00 PM
Did you try waitusb=7

Please refer to Robert's advice --- http://forum.tinycorelinux.net/index.php?topic=474.msg2969#msg2969

I've already set my PC's BIOS to a slow USB boot which copes with all the other distros I've tried. However if the TC waitusb=7 boot option has another function then I'll give it a try.

BTW I'm confused by the first post on the quoted link as the only place I can find any sort of similar reference is within the syslinux.cfg file on my USB stick which contains the following:

default vesamenu.c32

prompt 0
menu title UNetbootin
timeout 100

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit quiet

label ubnentry0
menu label tinycore
kernel /boot/bzImage
append initrd=/boot/tinycore.gz quiet
Title: Re: Howto: Create Bootable USB Stick
Post by: jaygeetiny on February 04, 2009, 04:49:39 PM
I tried the waitusb=7 boot option together with tclocal=sda1, downloaded a couple of TCE extensions, backed up to sda1 and rebooted to find no sign of the downloaded extensions on the menu bar or within the right click menu.

Until I can find a simple way of setting up persistence on a USB stick I'll content myself by playing with TC in Virtualbox within Hardy Heron.
Title: Re: Howto: Create Bootable USB Stick
Post by: Juanito on February 04, 2009, 07:43:06 PM
This is not exactly what you're looking for, but this works for me:
Code: [Select]
display boot.msg
default tc
label tc
kernel /boot/bzImage
append initrd=/boot/tinycore.gz quiet vga=773 noswap laptop tce=sda1 waitusb=5 noscan text


implicit 0
prompt 1
timeout 300
F1 boot.msg
F2 f2
F3 f3

i.e.

1. extensions in /mnt/sda1/tce loaded at boot
2. extensions in /mnt/sda1/tce/optional in app browser options menu

Note that I don't think "laptop" is needed anymore, but I didn't get around to removing it.
Title: Re: Howto: Create Bootable USB Stick
Post by: roberts on February 04, 2009, 08:30:08 PM
I tried the waitusb=7 boot option together with tclocal=sda1, downloaded a couple of TCE extensions, backed up to sda1 and rebooted to find no sign of the downloaded extensions on the menu bar or within the right click menu.

Until I can find a simple way of setting up persistence on a USB stick I'll content myself by playing with TC in Virtualbox within Hardy Heron.

There is no tclocal, it was a typo on the boot screen and has been corrected in RC and FAQ:
 tinycore local={hda1|sda1}          Specify PPI directory or loopback file.
Title: Re: Howto: Create Bootable USB Stick
Post by: jaygeetiny on February 05, 2009, 06:51:29 AM
This is not exactly what you're looking for, but this works for me:
Code: [Select]
display boot.msg
default tc
label tc
kernel /boot/bzImage
append initrd=/boot/tinycore.gz quiet vga=773 noswap laptop tce=sda1 waitusb=5 noscan text


implicit 0
prompt 1
timeout 300
F1 boot.msg
F2 f2
F3 f3

i.e.

1. extensions in /mnt/sda1/tce loaded at boot
2. extensions in /mnt/sda1/tce/optional in app browser options menu

Note that I don't think "laptop" is needed anymore, but I didn't get around to removing it.

Hi Juanito

Thanks for that.

I've managed to get USB stick persistence in PPR/TCE mode by adding the boot options "no swap tce=sda1 waitusb=7".

I'll stick to PPR/TCE mode for the moment and try other options later.


There is no tclocal, it was a typo on the boot screen and has been corrected in RC and FAQ:
 tinycore local={hda1|sda1}          Specify PPI directory or loopback file.

Hi roberts
 
The reference to "tclocal" is still shown on the http://www.tinycorelinux.com/concepts.html page which is the first point of contact for many new TC users. Is it possible to get the doc edited?

BTW being really pedantic the PPI/TCE para has the heading "The Forth Mode".


 
Title: Re: Howto: Create Bootable USB Stick
Post by: roberts on February 05, 2009, 08:24:14 AM
Thanks Jay, edits done.
Title: Re: Howto: Create Bootable USB Stick
Post by: 3rail on April 01, 2009, 11:17:46 AM
fwiw, I've spent the last couple of days playing around with tc linux and trying to get it to boot from a 2gb pendrive.  I used unetbootin at first, but it failed to boot too many times so I went with http://tinycorelinux.com/install.html (http://tinycorelinux.com/install.html) route instead with my 2gb pendrive acting as the "hard drive".

the two head scratchers I had to overcome to get a bootable usb with tc linux using those instructions:

1.  How to mount the live cd from within tc linux (answer after reading the forum: cat /etc/fstab [where is the d* cdrom drive?  oh, hda]; mount /dev/hda)
2.  Trying to figure out what the right grub incantation was for "sdb1".  I gave up and borrowed from http://lists.us.dell.com/pipermail/linux-poweredge/2003-July/008898.html (http://lists.us.dell.com/pipermail/linux-poweredge/2003-July/008898.html) (answer: set sdb as the root device: "Grub>device (hd0) /dev/sdb", then follow the rest of the grub installation instructions in http://tinycorelinux.com/install.html (http://tinycorelinux.com/install.html).

next was TCE persistence.  key to this one was the kernel line "waitusb=5 tce=sdb1/tce" and "pause" was a useful debugging tool too.  home persistence was easy with adding "home=sdb1".

Thanks for TinyCore, it's very cool!
Title: Re: Howto: Create Bootable USB Stick
Post by: Lee on April 01, 2009, 02:16:34 PM
Quote
BTW being really pedantic the PPI/TCE para has the heading "The Forth Mode".

Quote
Thanks Jay, edits done.

So there's really no Forth mode?  And I really wanted to do reverse-polish arithmetic.  :)


A one-time forth geek.

(File systems are for sissies)
Title: Re: Howto: Create Bootable USB Stick
Post by: cdr on June 14, 2009, 10:54:13 AM
I am surprised that in this discussion there was no mention of ziplinux.
That is the in doc section of the syslinux release.
The author implies that it is the only sure fire way to boot from flash media because of
geometry problems on the media, ie, the way out is to emulate a 250MB zip drive which
has disk geometry that can reliably be used on flash media with a small modification
to accound for the true size of the flash drive.

Any way, the short fille called ziplinux.txt explains it much better than I can.

Costa
Title: Re: Howto: Create Bootable USB Stick
Post by: linus72 on June 14, 2009, 11:10:04 AM
I simply used the aforementioned grub/usb install and it works awesome
Note, anyone interested I have available tc-1.4.3-usb ready to go for both grub/ext2-3 or syslinux/fat16/32 usb
simply plop the 2 download folders(boot & flavors) onto usb, install either grub or syslinux to usb and your set
I have also "flavor" modules pre-loaded with tce's too, just stick'em in flavors folder and go! ;)
this simplifies it all, and menu.lst/syslinux.cfg is already setup for diff usb names(sda1/sdc1/sdf1, etc)
syslinux.cfg even has sub-menu system for saving to hd, usb, or even tcvd(flavors)
( http://multidistro.com/downloads/tc_flavors/tc_flavors.html )
and cool screenshots of 2.0 here and 1.4.3 too
( http://multidistro.com/tinycore-shots/tc-scrnshots.html )

Distro of the Year?
TC hands down!:)
I'm getting ready to devote my whole site to tc!
Title: Re: Howto: Create Bootable USB Stick
Post by: roberts on June 14, 2009, 11:31:34 AM
I created both usbhdd and usbzip for DSL.
I am in the testing stage of porting both to TC.
Will likely be an extension.
Title: Re: Howto: Create Bootable USB Stick
Post by: Juanito on June 14, 2009, 08:33:10 PM
Could we have an option to create an ext2 usbhdd using the extlinux extension?
Title: Re: Howto: Create Bootable USB Stick
Post by: roberts on June 14, 2009, 08:52:09 PM
Will do.
Title: Re: Howto: Create Bootable USB Stick
Post by: Laskody on March 17, 2021, 10:18:11 AM
I want to ask an newbie question.  ::) If a newer version is released in the future, how can i create the core instalations image on a bootable usb?

(I created the current installation flash drive under a different system)

I'm looking for something like that

 "usb disk image recorder" that works on TC. :)  If in the future there would be only tc on the Computer.

 
Title: Re: Howto: Create Bootable USB Stick
Post by: NewUser on March 19, 2021, 12:36:09 AM
If you start from Windows machine, core2usb.
Title: Re: Howto: Create Bootable USB Stick
Post by: Laskody on March 19, 2021, 05:15:51 AM
Thank you, but My question is that, when If you only have Tiny Core linux on your machine and you want to create an tc installation usb from Iso.  :)
Title: Re: Howto: Create Bootable USB Stick
Post by: Juanito on March 19, 2021, 05:45:48 AM
You can use the tc-install extension.
Title: Re: Howto: Create Bootable USB Stick
Post by: Laskody on March 19, 2021, 06:56:26 AM
Thank you!