General TC > Tiny Core on Virtual Machines

Setting up Qemu

<< < (3/7) > >>

nick65go:
Hi Rich, thanks for the feed-back.
For clarification, lets forget about "cde" boot code/parameter.
Lets focus only on /tce folder in "disk" /dev/vda, in partition "vda" (not vda1, because I have no partition) with boot code tcvd=/dev/vda (or tcvd=vda/whatever, etc)

--- Code: ---#Check for Virtual Hard Drive
if [ -n "$TCVD" ]; then
    wait $fstab_pid
    TCVD="${TCVD#/}"
    TCVD="${TCVD#dev/}"
    TCVD_DEVICE="${TCVD%%/*}"
    TCVD_LOOPFILE="${TCVD#*/}"
    if [ "$TCVD_DEVICE" == "$TCVD_LOOPFILE" ]; then
        TCVD_DEVICE="$(tc_autoscan $TCVD_LOOPFILE 'f')"
    fi   
    PARTITION="${TCVD_DEVICE##/dev/}"
    find_mountpoint "$PARTITION"
    if [ -n "$MOUNTPOINT" ]; then
        [ "$MOUNTED" == "yes" ] || /bin/mount "$MOUNTPOINT"
        usleep_progress
        if [ -f "$MOUNTPOINT"/"$TCVD_LOOPFILE" ]; then
            [ -d /mnt/tcvd ] || /bin/mkdir /mnt/tcvd
            ln -sf "$MOUNTPOINT"/"$TCVD_LOOPFILE" /dev/tcvd
            printf "/dev/tcvd \t/mnt/tcvd \text2\tloop\t0 0 #Added by TC\n" >> /etc/fstab
            sync
        fi
    fi
--- End code ---
I started with TCVD=/dev/vda, then TCVD_DEVICE=vda and TCVD_LOOPFILE=vda;
then there I had a problem with $MOUNTPOINT==" ";
and the   if [ -n "$MOUNTPOINT" ]; then bypass all. Hm..
I was running each instruction step by step, but last time it was something like inside find_mountpoint "$PARTITION" it struggled with the grep - i ^$D2, when $D2 was /dev/vda.

PS: if you have time, could you do the same, run step by step, to reproduce my findings for $D2=/dev/vda in that part of code, to see what I mean?

nick65go:
"find_mountpoint vda" works correctly

--- Code: ---. /etc/init.d/tc-functions; MOUNTED="fake"; find_mountpoint vda ; echo $MOUNTPOINT $ MOUNTED
--- End code ---
will return internal MOUNTPOINT=/mnt/vda and internal MOUNTED=no (or my external MOUNTED=fake)


--- Code: ---#Check for Virtual Hard Drive
if [ -n "$TCVD" ]; then                             # TCVD=/dev/vda/tce/abc
    wait $fstab_pid
    TCVD="${TCVD#/}"                            # TCVD=dev/vda/tce/abc
    TCVD="${TCVD#dev/}"                      # TCVD=vda/tce/abc
    TCVD_DEVICE="${TCVD%%/*}"        # TCVD_DEVICE=vda
    TCVD_LOOPFILE="${TCVD#*/}"        # TCVD_LOOPFILE=vda
    if [ "$TCVD_DEVICE" == "$TCVD_LOOPFILE" ]; then                # yes
        TCVD_DEVICE="$(tc_autoscan $TCVD_LOOPFILE 'f')"         # TCVD_DEVICE="$(tc_autoscan vda 'f')" -> TCVD_DEVICE="" !?
    PARTITION="${TCVD_DEVICE##/dev/}"              # PARTITION=""
    find_mountpoint "$PARTITION"                            # find_mountpoint "" -> MOUNTPOINT=""
    if [ -n "$MOUNTPOINT" ]; then
...
    fi
fi
--- End code ---

Stop here now, the problem is with assignment (tc_autoscan vda 'f') to TCVD_DEVICE

Rich:
Hi nick65go
How to use/share Virtual Disks (Qemu) ?:
http://tinycorelinux.net/faq.html#qemu

nick65go:
Booting with kernel + initramfs then I have only filesystems in RAM, and no access to any *.qcow2 FROM INSIDE qemu. This is by design, to have access to ONLY what I want from inside qemu, and no undesired links to host files (except self-defined network or file-shares if/when in need) so no stupid program call home to spy, or access personal files -- in theory.

Maybe I need to define myself a new boot case for boot code like "virtio".So the TCVD is for an image (qcow2, img, etc) on a disk FROM where TC booted, in my case from void  :)

But as you have all my booting parameters in my previous posts, please let me know if you have success with actual (not remastered) tinycore.As I said before, I can remaster with a trimmed down kernel, all virtual devices, one user, a small init script -- to define mount points, variable (language, path, lib-configs, etc) -- in less than 4kb (like toybox). Basically I need a shell and udev. But I am interested to re-discover what is new in tc14 in 2023.All is for fun (and learning -- I forget things the older I get), as there are a lot of ready-made distros to fully "install" in 10 minutes.

Rich:
Hi nick65go
The  tcvd  boot code is looking for an image file.
Assuming your file containing  /tce  is on  sda1  and is called  qcow2 , try adding this:

--- Code: ----append tcvd=sda1/qcow2 tce=tcvd restore=tcvd
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version