Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: edmenje on May 21, 2009, 08:57:48 PM

Title: help...step by step to make tcl persistent on USB/Quemu
Post by: edmenje on May 21, 2009, 08:57:48 PM
I downloaded Quemu for my usb to run TCL iso within windows.  Being a complete newbie, if someone could give me step by step process to set persistence so that I can boot up within Windows with all my apps, settings and files intact.  I have searched the wiki and forums for the info but most assume booting from USB rather than booting in a virtual machine.  Hope someone can help.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: roberts on May 21, 2009, 09:49:11 PM
Here is my tinycore.bat file to start Qemu Tiny Core on Windows with a Qemu created virtual harddisk
Code: [Select]
REM Start qemu on windows.
@ECHO OFF

START qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -localtime -soundhw es1370 -kernel bzImage -initrd tinycore.gz -hda qemu\harddisk -append "vga=791 quiet noscsi nousb nofirewire atapicd noideraid noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce tce=hda restore=hda"

CLS
EXIT

To create a Qemu Virtual Hard Drive use the qemu-img.exe Windows program.
Title: Thanks, but still having problems
Post by: edmenje on May 22, 2009, 05:12:34 PM
Roberts, thanks for the code, but it doesn't work for me.  When I run the .bat file, terminal windows open and then immediately close.  I studied the .bats that I use to run DSL which I got from the DSL forums, and the one from PenDrive Linux to open any .iso and did some modifications.  With the beginning code from the PDL.bat file it opens a terminal which stays, but then when I hit enter to continue, the Qemu terminal closes immediately.  I've tried a few changes to the code but to no avail.
Here is what I've got so far:

REM This file was produced by PDLA © 2007 http://pendrivelinux.com
REM This file will start Linux from Windows using Qemu.
@echo OFF
cls

echo.
echo Press any key to continue or close to exit...
pause >nul
cls

START .\qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -soundhw es1370 -localtime -kernel bzImage -initrd tinycore.gz -hda qemu/hda -append "vga=791 quiet restore=hda modules=hda noscsi nousb nofirewire atapicd  noideraid noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce tce=hda"


I hope you can help me here, I really want to start learning to work with linux and a persistent qemu/tinycore on my usb will allow me to use it on computers at work and maintain what I've done with it.  I've been using DSL for a little while, but then I found out about tinycore.  I've gotten pretty good with Windows, and hope to get as good with linux, but at the moment I'm a total novice.  I've only been trying out various distros from liveCD for a few weeks now.  Most of the info I've come across presupposes a certain level of competency, and to me this is learning a whole new language.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: roberts on May 22, 2009, 10:47:24 PM
Sorry, I don't have time to study someone else's bat files when mine works fine.
I wrote all the DSL Qemu stuff so TC is not much different. You likely have some files not in the directories specifed by the .bat file. On level 1, the files bzImage, tinycore.gz and tinycore.bat
qemu is self contained in its own directory qemu/ and the harddisk image is also under the qemu directory. There is not much else to it. If you have run DSL/Qemu then should be simple to add the three Tiny Core files, bzImage, tinycore.gz and tinycore.bat to the main directory of your pendrive.

HTH
Title: Better, but still...
Post by: edmenje on May 23, 2009, 01:24:37 PM
Did what you suggested, placed tinycore.gz, and bzImage along with the tinycore.bat file in the home directory.  I also made sure that I had a clean harddisk and hda file in the qemu folder.  I started your tinycore.bat without any changes, and this time it started until the qemu terminal screen got to this:

ESI: c0434334 EDI: fffffff4 EBP: c046bf9c ESP: c046bf20
DS: 007b ES: 007b FS: 00dB GS: 0000 SS: 0068
Process swapper (pid: 0, ti=c046a000 task=c0434334 task.ti=c046a000)
Stack: c0119fc8 c046bf9c 00000000 00B00b00 00000046 c011bd03 00000046 00000000
00B00b00 00000000 c046bf9c c011ae2d 00000000 00000000 00000000 00000000
00000000 00000000 c011f3ed 00000027 c7c024a0 00000000 00B00b00 c046bfdc
Call Trace:
[<c0119fcB>] copy_process+0x5d/0xda2
[<c011bd03>] release_console_sem+0x166/0x17f
[<c011ae2d>] do_fork+0xab/0x1dc
[<c011f3ed>] on_each_cpu+0x17/0x1f
[<c0101B47>] kernel_thread+0x77/0x7f
[<c04702fc>] kernel_init+0x0/0x24a
[<c04702fc>] kernel_init+0x0/0x24a
[<c0103da0>] kernel_thread_helper+0x0/0x10
[<c03465d5>] rest_init+0x11/0x4b
[<c04707d0>] start_kernel+0x273/0x276
========================
Code: ff 05 ac b8 4b c0 c3 ff 0d ac b8 4b c0 c3 89 c2 8b 40 04 f6 40 0c 01 74 30
8b 82 58 02 00 00 0f ae 00 0f ba 60 02 07 73 02 db e2 <0f> 1f 00 90 8d b4 26 00
00 00 00 89 f6 8b 42 04 83 60 0c fe 0f
EIP: [<c01013c5>] prepare_to_copy+0x1d/0x43 SS:ESP 0068:c046bf20
———[ end trace 4eaa2a86a8e2da22 ]———
kernel panic — not syncing: Attempted to kill the idle task!


some improvement, but if you think you can figure out from this what else I might be missing here I'd appreciate it.  I understand you don't have much time to be checking through all the code and such, but maybe some solution might be just a couple of seconds for you to figure out whereas I'm bashing my head against it as a total newbie.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: curaga on May 23, 2009, 01:40:03 PM
Where did you get Qemu? Old versions were known not to work, anything above 0.10.0 is tested to work
Title: curaga...that helped some
Post by: edmenje on May 23, 2009, 04:41:09 PM
Your suggestion about the version of qemu did help, but I still do not achieve the persistence I was hoping that Roberts' tinycore.bat file would give me.  I was using the quemu that worked for me with DSL, but after your suggestion I switched to quemu-0.9.0-windows and was able to at least boot entirely into tinycore...but I still don't get the persistence I was hoping for.  One of the ways I want to use tinycore is from my USB at work where I need to be able to switch back to Windows right away, I won't have time to close and reboot multiple times a day.  When I do boot up now in the quemu terminal screen I get the following...which leads me to believe there is still more to do to make it all work for the persistence issue.

Decompressing Linux... Parsing ELF... done.
Booting the kernel.
pci 0000:00:01.0: PIIX3: Enabling Passive Release
ide_generic: I/D resource 0x1F0—0x1F? not free.
ide_generic: I/D resource 0x1?0—0x1?? not free.
Booting tinycore_1.4.2
Running Linux Kernel 2.6.26—tinycore.
Starting udev daemon for hotplug support...Done.
Boot options checked.
FATAL: Error inserting ohci_hcd (/lib/modules/2.6.26-tinycore/kernel/drivers/usb
/host/ohci—hcd.ko.gz): No such device
Scanning hard disk partitions to create /etc/fstab
Setting Language to C Done.
Setting keymap to us Done.
Setting Timezone to UTC Done.
Network device eth0 detected, DHCP broadcasting for IP.
Possible swap partition(s) enabled.
Checking for Tiny Core Applications...
mount: you must specify the filesystem type
chown: /mnt/hda/tce: No such file or directory
done.
mount: you must specify the filesystem type
Unable to mount device hda
Press enter to continue:_

As said, if I hit enter I do boot up into tinycore, but only in a LiveCD fashion, no changes can be saved.  I tried to mount hda from within TC but I was unsuccessful.

NOTE: The harddisk and hda files I created in the qemu folder were made with the mke_vhd.bat file I used when setting up DSL since qemu-img.exe did not work in creating them for me...perhaps this could be part of the problem.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: alex on May 23, 2009, 07:29:46 PM
Did you formatted the qemu-image as ext2 or ext3?.

alex
Title: If it has something to do with it...
Post by: edmenje on May 24, 2009, 12:30:07 AM
I don't know what format the qemu image harddisk is.  The bat file simply starts qemu-img.exe and indicates a size.  I edited the file to make two 300mb VHDs in the qemu folder, one called by default harddisk and another I named hda since it seems to be refered to  in roberts' tinycore.bat for tce and restore.  If the one called harddisk was the only one needed, it wouldn't hurt to have a backup I figured...I wasn't sure which was actually needed.  In setting up DSL I renamed the created harddisk to hdb as that was the indicated device for saving backups, and it worked there.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: roberts on May 24, 2009, 05:46:26 AM
You are getting confused with the file name of the virtual drive and the Qemu internal drive name mappings.

In DSL, hda was mapped to the compressed KNOPPIX image and hdb was mapped to the virtual drive harddisk.

Tiny Core runs from ram, therefore only one Qemu drive is specified, The first drive must be hda, so hda is mapped to harddisk.

REM Start qemu on windows.
@ECHO OFF

START qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -localtime -soundhw es1370 -kernel bzImage -initrd tinycore.gz -hda qemu\harddisk -append "vga=791 quiet noscsi nousb nofirewire atapicd noideraid noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce tce=hda restore=hda"

CLS
EXIT

I have indicated in bold above the mapping Qemu uses to indicate that Qemu's hda is mapped to virtual disk file qemu\harddisk

Upon first boot you will get errors, as the drive needs to be formatted. If you have the DSL Qemu stuff looks at the readme and replace hdb with hda in the section of preparing the virtual drive.

You should boot into text  mode with nobackup and norestore, the 1st.bat script for Tiny Core would look like this:

Code: [Select]
REM Start qemu on windows.
@ECHO OFF

START qemu\qemu.exe -L qemu/ -no-kqemu -m 64 -localtime -kernel bzImage -initrd tinycore.gz -hda qemu/harddisk -append "quiet text norestore base noscsi nousb nofirewire atapicd noideraid noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce"

CLS
EXIT


Once booted into Qemu get to a system prompt then:
$ sudo mke2fs /dev/hda

Warning: /dev/hda is the entire device
Proceed anyway? (y/n)

Enter y

Wait for virtual device to be formatted and the system prompt returns

$sudo poweroff

This will shutdown and exit the virtual machine.

Now start the virtual machine using the tinycore.bat script.  The virtual drive file harddisk mapped to Qemu as hda should work.

Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: linus72 on May 24, 2009, 11:14:28 AM
 ;D What's up Ed, it's B
 OK, Ed is referring to my MyDSL stuff here with scripts and stuff
( http://multidistro.com/downloads/dslqemu/dslqemu.html )
which is a bastardization (is that a word?) of dsl-embedded/billix-0.18.

This stuff all runs off USB!! (Portable-Operating-System)

So, I basically started trying to make scripts for Linux users to have dsl-portable and not just Windows users.
Now, only distro's known to work so far are Slack-11.0/12.2, DSL, DSL-N, Feather, TTYLinux, Fedora
and now Tinycore_2.0rc2.1!!

For some reason I can't get 1.4.2 to work this way :'( , dont know why, just locks up with kernel panic!
I tried using just the kernel/initrd, using the iso, whatever, doesn't work!?

1.4.2 maybe works in windows with qemu.exe, but not Linux so far....

OK- first a little info; Using 2.0rc2.1 there are glitches- pauses at bootup, can't set background in JWM, even after
editing .jwmrc as per ( http://forum.tinycorelinux.net/index.php?topic=1653.0 )
biggest issue is appbrowser freezes when installing any app that shows up on wbar; I just used xkill to kill appbrowser
and then it refreshed and the menu icon popped up on wbar, just reopen appbrowser and continue.
To clarify, install app and it'll freeze after downloading/then do as above.

VERY IMPORTANT; AFTER MAKING YOUR OWN VHD WITH SCRIPTS(harddisk rename to hda), BOOT PORTABLE-TC
WITH OPTION "NORESTORE BASE", THEN OPEN A ROOT TERMINAL AT DESKTOP
AND "mke2fs /dev/hda" then use "halt" or exit without backing up!
Again boot and choose 1stboot-sav2hda and it'll setup TC for you-start installing apps!

Anyway; I made a custom iso of 2.0rc2.1 and that's what the script runs off of; as using just kernel/initrd it freaks out!?
also, I pre-made a 500MB vhd (hda) just use that for tce/restore mydata.gz.(40+mb of tce's installed)
Note also that the 500MB vhd will compress down to approx. xMB according to how much space is taken up;
Presently, with around 40+mb of tce apps installed it compresses to about 40+mb!!
The whole 67MB pkg will de-compress to 500+MB!

I put the iso and hda into the qemu folder.
Directions at boot-up; you can choose F2/F3 at boot to check out that and then SIMPLY PRESS ENTER TO GET THE
BOOT MENU-DON'T ENTER ANYTHING AT "BOOT:", JUST HIT ENTER!
If you choose to enter something at the boot line, just hit tab at the boot menu to edit.

Also, I included my iso before I made it into an iso image; simply edit and use make_iso.sh/.bat as below to re-create iso.

You can edit the iso by extracting it or mounting it and then copying files to a folder. As ROOT, open a terminal in Linux(I use Ubuntu) and then place iso in a empty folder on your Desktop, then "cd" into folder and-
"mkdir -p new"
"mkdir -p tc"
"mount -o loop TC_TCVD_2.0rc2.1.iso new"
"cp -a new/* tc"

I included both make_iso.sh/.bat in the boot folder so you can edit the isolinux.cfg,etc and remake the iso.
To remake iso;
Double-click make_iso.sh or .bat and choose "run in terminal", then give your iso a name-it must end in .iso
Example would be mytc.iso, not mytc

You could also cd into boot folder and "chmod +x make_iso.sh" to make executable and then "./make_iso.sh" to invoke.

So, it works in Linux and Windows, wish I could use 1.4.2 in Linux with portable-qemu, but it'll due.

Here it is 67MB includes my custom iso(11.4MB) + extracted iso (11MB)+ portable-qemu/scripts/vhd(500MB+)
The whole 67MB pkg will de-compress to 500+MB!
 ( http://multidistro.com/downloads/dslqemu/dslqemu.html )

OH-still can't get the background to set in jwm....help?



Title: Mission Accomplished
Post by: edmenje on May 24, 2009, 01:48:49 PM
Roberts,
Applied your steps from last post and I've now got it working, though I did not use 1st.bat.  When TC completely loaded, I chose "exit to prompt" and entered the commands...at the moment I can't remember if I had to attain root using sudo, but It's working for me.  I'm posting from Opera which I installed and used a couple of times through reboots just to see if it all held up.  The one thing which still concernes me now is the line in boot terminal which says:
WARNING: Ancient bootloader  some functionality will be lost!
I guess since on the Windows side the latest qemu I saw to download was 0.9.0-windows.  Other than that it's all working well so far.  Now if I could just figure out why Opera keeps crashing...but that's another issue.

Thanks for all the help and patience with this newbie,
I'm off now to browse more of the forums to learn some more...

Edmenje

PS: sidebar to Linus72,
I'm going to have to read your post a coupleamore times before I fully understand, but thanks to you too for the help with DSL and turning me on to TinyCore in the first place.
Title: One Last addendum-maybe need just minor adjustment still?
Post by: edmenje on May 24, 2009, 05:52:32 PM
So now I've got tinycore working for me but there are still the two messages during the boot-up that have me wondering what they mean and if there is something more I need to do to get it all perfect:

FATAL: Error inserting ohci_hcd (/lib/modules/2.6.26-tinycore/kernel/drivers/usb

And the afforementioned:

WARNING: Ancient bootloader  some functionality will be lost!

If anyone has any Ideas...I'd appreciate it.

Also- I installed Opera.tcz instead of tce like I had done originally, and it seems more stable so far.

edmenje
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: roberts on May 24, 2009, 06:36:36 PM
The first "error" is caused by the fact that a virtual machine does not typically allow direct access to usb decvices after boot, i.e., entering the virtual environment. The modprobe is trying to load a module for direct usb access. It can be ignored as you are using virtual drive.

I no longer run any Windows so can't comment on the boot loader message.

Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: linus72 on May 25, 2009, 02:52:08 AM
Hey peeps!
Ed you got it running yet?

Questions for Admin Roberts?
I'm assuming you are Mr Shingledecker? "I wrote all the DSL Qemu stuff so TC is not much different."

If so, you are a mad genius!
Tinycore is an awesome little bag of tricks!

Me, I''m a newb(5 months in Linux/2.5yrs computers) so I don't know much yet.

I do know I like DSL and now TC 'cause Master Shingledecker got onboard, so that rocks!

OK, so I am like Roberts; don't play with Winblowz less I got to- I want TC running off Qemu in Linux.
So, anyone know why 2.0rc2.1 works for me and not 1.4.2?
Thanks.
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: roberts on May 25, 2009, 08:34:01 PM
1.4.2 and just tested 1.4.3 both work fine with the tinycore.bat that I posted for Qemu/Windows earilier in this thread.

Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: linus72 on May 26, 2009, 02:57:15 AM
Yes, but how to get 1.4.3 working off a .sh in Linux without having qemu installed-how to do that?
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: curaga on May 26, 2009, 04:07:14 AM
You'd need a portable binary of Qemu, one that runs on all distros. Best to compile one completely staticly with uclibc, otherwise there will always be some distros that won't work due to different version of glibc or some other lib.
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: linus72 on May 27, 2009, 03:19:34 AM
Hey Curaga; just how would I go about doing that-compiling qemu ?statically?
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: curaga on May 27, 2009, 04:24:13 AM
It's a rather complicated topic :P

Basically you would just do the configure phase like this:
Quote
CFLAGS="$CFLAGS -static" CXXFLAGS="$CXXFLAGS -static" ./configure --other-options-here
But to do so _and_ get an all-distro portable binary requires a special environment. uClibc with maximum compatibility and everything to go with it is really an only option, as glibc cannot completely be linked staticly (plus there would be still the restrictions of the glibc used: for example minimum kernel version)
Title: Re: help...step by step to make tcl persistent on USB/Quemu
Post by: linus72 on May 27, 2009, 04:58:52 AM
 :P
Thanks, that helps alot; but in a related question- TC-2.0rc2.1 and Okajima's 2.0rc1 both run fine in portable qemu
on all my linux pc's(3), however 1.4.2 does not and has a kernel panic/lock-up.
So, what's in tc 2.0+ that isn't in tc-1.4.2??
thanks again