I dont use git. I wget the kernel and signature from kernel.org to my home directory. Then cp the verified and unpacked tar file to /usr/src. In there the usual sudo make -j4 all, sudo make modules install. Copy the System-map and arch/x86/boot/bzImage to /boot. And finally edit and run lilo. This has always worked without any problem but if I try to reproduce those steps but doing the compilation phase with my user (or even fakeroot) in my /home dir, always results in a corrupted xz image error when i boot. I suspected it was ownership issues compiling as regular user but not sure about that anymore. On 3/17/21 2:37 PM, Steffen Nurpmeso wrote:
Erich Eckner wrote in <a44ccda3-bfd9-32d3-bb91-446a5d93a7@eckner.net>: |On Wed, 17 Mar 2021, Prophet wrote: |> Sorry for this newbie question. | |nothing to be sorry for. | |> Not sure if this is related to Crux but I always compiled the kernel \ |> using |> sudo and never had any problems. Recently decided to try fakeroot \ |> and always |> get corrupted xz image at boot. Is the kernel supposed to be always \ |> compiled |> as root in Crux? What am I missing here? | |You should be able to compile the kernel as any user (no need for |fakeroot). The installation requires root, though (assuming, /boot is |owned by root, as it should be). I'm doing as a regular user: | |make oldconfig |make | |and then run as root: | |install -m644 --owner=root $kernelImage /boot/vmlinuz-$version |grub-mkconfig -o /boot/grub/grub.cfg
Yeah -- maybe the wrong (uncompressed) kernel?
|Note, that I do not have an initramdisk, but it should work similarily if |you have one.
Me neither (yet). I compile the kernel as "ports":
hn=$(uname -n) ln=linux-version-as-major-minor objdir=/tmp/linuxobj
cp /root/hosts/$hn/linux-$ln.config \ /usr/src/linux-$ln/.$hn-$ln.config || exit 2 chown ports:ports /usr/src/linux-$ln/.$hn-$ln.config || exit 3
[ -x /root/bin/cpupower.sh ] && /root/bin/cpupower.sh hi sudo -u ports sh -c ' ( objdir='$objdir' cd /usr/src/linux-'$ln' || exit 10 if [ -d $objdir ]; then if [ -n "$_cleanup" ]; then ( cd $objdir && make mrproper ) fi else mkdir -p $objdir || exit 1 fi printf -- "-'$hn'\n" > $objdir/localversion-build || exit 3 cp .'$hn-$ln'.config $objdir/.config || exit 2 #sudo -u ports make O=$objdir listnewconfig oldconfig || exit 4 # Documentation/admin-guide/README.rst: "make localmodconfig" #[lsmod>f; LSMOD=f ]make O=$objdir localyesconfig oldconfig || exit 4 nice -n +10 make O=$objdir oldconfig || exit 4 cd $objdir || exit 5 time nice -n +10 make -j`getconf _NPROCESSORS_ONLN` ) 2>&1 ' [ -x /root/bin/cpupower.sh ] && /root/bin/cpupower.sh default
followed by (well it is all optional ;) copies as "root":
cp $objdir/arch/x86/boot/bzImage $efipart/$hn-$xln-new.efi cp $objdir/System.map $efipart/System.map-$version-$hn ... make modules_install (none, actually)
|What exactly are you trying, that fails? I had problems in the past with |left-over files from previous compilations - a `git clean -xdf .` did |help, there.
cleanup is then
if [ -n "$_cleanup" ]; then rm -rf /tmp/.$hn-fw if [ "${objdir%/*}" = /tmp ]; then rm -rf $objdir else ( cd $objdir make mrproper ) >/dev/null fi fi
Anyhow, kernel building is not yet boxed. I use efibootmgr:
if [ -n "$_efiactive" ]; then if command -v efibootmgr >/dev/null 2>&1 && { efibootmgr | grep -q $hn-$ln-new; }; then bn=`efibootmgr | grep $hn-$ln-new | sed -Ee 's/^Boot([[:digit:]]+).+$/\1/'` efibootmgr -v -n $bn fi fi
Well i install the kernel as -new, and boot it once. When booting succeeds with the right kernel, it is moved automatically:
{ i=1 while :; do ( set -C : > /root/hosts/$hn/.rc-late-hook-$i ) >/dev/null 2>&1 && break i=$((i + 1)) done
printf " v=\`uname -r | cut -d- -f1\` if [ \"\$v\" = \"$version\" ]; then if [ "$efipart" != /boot ];then mount $efipart else mount -o remount,rw "$efipart" fi [ -f $efipart/$hn-$xln-new.efi ] && mv -f $efipart/$hn-$xln-new.efi $efipart/$hn-$xln.efi if [ "$efipart" != /boot ]; then umount $efipart else mount -o remount,ro "$efipart" fi exit 0 else echo >&2 'NOT moving kernel on EFI ('$efipart')!' exit 1 fi " > /root/hosts/$hn/.rc-late-hook-$i }
Works pretty nice in practice ever since. Yay!
--steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) _______________________________________________ CRUX mailing list CRUX@lists.crux.nu https://lists.crux.nu/mailman/listinfo/crux