Hi
a couple of years ago, as coreplayer2's kernel-env TCE was no longer maintained,
I posted a kernel environment script. Script was a copy of paste from the terminal and I failed to noticed I left out some $ signs....very naughty and missed gettext.
I have corrected this below and its no longer a script. Then I built a out-of-tree module for usb dongle and can't find dongle to test fresh K module.
Run all commands as root if interested
Code:
KC=config-5.15.10-tinycore64
KM=Module.symvers-5.15.10-tinycore64.gz
KP=linux-5.15.10-patched.txz
KV=$(uname -r)
KB=/lib/modules/$KV/build
LB=/lib/modules/build
REPO=http://www.tinycorelinux.net/13.x/x86_64/release/src/kernel
SRC=/usr/src
SYM1=/lib/modules/build
SYM2=/lib/modules/$KV/build
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc wget glibc_apps automake bash ncursesw-dev xz bc elfutils-dev gettext"
for Z in $LIST
do
su -c "tce-load -i $Z" $USER
done
su -c "/usr/local/bin/wget -nc --no-check-certificate \
$REPO/$KP \
$REPO/$KC \
$REPO/$KM " $USER
# now copy those downloads please
echo 'unpacking kernel takes awhile and delete tar file'
xz -d linux-5.15.10-patched.txz
tar xvf linux-5.15.10*tar
rm -rf linux-5.15.10-patched.tar
echo 'unpacking module file'
gunzip $KM
echo 'start /usr/src stuff'
mkdir /usr/src
mv linux-5.15.10 /usr/src
cd $SRC/linux*
echo 'make mrproper, make oldconfig, make prepare and make modules_prepare takes seconds each'
make mrproper # seconds
mv /tmp/$KC .config
make oldconfig # seconds
make prepare # 10 seconds
make modules_prepare # seconds
mv /tmp/*symvers* Module.symvers
echo 'next command takes yonks....about 2 hours subject to PC hardware '
make SUBDIRS=scripts/mod
export KBUILD=/usr/src/linux-${KV%%-*}
cd /
ln -s $KBUILD $SYM1 && ln -s $KBUILD $SYM2
# After script completes....I recommend copy /usr/src to your persistent dir
# as compile takes so long
# then on reboot or when needed use root powers to copy backup of /usr/src back to its correct dir
# and then repeat below
# KV=$(uname -r)
# SYM1=/lib/modules/build
# SYM2=/lib/modules/$KV/build
# export KBUILD=/usr/src/linux-${KV%%-*}
# ln -s $KBUILD $SYM1 && ln -s $KBUILD $SYM2 using root powers
ls -al /lib/modules/build
# expect to see
# /lib/modules/build -> /usr/src/linux-5.15.10
ls -al /lib/modules/5.15.10-tinycore64/build
# expect to see
# /lib/modules/5.15.10-tinycore64/build -> /usr/src/linux-5.15.10