quarkscript / linux-armv7-xe303c12-only

Linux kernel for old google-snow chromebook
GNU General Public License v2.0
18 stars 2 forks source link

How was this all implemented? Is it possible for myself to do the exact same/replicate for an XE503C12? #9

Open TheNathan0 opened 2 years ago

TheNathan0 commented 2 years ago

Hi!

I really like the project you have going for the XE303C12 here. I'm excited to see where this project goes and I think it's truly a great project.

I was wondering on how everything was pulled off (including hardware acceleration) the older XE303C12 ChromeBooks under Arch and Void Linux because I'd like to attempt to implement/replicate the same thing for my XE503C12 ChromeBook and hopefully also achieve hardware acceleration with the Mali GPU (its GPU is a Mali T628 MP6).

Currently at the time of writing, hardware acceleration on Peach-Pit is not very heard of at all. I'm not requesting added support for the XE503C12 since your project clearly states that it is for the XE303C12 only, but any information on how to do the same for the XE503C12 would be greatly appreciated.

Thanks and I hope you have a great day! -Nathan

quarkscript commented 2 years ago

Hi!

I guess it is not complicated to reconfigure the kernel build script. For that you will need your own kernel config or you can reconfigure the existing one during the build process. Kernel config for archlinuxarm is config and for void-linux it is files/arm-dotconfig-custom you may replace its contents with https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/linux-armv7/config for example. You also need the corresponding fdt-blobs and kernel.its.

For example, archlinuxarm kernel PKGBUILD from this repo could be changed like this: line 3 - pkgbase=linux-xe503c12 line 7 - _desc="ARMv7 XE503C12-platform" line 71 - make ${MAKEFLAGS} zImage modules exynos5420-peach-pit.dtb exynos5800-peach-pi.dtb line 100 - install -D arch/$KARCH/boot/dts/exynos5420-peach-pit.dtb -m755 "${pkgdir}/boot/dtbs/exynos5420-peach-pit.dtb" line 101 - install -D arch/$KARCH/boot/dts/exynos5800-peach-pi.dtb -m755 "${pkgdir}/boot/dtbs/exynos5800-peach-pi.dtb" line 155 - description = "exynos5420-peach-pit.dtb"; line 156 - data = /incbin/("/boot/dtbs/exynos5420-peach-pit.dtb"); line 165 - description = "exynos5800-peach-pi.dtb"; line 166 - data = /incbin/("/boot/dtbs/exynos5800-peach-pi.dtb") The last 4 changes must be made in kernel.its too ( same replaces )

line 54 in the PKGBUILD will allow you to tweak the kernel config during build

As for Void-Linux for example rename dir linux_xe303c12 to linux_xe503c12, then mod template like: line 2 - pkgname=linux_xe503c12 line 6 - short_desc="Linux kernel and modules and headers (${version%.*} for XE503C12 armv7hf Chromebook)" For tweak kernel config during build place next line before line 116 make ${makejobs} ARCH=$arch menuconfig

then at files/post-install mod next lines: line 46 - description = "exynos5420-peach-pit.dtb"; line 47 - data = /incbin/("/boot/dtbs/exynos5420-peach-pit.dtb"); line 56 - description = "exynos5800-peach-pi.dtb"; line 57 - data = /incbin/("/boot/dtbs/exynos5800-peach-pi.dtb") and same changes must be made to files/kernel.its too

If I haven't forgotten something, this should be enough to build the kernel for XE503C12 using the regular build method

Regarding 3D acceleration https://gitlab.freedesktop.org/mesa/mesa/-/issues/5269 - latest answer from mesa developer, I tried it with patch https://github.com/quarkscript/linux-armv7-xe303c12-only/blob/master/archlinuxarm/some_forked_apps/mesa/gpuac.patch You may add the following line to the patch just to be sure: + case 0x628: /* try an unsupported GPU */ apply this patch to any upstream mesa source code and build it

TheNathan0 commented 2 years ago

Should I just use the kernel config you linked above? https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/linux-armv7/config

I noticed the same GPU listed twice in the patch you linked but with a different number beside the case variable - https://github.com/quarkscript/linux-armv7-xe303c12-only/blob/master/archlinuxarm/some_forked_apps/mesa/gpuac.patch + case 0x600: /* T60x - try unsupported gpu*/ + case 0x604: /* T60x - try unsupported gpu*/

quarkscript commented 2 years ago

This config should be universal for armv7 devices supported by archlinuxarm. However, a few versions of Linux kernel have changed and this config may partly losing relevance, so adjustment may be required. This config defines the compressing of the kernel modules that the Void Linux may not support, so it is better to turn off the compression of modules for Void-linux.

Mesa developer pointed 0x600 as the identifier of the GPU family, but I did not notice hw-acceleration with it, so by analogy with other options in the source file I added a specific GPU identifier. I guess " case 0x628: " should cover your GPU.

Between and / should not be spaces i.e. / some comment */ sorry, my mistake.

TheNathan0 commented 2 years ago

Using the ArchLinux config, is it normal that I got a flood of kernel related questions before it began compiling? It was a lot of questions and I only pressed enter to get defaults because I didn't know what to answer them with.

TheNathan0 commented 2 years ago

image

I got this error when when trying ./xbps-src -a armv7hf pkg linux_xe503c12

image

Trying it again, I got this error

I'm still not sure if I was meant to get a flood of messages at the beginning of compiling when I did ./xbps-src -a armv7hf build linux_xe503c12

quarkscript commented 2 years ago

Lots of kernel related questions - it's okay for a config to be partially out of date. In most cases, the default answer is good enough, otherwise it's better to know why this particular driver or feature is needed.

It looks like the kernel compiled successfully. The problem is that it cannot find the dtbs. I think the following lines in the template should be changed too line 136-139

    make ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs dtbs_install
    #mkdir -p ${DESTDIR}/boot/dtbs
    #vinstall arch/arm/boot/dts/exynos5250-snow.dtb 755 boot/dtbs/
    #vinstall arch/arm/boot/dts/exynos5250-snow-rev5.dtb 755 boot/dtbs/

When xbps-src fails to build the package, it does not clear the build directory. This is the reason for the errors in the second screenshot. I haven't tracked where it is in masterdir, so I suggest manually deleting masterdir and reinitializing it like ./xbps-src binary-bootstrap or maybe you know a better way

TheNathan0 commented 2 years ago

image

With the changes made that you suggested, I get this error

TheNathan0 commented 2 years ago

@quarkscript Hey, I'd just like to know as well on how to setup the ArchLinux as well. I cannot find an ArchLinux guide but I did use (and am following) the Void Linux guide you posted on the GitHub. I've never done ArchLinux compiling before like this so I don't really know where to start and how to do it.

Thanks!

-- Nathan

TheNathan0 commented 2 years ago

image

Sorry for the messages here, but it just failed again (tried it again). The script seemed to progress further and get to this.

quarkscript commented 2 years ago

@TheNathan0, don't worry.

I will try to build it myself.

As for archlinuxarm https://archlinuxarm.org/platforms/armv7/samsung/samsung-chromebook-2 but do not expext too mach from it. Anyway some described installation steps needed to be done, like

quarkscript commented 2 years ago

The problem was that the paths in kernel.its are slightly different, same true for archlinuxarm too. data = /incbin/("arch/arm/boot/dts/exynos5420-peach-pit.dtb"); data = /incbin/("arch/arm/boot/dts/exynos5800-peach-pi.dtb");

https://github.com/quarkscript/linux-armv7-xe303c12-only/releases/tag/experiment_xe503_voidlinux By the way .xbps looks like .tar.zst so in case unable to install it from chroot it is possible to extract it with tar, place files to root partition, flash kernel manually and try boot

I have compiled packages for archlinuxarm from archlinuxarm by running makepkg in the folder where the PKGBUILD is located. I've never tried cross-compiling it.

TheNathan0 commented 2 years ago

Thank you so much for the update. I'll give ArchLinuxARM a try later. What is the kernel file I need to manually flash or do I need to compile that? (The link you provided only shows rootfs and what also looks to be a few files to build the kernel alongside it on GitHub). I notice very few files after extracting that xbps file. Did you do the Mali T628 modification for the MESA package or do I need to do that myself once for my VOID install?

quarkscript commented 2 years ago

xbps file at that link is just a kernel package. Since there is no installer or official disk image of Void-linux for Chromebooks, to get your own copy of Void-linux you need to follow the installation steps from archlinuxarm-wiki, but use the Void-linux armv7 rootfs tarball and the Void-linux kernel package instead of those from archlinuxarm. Void-linux rootfs tarball https://alpha.de.repo.voidlinux.org/live/current/void-armv7l-ROOTFS-20210930.tar.xz

Or you can use the one already built for xe303c12 and place your kernel on it. For example:

After all that, you may unmount rootfs, plug your external media to Chromebook, press power button, press Ctrl+U and try to boot

Anyways, the Chromebook won't boot from external media without switching it to developer mode and enabling USB booting.

I did not rebuild mesa.

quarkscript commented 2 years ago

I rebuilt the mesa with the patch, its packages are on the same link as the kernel package

TheNathan0 commented 2 years ago

Rewrite of the reply (from some time ago); what should be done from here with this info? Also, in addition to this, should Wayland be focused more or is Xorg the way to go for this project?

quarkscript commented 2 years ago

I don't think wayland supports mali, so I suggest using xorg.

To install mesa, you need to install all packages libglapi.xbps libOSMesa .xbps mesa-* .xbps but since all this is probably obsolete, it may conflict with packages from Void-linux repositories

You may try to rebuild it by yourself. Instruction of building Void-linux packages at title page. mesa_pkg_script.zip is a package build script for mesa, needed to be unpack to src-dir. To build new mesa version you need to edit template file and write a new version=21.3.3 checksum=ad7f4613ea7c5d08d9fcb5025270199e6ceb9aa99fd72ee572b70342240a8121 and i am not sure about patch compatibility... link I can not do this by myself right now, sorry, i am from Ukraine and Ukraine at war now

TheNathan0 commented 2 years ago

You do not need to apologize at all. I wish you the best, truly.

I am really sorry about what's going on in your country. I know that it's hard.

If you ever need anything, I will do my best to be help.