Difference between revisions of "User:Oogwaymaki/Kernel Installation"

From PINE64
Jump to navigation Jump to search
Line 55: Line 55:
# mkdir debianboot
# mkdir debianboot
# mount /dev/sda1 /media/debianboot
# mount /dev/sda1 /media/debianboot
# cd /
# cd /usr/src
# mkdir -p j .
# mkdir initrd
# cd /usr/src/initrdimage
# cd /usr/src/initrd
# cp /media/debianboot/initrd.img-5.7-pinephone  .
# cp /media/debianboot/initrd.img-5.7-pinephone  .
# zcat initrd.img-5.7-pinephone | cpio -idmv  
# zcat initrd.img-5.7-pinephone | cpio -idmv  
# rm initrd.img-5.7-pinephone  
# rm initrd.img-5.7-pinephone  
# cd /usr/src/initrdimage/lib/modules
# cd /usr/src/initrd/lib/modules
# rm -rf /usr/src/initrdimage/lib/modules/5.7-pinephone
# rm -rf /usr/src/initrd/lib/modules/5.7-pinephone
# rsync -avh pp2-5.8/modules/lib/modules/ initrd/lib/modules/
# rsync -avh pp2-5.8/modules/lib/modules/ initrd/lib/modules/


Line 77: Line 77:
</pre>
</pre>


Copy the pp 2.8 kernel and dab definition files to Mobian boot folder and update the boot.scr
<pre>
# cp pp2-5.8/board.dtb /media/mobianroot/boot/
# cp pp2-5.8/Image /media/mobianroot/boot/
# cp /media/mobianboot/boot.cmd /media/mobianroot/boot
# cd /media/mobian/root/boot
</pre>
Change the old boot.cmd to the new settings:
<pre>
if test ${mmc_bootdev} -eq 0; then
echo "Booting from SD"
setenv linux_mmcdev 0
else
echo "Booting from eMMC"
setenv linux_mmcdev 2
fi
# If we have at least 2 partitions, then the 1st one is /boot, and / is #2
if fstype mmc ${mmc_bootdev}:2; then
setenv rootpart 2
else
setenv rootpart 1
setenv bootdir "/boot"
fi
setenv bootargs console=ttyS0,115200 no_console_suspend panic=10 consoleblank=0 loglevel=7 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0
led 1 on
echo "Loading kernel..."
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/Image.gz
echo "Uncompressing kernel..."
unzip ${ramdisk_addr_r} ${kernel_addr_r}
echo "Loading initramfs..."
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/initrd.img
setenv ramdisk_size ${filesize}
echo "Loading dtb..."
load mmc ${mmc_bootdev}:1 ${fdt_addr_r} ${bootdir}/dtb/${fdtfile}
led 2 on
echo "Booting..."
booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r}
</pre>
Remove the old boot.cmd
<pre>
# rm boot.cmd
</pre>
to this, we removed the configuration of the first disk we won't be using it
we also pointed everything to second disk for kernel and boot images
<pre>
setenv ftdfile board.dtb
if test ${mmc_bootdev} -eq 0; then
echo "Booting from SD"
setenv linux_mmcdev 0
else
echo "Booting from eMMC"
setenv linux_mmcdev 2
fi
setenv boot_dir /boot
setenv bootargs console=ttyS0,115200 no_console_suspend panic=10 consoleblank=0 loglevel=7 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0
led 1 on
echo "Loading kernel..."
load mmc ${mmc_bootdev}:2 ${ramdisk_addr_r} ${bootdir}/Image.gz
echo "Uncompressing kernel..."
unzip ${ramdisk_addr_r} ${kernel_addr_r}
echo "Loading initramfs..."
load mmc ${mmc_bootdev}:2 ${ramdisk_addr_r} ${bootdir}/initrd.img
setenv ramdisk_size ${filesize}
echo "Loading dtb..."
load mmc ${mmc_bootdev}:2 ${fdt_addr_r} ${ftdfile}
led 2 on
echo "Booting..."
booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r}
</pre>
Save new boot.cmd to boot folder
make new script
# mkimage
== References ==  
== References ==  


* https://access.redhat.com/solutions/24029
* https://access.redhat.com/solutions/24029

Revision as of 23:07, 29 June 2020

Installing Megi's pre-compiled kernel

This tutorial is based on Debian Linux package management:

Install dependencies:

  • u-boot-tools allows you to make images
  • rsync allows you to copy and backup
# apt-get update
# apt-get install rsync u-boot-tools

First, download the the PinePhone CE (1.2) Kernel:

# wget https://xff.cz/kernels/5.8/pp2.tar.gz


Extract the kernel:

Create a separate folder for organization and separation: Extract the a "tar" "gz" file using tar.

# tar -zxvf pp2.tar.gz 

A default Mobian Installation looks like this:

Device     Boot  Start     End Sectors   Size Id Type
/dev/sda1  *      1953  250000  248048 121.1M 83 Linux
/dev/sda2       250001 7421874 7171874   3.4G 83 Linux

Notice the small size on the /boot partition.

This means we probably will have to, either kill the partition or resize both partitions:

Easiest thing to do:

Please all all the new files on the /dev/sda2 (they'll probably be more than 121 M)

Next we need to update the initrd image, to have the new modules, (the initrd image is a RAM disk helping the system to boot and needs kernel drivers while booting):

How to get and update initrd image:

Mount Mobian boot image: Make sure your the root user for this for ease of installation: Delete the old kernel modules and put the new latest ones there

# mkdir debianboot
# mount /dev/sda1 /media/debianboot
# cd /usr/src
# mkdir initrd
# cd /usr/src/initrd
# cp /media/debianboot/initrd.img-5.7-pinephone  .
# zcat initrd.img-5.7-pinephone | cpio -idmv 
# rm initrd.img-5.7-pinephone 
# cd /usr/src/initrd/lib/modules
# rm -rf /usr/src/initrd/lib/modules/5.7-pinephone
# rsync -avh pp2-5.8/modules/lib/modules/ initrd/lib/modules/

Repackage the Mobian Boot Image after new kernel modules installed and copy over to main mobian image now


# find . | cpio -o -c | gzip -9 > initrd.img-5.8-pinephone
# mkdir /media/mobianroot
# mount /dev/sda2 /media/mobianroot
# cp initrd/initrd.img-5.8-pinephone /media/mobianroot/boot/


Copy the pp 2.8 kernel and dab definition files to Mobian boot folder and update the boot.scr

# cp pp2-5.8/board.dtb /media/mobianroot/boot/
# cp pp2-5.8/Image /media/mobianroot/boot/
# cp /media/mobianboot/boot.cmd /media/mobianroot/boot
# cd /media/mobian/root/boot

Change the old boot.cmd to the new settings:

if test ${mmc_bootdev} -eq 0; then
	echo "Booting from SD"
	setenv linux_mmcdev 0
else
	echo "Booting from eMMC"
	setenv linux_mmcdev 2
fi

# If we have at least 2 partitions, then the 1st one is /boot, and / is #2
if fstype mmc ${mmc_bootdev}:2; then
	setenv rootpart 2
else
	setenv rootpart 1
	setenv bootdir "/boot"
fi

setenv bootargs console=ttyS0,115200 no_console_suspend panic=10 consoleblank=0 loglevel=7 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0

led 1 on

echo "Loading kernel..."
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/Image.gz

echo "Uncompressing kernel..."
unzip ${ramdisk_addr_r} ${kernel_addr_r}

echo "Loading initramfs..."
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} ${bootdir}/initrd.img
setenv ramdisk_size ${filesize}

echo "Loading dtb..."
load mmc ${mmc_bootdev}:1 ${fdt_addr_r} ${bootdir}/dtb/${fdtfile}

led 2 on

echo "Booting..."
booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r}

Remove the old boot.cmd


# rm boot.cmd

to this, we removed the configuration of the first disk we won't be using it we also pointed everything to second disk for kernel and boot images

setenv ftdfile board.dtb

if test ${mmc_bootdev} -eq 0; then
	echo "Booting from SD"
	setenv linux_mmcdev 0
else
	echo "Booting from eMMC"
	setenv linux_mmcdev 2
fi

setenv boot_dir /boot

setenv bootargs console=ttyS0,115200 no_console_suspend panic=10 consoleblank=0 loglevel=7 root=/dev/mmcblk${linux_mmcdev}p${rootpart} rw splash plymouth.ignore-serial-consoles vt.global_cursor_default=0

led 1 on

echo "Loading kernel..."
load mmc ${mmc_bootdev}:2 ${ramdisk_addr_r} ${bootdir}/Image.gz

echo "Uncompressing kernel..."
unzip ${ramdisk_addr_r} ${kernel_addr_r}

echo "Loading initramfs..."
load mmc ${mmc_bootdev}:2 ${ramdisk_addr_r} ${bootdir}/initrd.img
setenv ramdisk_size ${filesize}

echo "Loading dtb..."
load mmc ${mmc_bootdev}:2 ${fdt_addr_r} ${ftdfile}
led 2 on

echo "Booting..."
booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${ramdisk_size} ${fdt_addr_r}

Save new boot.cmd to boot folder

make new script

  1. mkimage

References