WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Which module supports Linux-IO Target  (Read 3127 times)

Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #15 on: January 08, 2023, 04:15:18 AM »
I want to compress vmliunx (35.200 KB) to make vmliunz (+/-5.400KB),Just like the official website distribution.
Don't like to rename it because it's too big.

I have searched the documentation and seem to need "objcopy" and "gzip", but don't know the specific command line, please comment.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Which module supports Linux-IO Target
« Reply #16 on: January 08, 2023, 05:52:12 AM »
Hi Juanito
I asked because I have a feeling that we are using bzImage renamed to vmlinuz - @curaga can confirm.
I just checked my notes and they show:
Code: [Select]
make -j 2 bzImage
cp arch/x86/boot/bzImage /path/to/save/vmlinuz

Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #17 on: January 08, 2023, 07:28:47 AM »
I looked at the previous post and found "make -j 2 bzImage". I started recompiling it half an hour ago, so it looks like the problem has been fixed.

Extract the driver file:
With experience:
Code: (bash) [Select]
/5.10.3-tinycore64/kernel/drivers/target/
iscsi(folder) loopback(folder) sbp(folder) tcm_fc(folder)
target_core_file.ko target_core_iblock.ko target_core_mod.ko
target_core_pscsi.ko target_core_user.ko
Extract them, compress them into gz format, copy them to the corresponding path,
edit them /5.10.3-tinycore64/kernel/modules.dep, add the path to the driver file.

Is there a clear way to extract driver files? Thanks!


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Which module supports Linux-IO Target
« Reply #18 on: January 08, 2023, 07:48:48 AM »
Hi qingquan
I want to compress vmliunx (35.200 KB) to make vmliunz (+/-5.400KB),Just like the official website distribution. ...
Then you will have to run  make bzImage  because compression is a compile time option.
vmlinuz  is basically a self extracting file so not all of it is compressed.
Found here:
https://superuser.com/questions/445507/how-do-i-compress-a-vmlinux-kernel-into-vmlinuz

You can see that not all of the file is compressed because there are readable strings
present in the file.

These show up in the first 200 bytes of the file:
Code: [Select]
tc@E310:~$ head -c 200 bbox/tempdir/vmlinuz | strings
Use a boot loader.
Remove disk and press any key to reboot...

These show up in the last 2000 bytes of the file:
Code: [Select]
tc@E310:~$ tail -c 2000 bbox/tempdir/vmlinuz | strings
ng output buffer
Out of memory while allocating input buffer
Out of memory while allocating z_stream
Out of memory while allocating workspace
Kernel is not a valid ELF file
Failed to allocate space for phdrs
32-bit relocation outside of kernel!
Avoiding potentially unsafe overlapping memcpy()!
 -- System halted
Failed to get handle for LOADED_IMAGE_PROTOCOL
Failed to allocate lowmem for boot params
Trying to load files to higher address
Failed to allocate memory for 'pci_handle'
Failed to allocate memory for 'rom'
Unsupported properties proto version
Failed to allocate memory for 'properties'
Failed to allocate memory for 'gdt' structure
Failed to allocate memory for 'gdt'
efi_relocate_kernel() failed!
initrd=
Failed to read rom->vendor
Failed to read rom->devid
efi_main() failed!
exit_boot() failed!
nokaslr
quiet
efi=
nochunk
Failed to handle fs_proto
Failed to open volume
Failed to open file:
Failed to get file info size
Failed to get initrd info
EFI stub: ERROR: Failed to alloc mem for file handle list
Failed to alloc mem for file info
EFI stub: ERROR: Failed to alloc highmem for files
EFI stub: ERROR: We've run out of free low memory
EFI stub: ERROR: Failed to read file
EFI stub: ERROR: Failed to allocate usable memory for kernel.
EFI stub: UEFI Secure Boot is enabled.
EFI stub: ERROR: Could not determine UEFI Secure Boot status.
Unable to allocate memory for event log

Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #19 on: January 08, 2023, 08:02:29 AM »
I've recompiled it with "make -j 2 bzImage",
Replace vmlinuz64 in the iso and start successfully.
old  vmlinuz64      5,241KB
new vmlinuz64     5,442 KB

Now what I'm not sure about is the method of extracting the driver file!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Which module supports Linux-IO Target
« Reply #20 on: January 08, 2023, 08:34:00 AM »
Hi qingquan
Example for packaging a kernel module:
Code: [Select]
mkdir -p /tmp/pkg/usr/local/lib/modules/4.19.10-tinycore64/kernel/drivers/gpu/drm/nouveau
sudo cp nouveau.ko /tmp/pkg/usr/local/lib/modules/4.19.10-tinycore64/kernel/drivers/gpu/drm/nouveau
sudo chown -R root:root /tmp/pkg/usr
cd /tmp
sudo mksquashfs pkg/ nouveau-4.19.10-tinycore64.tcz
sudo chown tc:staff nouveau-4.19.10-tinycore64.tcz

You would replace  4.19.10-tinycore64  with the version that matches your kernel.
If you are not sure what that is, run  uname -r  to find out.

Instead of  drivers/gpu/drm/nouveau  create  drivers/target/iscsi, drivers/target/loopback, etc.
Then copy the drivers into the appropriate folders.

When you make the extension it will be something like this:
Code: [Select]
sudo mksquashfs pkg/ target-5.10.3-tinycore64.tcz
... Extract them, compress them into gz format, ...
The  squashfs  is already a compressed format. Converting to  .gz  just makes the file bigger.

Quote
... edit them /5.10.3-tinycore64/kernel/modules.dep, add the path to the driver file. ...
No need for that.  tce-load  handles that for you.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Which module supports Linux-IO Target
« Reply #21 on: January 08, 2023, 09:33:42 AM »
Just for completeness sake, I checked and "make" builds both the modules and arch/x86_64/boot/bzImage, but not vmlinuz, so vmlinuz is indeed a renamed bzImage.

Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #22 on: January 09, 2023, 08:06:18 PM »
Hi Juanito Rich
Thanks to juanito and Rich for your encouragement and support,
it was with your help that I started my first kernel compilation journey and finally succeeded after hard work.
Here is a summary to share with those who have not compiled the kernel.

Download address:
http://tinycorelinux.net/12.x/x86_64/release/src/kernel/linux-5.10.3-patched.txz
http://tinycorelinux.net/12.x/x86_64/release/src/kernel/config-5.10.3-tinycore64
Code: [Select]
tce-load -iw compiletc.tcz
tce-load -iw perl5.tcz
tce-load -iw ncursesw-dev.tcz
tce-load -iw bc.tcz
tce-load -iw elfutils-dev.tcz

tar -xvJf linux-5.10.3-patched.txz  #Preferably in a Linux partition
cd linux-5.10.3
sudo make mrproper
sudo cp ../config-5.10.3-tinycore64 ./.config
sudo make oldconfig
sudo make menuconfig
I need the module:TARGET CORE
Device Driver-- <M>  Generic Target Core Mod (TCM) and ConfigFS Infrastructure
<M>  TCM/IBLOCK Subsystem Plugin for Linux/BLOCK
<M>  TCM/FILEIO Subsystem Plugin for Linux/VFS
<M>  TCM/pSCSI Subsystem Plugin for Linux/SCSI
<M>  TCM/USER Subsystem  Plugin for Linux
<M>  TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module
<M>  TCM FC fabric Plugin
<M>  Linux-iSCSI.org iSCSI Target Mode Stack
<M>        Chelsio iSCSI target offload driver
<M>  FireWire SBP-2 fabric module
[esc][esc]--[Save]
Code: [Select]
make -j 2 bzImage #Compile kernel
#.............About half an hour..........
sudo cp arch/x86/boot/bzImage ../vmlinuz64

make  -j 2 modules #Compile module(Inclusion drive)
#.............About an hour and a half..........

#(ctrl+insert):copy,In the terminal window,May be useful
#(shift+insert):paste,In the terminal window,May be useful

sudo mkdir ../target
sudo cp -a ./drivers/target/* ../target
#Tidy up the files in target and keep *.ko
cd ..
sudo mkdir -p tmp/pkg/usr/local/lib/modules/5.10.3-tinycore64/kernel/drivers/target
sudo cp -a ./target/*  tmp/pkg/usr/local/lib/modules/5.10.3-tinycore64/kernel/drivers/target
cd tmp
sudo mksquashfs pkg/  iscsi-target.tcz
sudo chown tc:staff iscsi-target.tcz

Keep well vmlinuz64 and iscsi-target.tcz
Repackage to iso with ezremaster.tcz
Code: (bash) [Select]
depmod -n | grep iscsi
All the necessary modules are here. Great!

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 661
Re: Which module supports Linux-IO Target
« Reply #23 on: January 10, 2023, 11:39:38 AM »
Hi Juanito Rich
Thanks to juanito and Rich for your encouragement and support,
it was with your help that I started my first kernel compilation journey and finally succeeded after hard work.
Here is a summary to share with those who have not compiled the kernel.

Thank you for letting us know that you succeeded to compile your own kernel, welcome to the Great Linux Community :)
And you show what commands for making it.

To making this little faster you can maybe.
Have seen some another tips to just compile one module that can been see here.
This applies to the old chip soc, but i think this also applies just to another Linux dist's as well.
I think you need some more files from the old kernel compiling not just config.
I think you also need "Module.symvers"

https://yoursunny.com/t/2018/one-kernel-module/
 
« Last Edit: January 10, 2023, 11:57:58 AM by patrikg »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Which module supports Linux-IO Target
« Reply #24 on: January 10, 2023, 09:04:38 PM »
Unfortunately the Module.symvers trick no longer works with >5.x

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 661
Re: Which module supports Linux-IO Target
« Reply #25 on: January 10, 2023, 11:48:10 PM »
Hi Juanito

Thanks for letting me know and also the community, but sadly then it's not working for newer versions of kernel.


Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #26 on: January 12, 2023, 02:34:15 AM »
Oh, thank you patrikg for joining me. I am a beginner. I started with the application and gradually progressed.

I'm going to configure targetcli on tinycore, which seems like a lot of work and a lot of dependencies.


                                                                                 |--python-pyparsing
                                                                                 |                                   |--filesystem
                                                                                 |--python-urwid----glibc  --linux-api-headers
                                                                                 |                                   |--tzdata
                                                                                 |
                             |--python-configshell-fb>=1.1.fb17-|
                             |
                             |                        |--dbus
                             |                        |
                             |--python-dbus  --glib2
                             |                        |
                             |                        |--gobject-introspection-runtime   
                             |
  targetcli-fb-2.1.54  --python-gobject
                             |
                             |                                             
                             |                                            |--python-pyudev
                             |                                            | 
                             |--python-rtslib-fb>=2.1.fb52  --python-six
                                                                          |
                                                                          |--systemd  --acl
                                                                                           |--audit
                                                                                           |--bash
                                                                                           |--cryptsetup
                                                                                           |--dbus
                                                                                           |--hwdata
                                                                                           |--iptables
                                                                                           |--kbd
                                                                                           |--kmod
                                                                                           |--libacl.so
                                                                                           |--libaudit.so
                                                                                           |--libblkid.so
                                                                                           |--libcap
                                                                                           |--libcap.so
                                                                                           |--libcrypt.so
                                                                                           |--libcrypto.so
                                                                                           |--libcryptsetup.so
                                                                                           |--libelf
                                                                                           |--libgcrypt
                                                                                           |--libidn2
                                                                                           |--libkmod.so
                                                                                           |--libmount.so
                                                                                           |--libp11-kit
                                                                                           |--libp11-kit.so
                                                                                           |--libseccomp
                                                                                           |--libseccomp.so
                                                                                           |--libssl.so
                                                                                           |--libxcrypt
                                                                                           |--lz4
                                                                                           |--openssl
                                                                                           |--pam
                                                                                           |--pcre2
                                                                                           |--systemd-libs
                                                                                           |--util-linux
                                                                                           |--xz
             
« Last Edit: January 12, 2023, 02:37:44 AM by qingquan »

Offline gadget42

  • Hero Member
  • *****
  • Posts: 657
Re: Which module supports Linux-IO Target
« Reply #27 on: January 12, 2023, 03:03:10 AM »
Oh, thank you patrikg for joining me. I am a beginner. I started with the application and gradually progressed.

I'm going to configure targetcli on tinycore, which seems like a lot of work and a lot of dependencies.

Code: [Select]
                                                                                 |--python-pyparsing
                                                                                 |                                   |--filesystem
                                                                                 |--python-urwid----glibc  --linux-api-headers
                                                                                 |                                   |--tzdata
                                                                                 |
                             |--python-configshell-fb>=1.1.fb17-|
                             |
                             |                        |--dbus
                             |                        |
                             |--python-dbus  --glib2
                             |                        |
                             |                        |--gobject-introspection-runtime   
                             |
  targetcli-fb-2.1.54  --python-gobject
                             |
                             |                                             
                             |                                            |--python-pyudev
                             |                                            | 
                             |--python-rtslib-fb>=2.1.fb52  --python-six
                                                                          |
                                                                          |--systemd  --acl
                                                                                           |--audit
                                                                                           |--bash
                                                                                           |--cryptsetup
                                                                                           |--dbus
                                                                                           |--hwdata
                                                                                           |--iptables
                                                                                           |--kbd
                                                                                           |--kmod
                                                                                           |--libacl.so
                                                                                           |--libaudit.so
                                                                                           |--libblkid.so
                                                                                           |--libcap
                                                                                           |--libcap.so
                                                                                           |--libcrypt.so
                                                                                           |--libcrypto.so
                                                                                           |--libcryptsetup.so
                                                                                           |--libelf
                                                                                           |--libgcrypt
                                                                                           |--libidn2
                                                                                           |--libkmod.so
                                                                                           |--libmount.so
                                                                                           |--libp11-kit
                                                                                           |--libp11-kit.so
                                                                                           |--libseccomp
                                                                                           |--libseccomp.so
                                                                                           |--libssl.so
                                                                                           |--libxcrypt
                                                                                           |--lz4
                                                                                           |--openssl
                                                                                           |--pam
                                                                                           |--pcre2
                                                                                           |--systemd-libs
                                                                                           |--util-linux
                                                                                           |--xz
           

maybe there is a distribution that already has all this?  perhaps?
https://distrowatch.com/search.php
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline qingquan

  • Newbie
  • *
  • Posts: 35
Re: Which module supports Linux-IO Target
« Reply #28 on: January 12, 2023, 03:38:33 AM »
Quote
maybe there is a distribution that already has all this?  perhaps?
https://distrowatch.com/search.php

The website you provided is good, but I can't find "targetcli",
is the distribution you are referring to "targetcli"? Or maybe
I got it wrong. I need "targetcli", or something about it.

 thanks!