Tiny Core Linux

General TC => Remasters / Remixes - Unofficial => Topic started by: pditty on April 20, 2020, 07:26:13 AM

Title: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 07:26:13 AM
I hope everyone is staying safe during the COVID-19 Pandemic.

I need to create a bootable iso image and wanted to ask if anyone had updated instructions for making TinyCore 11+ Real-Time or can help me figure out what I'm doing wrong.  I feel like I've looked at everything on the web regarding this topic but I still can't get it to boot into the gui.

I've looked at the RTAI link from 2016 http://j.bamiere.free.fr/RTAI/ModOp.htm#mozTocId601179 (http://j.bamiere.free.fr/RTAI/ModOp.htm#mozTocId601179).

Creating a custom tinycore kernel http://wiki.tinycorelinux.net/doku.php?id=wiki:custom_kernel (http://wiki.tinycorelinux.net/doku.php?id=wiki:custom_kernel)

Remastering example https://github.com/elazarl/customize_tinycorelinux/blob/master/README.md (https://github.com/elazarl/customize_tinycorelinux/blob/master/README.md)

Another example here https://github.com/on-prem/tinycore-kernel/blob/master/Makefile (https://github.com/on-prem/tinycore-kernel/blob/master/Makefile)

Creating Purpose TinyCore Images https://fabianstumpf.de/articles/tinycore_images.htm (https://fabianstumpf.de/articles/tinycore_images.htm)

Extract and Repack scripts https://github.com/elazarl/customize_tinycorelinux (https://github.com/elazarl/customize_tinycorelinux)

Here is what I've been doing so far....

#1. Download the pre-patched 5.4.3 kernel from tinycore src/kernel directory
#2. Extract the kernel and then patch with the 5.4.3 rt patch using these instructions https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup (https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup)
#3. Copy config-5.4.3-tinycore from the src/kernel directory to the extracted Linux-5.4.3 directory and rename to .config
#4. Run make oldconfig (selected #4 for Preempt and all other options were defaults)
#5. Run make bzImage
#6. Run make modules
#7. From tinycore distribution_files I downloaded the rootfs.gz file
#8. Extracted rootfs using 'zcat /tmp/rootfs.gz | sudo cpio -i -H newc -d'
#9. Ran make INSTALL_MOD_PATH=/<extracted rootfs>/lib/modules modules_install firmware_install
#10. Went into that <extracted rootfs>/lib/modules directory and created kernel.tclocal symlink to point to /usr/local/lib/modules/5.4.3-tinycore/kernel/
#11. Ran this command from <extracted rootfs>/lib/modules/<kernel name> "find . -name "*.ko" -exec gzip -9 '{}' \;"  to find and compress all the .ko files to .ko.gz
#12. Opened modules.dep, modules.builtin, and modules.order in a text editor and globally replaced all the .ko with .ko.gz extensions so they were referenced correctly.
#13. Compressed this rootfs by running "sudo sh -c "find . | cpio -o -H newc | gzip -2" > core.gz" at the root level
#14. Copied core.gz to the iso boot directory that was created when I ran tinycore-extract.sh found at https://github.com/elazarl/customize_tinycorelinux (https://github.com/elazarl/customize_tinycorelinux)
#15. Copied bzImage from compiled Linux image in step #5 to the boot directory created from tinycore-extract.sh and renamed it vmlinuz
#16. Ran a modified script to build the iso.

#!/bin/bash
OUTPUTISO="tinycoreRT-04032020.iso"
ROOTFS="/home/me/TinyCore/test_04012020/initrd/core"
VOLUMEID="tinycoreRT-04032020"
BOOTARGS=""

TMPDIR="/home/me/TinyCore/test_04012020/iso"
chmod 755 "${TMPDIR}"


# alter isolinux config to use our changes
ISOLINUX_CFG="${TMPDIR}/boot/isolinux/isolinux.cfg"
sed -i 's/prompt 1/prompt 0/' "${ISOLINUX_CFG}"
sed -i "s/append/append cde ${BOOTARGS}/" "${ISOLINUX_CFG}"

# build a new iso
xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -volid "${VOLUMEID}" \
        -eltorito-boot boot/isolinux/isolinux.bin -boot-load-size 4 \
        -eltorito-catalog boot/isolinux/boot.cat -boot-info-table \
        -no-emul-boot -output "${OUTPUTISO}" "${TMPDIR}/"



Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Juanito on April 20, 2020, 07:54:58 AM
So you can boot to a console prompt?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 08:00:34 AM
Yes, I can.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Juanito on April 20, 2020, 08:02:40 AM
If you start Xvesa/Xfbdev/Xorg-7.7 as per the first line of .xsession do you get an error message?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 08:51:26 AM
It flashes so fast but this is what it says...

Booting Core 11.1
Running Linux Kernel 5.4.3-rt1-tinycore
Checking boot options... Done.
Starting udev daemon for hotplug support ... Done.
Scanning hard disk partitions to create /etc/fstab
Setting Language to C Done.
Possible swap partition(s) enabled.
Loading extensions...|

And then it kicks me to the command prompt.
tc@box:~$

Does that help at all?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Juanito on April 20, 2020, 08:57:30 AM
When you land at the command prompt, enter the fist line of .xsession as a command.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 09:07:07 AM
I entered.

Xvesa -br -screen 1024x768x32 -shadow -2button -mouse /dev/input/mice,5 -nolisten tcp -I > /dev/null 2>&1 &

And I get a black screen and can't do anything but power down.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 09:18:58 AM
Since I'm using the cde directory from the current image do I need to do anything with the copy2fs.lst and onboot.lst files?  They have references to .tcz files but if I created the kernel as well as the rootfs where would they even be?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 20, 2020, 09:30:01 AM
And I get a black screen and can't do anything but power down.

Are you sure you are using the right patch!

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Juanito on April 20, 2020, 09:31:46 AM
Ah sorry, you needed to run "Xvesa -br -screen 1024x768x32 -shadow -2button -mouse /dev/input/mice,5 -nolisten tcp -I", but you could probably try "startx" first.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: curaga on April 20, 2020, 09:34:37 AM
So it sounds like the system isn't even trying to start X, but at least Xvesa was available. Look into ~/.profile, see which condition fails.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 09:48:43 AM
How can I tell by looking at the .profile?  I don't see Xserver or text in my /etc/sysconfig directory, but should I?

Screenshot of my .profile is attached
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 11:11:51 AM
I don't know if this helps, but I noticed that if I create an etc/sysconfig/Xserver file and put the string 'Xvesa' in it i can then run startx and it brings me to the TC blue screen (no icons) and the mouse doesn't work.  But it looks like its trying to do something.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 20, 2020, 12:14:55 PM
Also, if I turn on syslog and compare my realtime build to the Tinycore-current.iso build this is what each of them look like.

Tinycore-current.iso
Apr 20 18:55:56 box authpriv.notic sudo:    tc : TTY=unknown ; PWD=/mnt/sr0/cde/optional ; USER=root ; COMMAND=/usr/local/bin/umount -d /mnt/test
Apr 20 18:55:56 box authpriv.notic sudo: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh

Whereas on my real time build i get this..
Apr 20 19:05:10 box authpriv.notic sudo:    tc : TTY=unknown ; PWD=/mnt/sr0/cde/optional ; USER=root ; COMMAND=/usr/local/bin/umount -d /mnt/test
Apr 20 19:05:10 box daemon.info init: starting pid 812, tty '/dev/tty1': '/sbin/getty -nl /sbin/autologin 38400 tty1'

I don't ever see the real time version log in as root.

Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 20, 2020, 10:39:10 PM
 :P

Are you sure you are using the right patch!

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/older/

patch-5.4.3-rt1.patch.gz                           17-Dec-2019 21:06    207K
patch-5.4.3-rt1.patch.sign                         17-Dec-2019 21:06     438
patch-5.4.3-rt1.patch.xz                           17-Dec-2019 21:06    170K


Quote
+Performance
+~~~~~~~~~~~
+Some basic tests were performed on a quad Intel(R) Xeon(R) CPU E5-2697 v4 at
+2.30GHz (36 cores / 72 threads). All tests involved writing a total of
+32,000,000 records at an average of 33 bytes each. Each writer was pinned to
+its own CPU and would write as fast as it could until a total of 32,000,000
+records were written. All tests involved 2 readers that were both pinned
+together to another CPU. Each reader would read as fast as it could and track
+how many of the 32,000,000 records it could read. All tests used a ring buffer
+of 16KB in size, which holds around 350 records (header + data for each
+entry).
+
+The only difference between the tests is the number of writers (and thus also
+the number of records per writer). As more writers are added, the time to
+write a record increases. This is because data pointers, modified via cmpxchg,
+and global data access in general become more contended.
+
+1 writer
+^^^^^^^^
+ runtime: 0m 18s
+ reader1: 16219900/32000000 (50%) records
+ reader2: 16141582/32000000 (50%) records
+
+2 writers
+^^^^^^^^^
+ runtime: 0m 32s
+ reader1: 16327957/32000000 (51%) records
+ reader2: 16313988/32000000 (50%) records
+
+4 writers
+^^^^^^^^^
+ runtime: 0m 42s
+ reader1: 16421642/32000000 (51%) records
+ reader2: 16417224/32000000 (51%) records
+
+8 writers
+^^^^^^^^^
+ runtime: 0m 43s
+ reader1: 16418300/32000000 (51%) records
+ reader2: 16432222/32000000 (51%) records
+
+16 writers
+^^^^^^^^^^
+ runtime: 0m 54s
+ reader1: 16539189/32000000 (51%) records
+ reader2: 16542711/32000000 (51%) records
+
+32 writers
+^^^^^^^^^^
+ runtime: 1m 13s
+ reader1: 16731808/32000000 (52%) records
+ reader2: 16735119/32000000 (52%) records
+
+Comments
+^^^^^^^^
+It is particularly interesting to compare/contrast the 1-writer and 32-writer
+tests. Despite the writing of the 32,000,000 records taking over 4 times
+longer, the readers (which perform no cmpxchg) were still unable to keep up.
+This shows that the memory contention between the increasing number of CPUs
+also has a dramatic effect on readers.
+
+It should also be noted that in all cases each reader was able to read >=50%
+of the records. This means that a single reader would have been able to keep
+up with the writer(s) in all cases, becoming slightly easier as more writers
+are added. This was the purpose of pinning 2 readers to 1 CPU: to observe how
+maximum reader performance changes.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: curaga on April 21, 2020, 12:26:46 AM
Somehow your extension loading is broken. That's not too easy to help remotely.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 04:11:40 AM
Yes, I used this patch

patch-5.4.3-rt1.patch.xz

And this command after extracting the TinyCore pre-patched kernel (http://distro.ibiblio.org/tinycorelinux/11.x/x86/release/src/kernel/linux-5.4.3-patched.txz).

$ xzcat ../patch-5.4.3-rt1.patch.xz | patch -p1
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 04:12:31 AM
Is there an IRC channel we can use to chat on?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 21, 2020, 06:25:54 AM
Hi pditty
I'm guessing maybe some permissions got messed up in  rootfs.gz.  Maybe I missed it, but I didn't see why  rootfs.gz  needed
to be changed.

Try this procedure:
... A couple of months ago I had to recompile a kernel to get some hardware on an ASUS T100 Transformer recognized and ran into
the same problem ("is already owned by kernel" error).

The error ("is already owned by kernel") is basically saying a symbol that a module is defining is already defined by the kernel. When
configuring a kernel, selecting certain options will force some drivers to be built into the kernel instead of as a module. So, assuming
you already have existing kernel modules, DRIVER_A is a module depending on DRIVER_B. You select a kernel option that requires
DRIVER_B to be built into the kernel. If you try loading DRIVER_A with the new kernel, it will attempt to load DRIVER_B (a dependency)
and you get that symbol "is already owned by kernel" error. This means DRIVER_A also needs to be recompiled so it no longer tries
to load DRIVER_B.

What I wound up doing is recompiling all modules when I changed the kernel. Here's a step by step for the whole procedure:
Code: [Select]
Compile a kernel:
tce-load -i compiletc perl5 bash ncursesw-dev bc glibc_apps elfutils-dev
wget http://tinycorelinux.net/10.x/x86_64/release/src/kernel/config-4.19.10-tinycore64
wget http://tinycorelinux.net/10.x/x86_64/release/src/kernel/linux-4.19.10-patched.txz
tar xf linux-4.19.10-patched.txz
cd  linux-4.19.10
make mrproper
# Start with the most recent config file.
cp ../config-4.19.10-tinycore64 .config
make oldconfig
make menuconfig [make your changes]
# I like to save a copy of the config file to use as a starting point for the next time.
cp .config ../config-4.19.10-tinycore64-asusT100CHIrev1
# Compile kernel
make -j 2 bzImage
# Copy the kernel where the bootloader can find it.
cp arch/x86/boot/bzImage /mnt/sdg1/Linux/vmlinuzASUS64rev1
# Compile modules
make -j 2 modules
# Place the modules somewhere for packaging.
mkdir -p /home/tc/tmp/ASUS/modules/usr/local
make INSTALL_MOD_PATH=/home/tc/tmp/ASUS/modules/usr/local modules_install
cd /home/tc/tmp/ASUS/
# I like to keep the mod.alias, mod.builtin, mod.dep, mod.order, and mod.symbols files.
mv modules/usr/local/lib/modules/4.19.10-tinycore64/modules.* .
# Remove the 2 links in modules/usr/local/lib/modules/4.19.10-tinycore64/
rm modules/usr/local/lib/modules/4.19.10-tinycore64/build
rm modules/usr/local/lib/modules/4.19.10-tinycore64/source

# Set up sorter.sh to package all the modules.
cd ..
mkdir sorter
cd sorter
tce-load -i squashfs-tools zsync
wget https://github.com/tinycorelinux/sorter/archive/master.zip
unzip master.zip
cd sorter-master/
# This creates all of the Tinycore module packages and leaves them in the current directory.
./sorter.sh 4.19.10-tinycore64 /home/tc/tmp/ASUS/modules
# Back to the tmp directory.
cd ../../
# Fetch a 32 bit root file system.
wget http://tinycorelinux.net/10.x/x86/release/distribution_files/rootfs.gz
# Copy the module archive that's part of the base system
cp sorter/sorter-master/modules64.gz modulesASUS64rev1.gz
# Make a new initrd, 64 bit modules with 32 bit root file system (32 bit apps) in this example.
cat rootfs.gz modulesASUS64rev1.gz > coreASUS64rev1.gz
# Copy the initrd where the bootloader can find it.
cp coreASUS64rev1.gz /mnt/sdg1/Linux/

The downloads only need to be done once. If you need to compile again, use the config file you saved previously as a starting point.

Created directories to archive the results of each build. This allows you to revert to a previous build and keeps matching config,
kernels, modules, and initrd files together. Append  rev1  to the config, kernel, and initrd filenames and place them in a  rev1
directory along with their matching modules.

Compile times on a Dell Dimension E310 were 52 minutes for the kernel and 3 hours 45 minutes for the modules.
Apply your patch, probably after  make mrproper.  There's a sorter script that separates and packages all of the modules. I mixed
a 64 bit kernel with a 32 bit  rootfs.gz  for my needs. Download the  rootfs.gz  that matches your requirements. The procedure is
fairly well commented as to what's going on. Ask questions if something I did seems unclear.

If you really feel the need to unpack/pack  rootfs.gz:
To unpack:
Code: [Select]
mkdir tempdir
cd tempdir
zcat /path/to/existing/rootfs.gz | sudo cpio -i

To repack:
Code: [Select]
sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/rootfs.gz
Found here:
http://forum.tinycorelinux.net/index.php/topic,22398.msg140327.html#msg140327
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 06:46:01 AM
Thanks Rich, let me give this a try and get back to you.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 07:13:04 AM
Do I need to gzip the new .ko files before running the sorter script?
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 21, 2020, 07:23:09 AM
Hi pditty
You can, I didn't. The sorter script gzips the base modules file:
Code: [Select]
# Copy the module archive that's part of the base system
cp sorter/sorter-master/modules64.gz modulesASUS64rev1.gz
So the package is smaller, but the modules get unpacked when you boot and take more space in the RAM filesystem.

The  .tcz  files are compressed file systems. They get loop mounted so compressing those modules won't buy you anything.
Title: Re: Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 08:23:21 AM
You're the man Rich!

That worked and I am now booting to the GUI. 

Your instructions were perfect!!
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 21, 2020, 08:27:05 AM
Hi pditty
Glad I could help. Thank you for confirming it worked for you. I will mark your original post as  [Solved].
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 09:38:43 AM
Rich, This is essentially everything you did but tweaked for 5.4.3, ubuntu, and building an ISO (that can run in a vm if you want).

I wanted to post it in case it helps anyone else.

NOTE: I have the following folder structure as well as tinycore-extract.sh and sorter.sh already in the folders.  If you don't have them you can download them from github and extract them (if necessary).

-wget https://github.com/tinycorelinux/sorter/archive/master.zip
-https://github.com/elazarl/customize_tinycorelinux

tmp/
tmp/backup
tmp/image
tmp/image/tinycore-extract.sh
tmp/modules/usr/local
tmp/sorter/sorter-master/sorter.sh

############################ Create the Image directory #########################
->cd image
->sudo ./tinycore-extract.sh <image iso name OR Tinycore-current.iso by default>
->cd iso/boot
->sudo rm core.gz vmlinuz
->cd ../../../

############################  Compile The Kernel#####################################
### Only install these if you don't have them already
->sudo apt-get install zsync -y
->sudo apt-get install squashfs-tools
->sudo apt-get install -y xorriso

### Get the patched Tinycore kernel and Real time patch
->wget http://tinycorelinux.net/11.x/x86/release/src/kernel/config-5.4.3-tinycore
->wget http://tinycorelinux.net/11.x/x86/release/src/kernel/linux-5.4.3-patched.txz
->wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.3-rt1.tar.xz
->tar xf linux-5.4.3-patched.txz
->cd  linux-5.4.3

###Clean the Kernel, just in case
->make mrproper

###Patch the Kerenl with the Real time extension
->xzcat ../patch-5.4.3-rt1.patch.xz | patch -p1

### Start with the most recent config file.
->cp ../config-5.4.3-tinycore .config

### Merge the old .config with the real time patch features
->make oldconfig

#### Enter #4 for FULLY PREEMPT, everything else is default

### OPTIONAL: Make your changes to the kernel
->make menuconfig

### OPTIONAL: Save Kernel Config as a starting point for next time.
->cp .config ../config-5.4.3-tinycoreRT-rev1

### Compile the kernel
->make -j 2 bzImage

### Copy the kernel where the bootloader can find it in the image directory
->cp arch/x86/boot/bzImage ../image/iso/boot/vmlinuz

### Compile modules
->make -j 2 modules

### Place the modules in a temporary directory
->make INSTALL_MOD_PATH=../modules/usr/local modules_install
->cd ../

### OPTIONAL: Backup modules.alias, modules.builtin, modules.dep, modules.order, and modules.symbols files just in case
->mv modules/usr/local/lib/modules/5.4.3-rt1-tinycore/modules.* backup/

### Remove the 2 uneccessary symlinks in modules/usr/local/lib/modules/5.4.3-rt1-tinycore
->rm modules/usr/local/lib/modules/5.4.3-rt1-tinycore/build
->rm modules/usr/local/lib/modules/5.4.3-rt1-tinycore/source


######################### Set up sorter.sh to package all the modules.  ###############################
->cd sorter/sorter-master

### Create the Tinycore module packages and leave them in the current directory.
->sudo ./sorter.sh 5.4.3-rt1-tinycore ../../modules

### Back to the working directory.
->cd ../../

### Fetch a 32 bit root file system.
->wget http://tinycorelinux.net/11.x/x86/release/distribution_files/rootfs.gz

### Copy the module archive to the working directory
->cp sorter/sorter-master/modules.gz modulesRT.gz

### Make a new initrd
->cat rootfs.gz modulesRT.gz > coreRT.gz

### Copy the initrd where the bootloader can find it.
->cp coreRT.gz image/iso/boot

######################## Build the ISO ##############################################################
->cd image
->sudo chmod 755 iso

### isolinux.cfg hasn't changed we are still using core.gz and vmlinuz as rootfs and kernel
->xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -volid tinycoreRT \
        -eltorito-boot boot/isolinux/isolinux.bin -boot-load-size 4 \
        -eltorito-catalog boot/isolinux/boot.cat -boot-info-table \
        -no-emul-boot -output <tinycore iso name> iso
       
### DONE! Boot .iso file
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 21, 2020, 12:55:46 PM
Another question....

I have an x86_64 app that I built in Ubuntu 18.04 and copied to the rootfs before compressing.  I can see the executable in TC but when I try to run it I get...

sh: ./test: not found

On ubuntu this is what the file looks like....

$file test
test: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=d42cc427dd007288259a8ece5ae803633471a8a2, with debug_info, not stripped


Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 21, 2020, 01:19:06 PM
Hi pditty
Based on your reply #24 you are running 32 bit. You can't run a 64 bit app on a 32 bit system.

If you are actually running a 64 bit system, maybe the app isn't marked as being executable:
Code: [Select]
chmod 775 app
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 22, 2020, 02:48:24 AM
As a TCL-RT project, are you considering adding it to official distributions!?

In terms of performance, it should not be forgotten that there are many low system users.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 22, 2020, 04:36:02 AM
Rich,  I converted my instructions to use 64-bit and my app still doesn't run.  It's almost like it doesn't exist.

I get this if I try to run it even though it's there (NOTE: App was built in Ubuntu as well).
tc@box:/home$ ./test
sh: ./test: not found




Here are the 64-bit instructions (directory structure mentioned in post #24 is still the same).

############################ Create the Image directory #########################
->cd image
->sudo ./tinycore-extract.sh <image iso name OR TinyCorePure64-current.iso by default>
->cd iso/boot
->sudo rm corepure64.gz vmlinuz64
->cd ../../../

############################  Compile The Kernel#####################################
### Only install these if you don't have them already
->sudo apt-get install zsync -y
->sudo apt-get install squashfs-tools
->sudo apt-get install -y xorriso

### Get the patched Tinycore kernel and Real time patch
->wget http://tinycorelinux.net/11.x/x86_64/release/src/kernel/config-5.4.3-tinycore64
->wget http://tinycorelinux.net/11.x/x86_64/release/src/kernel/linux-5.4.3-patched.txz
->wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.3-rt1.patch.xz
->tar xf linux-5.4.3-patched.txz
->cd  linux-5.4.3

###Clean the Kernel, just in case
->make mrproper

###Patch the Kerenl with the Real time extension
->xzcat ../patch-5.4.3-rt1.patch.xz | patch -p1

### Start with the most recent config file.
->cp ../config-5.4.3-tinycore64 .config

### Merge the old .config with the real time patch features
->make oldconfig

#### Enter #4 for FULLY PREEMPT, everything else is default

### OPTIONAL: Make your changes to the kernel
->make menuconfig

### OPTIONAL: Save Kernel Config as a starting point for next time.
->cp .config ../config-5.4.3-tinycore64RT-rev1

### Compile the kernel
->make -j 2 bzImage

### Copy the kernel where the bootloader can find it in the image directory
->sudo cp arch/x86_64/boot/bzImage ../image/iso/boot/vmlinuz64

### Compile modules
->make -j 2 modules

### Place the modules in a temporary directory
->make INSTALL_MOD_PATH=../modules/usr/local modules_install
->cd ../

### OPTIONAL: Backup modules.alias, modules.builtin, modules.dep, modules.order, and modules.symbols files just in case
->mv modules/usr/local/lib/modules/5.4.3-rt1-tinycore64/modules.* backup/

### Remove the 2 uneccessary symlinks in modules/usr/local/lib/modules/5.4.3-rt1-tinycore
->rm modules/usr/local/lib/modules/5.4.3-rt1-tinycore64/build
->rm modules/usr/local/lib/modules/5.4.3-rt1-tinycore64/source


######################### Set up sorter.sh to package all the modules.  ###############################
->cd sorter/sorter-master

### Create the Tinycore module packages and leave them in the current directory.
->sudo ./sorter.sh 5.4.3-rt1-tinycore64 ../../modules

### Back to the working directory.
->cd ../../

### Fetch a 64 bit root file system.
->wget http://tinycorelinux.net/11.x/x86_64/release/distribution_files/rootfs64.gz

####################### OPTIONAL: If you need to add something to the rootfs #########################
->mkdir initrd
->cp rootfs64.gz initrd
->zcat rootfs64.gz | sudo cpio -i
->sudo rm rootfs64.gz

### CP files to the directory and change permissions if needed
->sudo cp ../../mw_test/mw_test ../../mw_test/tmw_daemon home
->sudo chmod 777 home/mw_test home/tmw_daemon

### Zip up the rootfs again.
->sudo rm ../rootfs64.gz
->sudo find . | sudo cpio -o -H newc | gzip > ../rootfs64.gz
######################################################################################################

### Copy the module archive to the working directory
->cp sorter/sorter-master/modules64.gz modules64_RT.gz

### Make a new initrd
->cat rootfs64.gz modules64_RT.gz > core64RT.gz

### Copy the initrd where the bootloader can find it.
->cp core64RT.gz image/iso/boot/corepure64.gz

######################## Build the ISO ##############################################################
->cd image
->sudo chmod 755 iso

### isolinux.cfg hasn't changed we are still using core.gz and vmlinuz as rootfs and kernel
->xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -volid tinycoreRT \
        -eltorito-boot boot/isolinux/isolinux.bin -boot-load-size 4 \
        -eltorito-catalog boot/isolinux/boot.cat -boot-info-table \
        -no-emul-boot -output <tinycore iso name> iso
       
### DONE! Boot .iso file



Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 22, 2020, 04:38:26 AM
XOR, I hadn't considered it, what would be involved?

As a TCL-RT project, are you considering adding it to official distributions!?

In terms of performance, it should not be forgotten that there are many low system users.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 22, 2020, 05:23:21 AM
Hi pditty
... tc@box:/home$ ./test
sh: ./test: not found
...
What does this return:
Code: [Select]
ls -la
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 22, 2020, 05:27:43 AM
I can't cut and paste from the VM so I'm going to re-type

tc@box:/home$ ls -la
-rwxrwxrwx    1 root    root        34112 Apr 21 19:18 test

Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 22, 2020, 05:41:06 AM
Hi pditty
I think the  root  ownership is your problem. Try:
Code: [Select]
sudo ./test
Or change change the owner:
Code: [Select]
sudo chown tc:staff test
./test

I can't cut and paste from the VM so I'm going to re-type ...
Never retype results if you don't have to. Try redirecting them into a file and copy/paste from that:
Code: [Select]
ls -la > ls.txt
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 22, 2020, 06:26:16 AM
TCL team may make sense to create a main forum thread in this regard

XOR, I hadn't considered it, what would be involved?

As a TCL-RT project, are you considering adding it to official distributions!?

In terms of performance, it should not be forgotten that there are many low system users.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 22, 2020, 06:40:58 AM
Hi pditty
Forget my last post. You have the permissions set to  777  so it's not an ownership issue.

... $file test
test: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=d42cc427dd007288259a8ece5ae803633471a8a2, with debug_info, not stripped
Is that a library you are trying to execute?  Tinycore does not have a  /lib64.  Also, I don't think Tinycore has an interpreter called  l.

    [EDIT]: Spelling.  Rich
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: pditty on April 22, 2020, 07:30:29 AM
RICH, my application uses a custom library.  So, I went ahead and rebuilt the library and application statically, and now it works!

It's much bigger of course but it does run. 

Thanks for pointing out the library, it helped.


Hi pditty
Forget my last post. You have the permissions set to  777  so it's not an ownership issue.

... $file test
test: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=d42cc427dd007288259a8ece5ae803633471a8a2, with debug_info, not stripped
Is that a library tou are trying to execute?  Tinycore does not have a  /lib64.  Also, I don't think Tinycore has an interpreter called  l.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 22, 2020, 07:48:20 AM
Hi pditty
tc@box:/home$ ls -la
-rwxrwxrwx    1 root    root        34112 Apr 21 19:18 test
Just a minor technicality,  /home  is not your home directory. It is the directory that contains the home directories of all the users.
If you are user  tc  which is the default in Tinycore, then your home directory is  /home/tc/.  If you also had user  pditty,  then that
users home directory would be  /home/pditty.

To get to your home directory, just enter:
Code: [Select]
tc@box:/home$ cd
tc@box:~$
You are now in your home directory.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 22, 2020, 11:24:17 PM
if this topic will not be opened with a fixed main category title;
It would be nice to move it to "Other architectures" section.

>> http://forum.tinycorelinux.net/index.php/board,78.0.html
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: Rich on April 22, 2020, 11:37:40 PM
Hi xor
... It would be nice to move it to "Other architectures" section.

>> http://forum.tinycorelinux.net/index.php/board,78.0.html
He's running x86_64 which does not fall under the  Other architectures  category.
Title: Re: [Solved] Instructions on updating TinyCore 11 to Real Time?
Post by: xor on April 24, 2020, 03:01:31 AM
if you say this is a natural x86;
I would like to see this among the official distributions.
I really want to try.

Hi xor
... It would be nice to move it to "Other architectures" section.

>> http://forum.tinycorelinux.net/index.php/board,78.0.html
He's running x86_64 which does not fall under the  Other architectures  category.