quarkscript / linux-armv7-xe303c12-only

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

Trying to enable KVM on my Samsung Chromebook ARM "SNOW" model XE303C12 #18

Open Marietto2008 opened 1 year ago

Marietto2008 commented 1 year ago

Hello.

I would like to enable KVM on my old but still functional "Samsung Chromebook ARM model XE303C12 SNOW" because later I want to virtualize FreeBSD with qemu and kvm. I've installed the image file "xe303c12_devu_xfce_1882M_btrfs_5.15.79.img.gz" on my cromebook. it works great. Now the challenge is to be able to enable kvm on this kernel. I know that the support for KVM for arm32 has been removed starting from some version of the 5.x branch. And a greater challenge is to be able to make work the patch to put the bootloader in hypervisor mode. So,I would like to know if your image files are enough good to offer what I would like. Is just enough to recompile the kernel that you have used in your "xe303c12_devu_xfce_1882M_btrfs_5.15.79.img.gz" to enable KVM ? I know that a patch to put the bootloader in hyp mode is needed. Did you already patch the bootloader files ? if not,do you know about a tutorial that teaches me how to do that ? I've found this patch that may be appropriated :

https://github.com/sleirsgoevy/exynos-kvm-patch

but I'm not sure if it will work or not. Please shed a light on me. Thanks.

quarkscript2 commented 1 year ago

Hello.

According to https://lists.gnu.org/archive/html/qemu-devel/2020-09/msg04932.html and https://www.phoronix.com/news/Linux-5.7-Kill-32-bit-ARM-KVM for KVM linux kernel version should be less than 5.7 and qemu version less than 5 .

I did recompile kernel from longterm support branch with enabled kvm settings. But that old branch has outdated btrfs filesystem driver. So there is needed to change rootfs filesystem type to ext4 othervise system will stuck at boot.

kernel - 5.4.244-kvm.zip

As for qemu, maybe one of Debian oldstable release contains required version of qemu or it could be build by yourself, since source code is available https://download.qemu.org/ .

As i know there exists (non-verified) nv-u-boot for that Chromebook that could be recompiled. But i never do it.

Maybe a linux container / chroot could be a solution too.

Marietto2008 commented 1 year ago

Hello. This project has a long story. I've started to work on it 1.5 years ago,here :

https://github.com/hexdump0815/linux-mainline-on-arm-chromebooks/issues/3

At certain point I've left because its complexity. You talked about the "non verified" nv-u-boot for chomebook. The only one that I've found is very old and it is stored here :

http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/

after several tries,I've reached the conclusion that it works only for the kernel used by the virtual open systems,that's very old. It's the 3.x branch. So it will never work with a newer kernel. But look at this patch :

https://github.com/sleirsgoevy/exynos-kvm-patch

Does it seems to be close to the patch that we need to enable the hypervisor mode on the bootloader ? he says that it can work with every exynos cpus with minor changes. What do you think ?

---> As i know there exists (non-verified) nv-u-boot for that Chromebook that could be recompiled. But i never do it.

can you tell me where it is ? I could document myself,I can ask and I can learn how to recompile it. Thanks.

quarkscript2 commented 1 year ago

I tried this patch with linux kernel 5.4.244 but got only errors. exynos7870 is ARMv8-A and exynos5250 is ARMv7 architecture. I suppose chance is not hight that patch will work with older hw even if required kernel source will be found.

https://chromium.googlesource.com/playground/chromium-org-site/+/refs/heads/main/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook.md

Virtual Open Systems has its own github account. Maybe could be finded a commit that switches required registers https://github.com/virtualopensystems/u-boot-arndale/commits/lue_arndale-kvm?before=affeaad51746944e8c356091b12ff9c9c6183c4a+35&branch=lue_arndale-kvm&qualified_name=refs%2Fheads%2Flue_arndale-kvm But it is just my assumption.

Marietto2008 commented 1 year ago

it's too technical for me. I should ask if and how to use that code to enable kvm on a higher kernel version,even if I doubt the developers want to reply. It comes from 2012. Anyway,thanks man,you gave me good suggestions.

quarkscript2 commented 1 year ago

Answer to this question requres more knoledge than i have. I suppose Linux kernel 5.4 with turned on kvm and old qemu with kvm support for arm (32bit) is the best result that can be achieved with this hw in resonable time.

Marietto2008 commented 1 year ago

What do you mean ? maybe I didn't understand well. At the moment you see possible to enable KVM on the linux kernel 5.4 ? I didn't understand how to do that. I didnd't understand the "u-boot" part. Where I can get the patched code ? As I said the code on the virtual open system github,that I have already tried, works only for the kernel 3.x

quarkscript2 commented 1 year ago

I mean i am personally do not know how to implement that into nv-u-boot and not know is it required with newer kernels than 3.x. And backporting kvm for armv7 to recent linux kernel like 6.x may require a huge amount of time. So in my opinion it is better to stick at kernel ver less than 5.7 Kernel ver 5.4.244 attached earlier succesfully boots with ext4 type of rootfs on my chromebook and i have enabled kvm there by standart kernel tools. screen-2023-06-01-14-49-28 screen-2023-06-01-14-49-40 But have no qemu with supported kvm on armv7 so i can't check is it really work or just declared as work.

If you do not want to try already compiled and want to compile that kernel by yourself you may do this for example from x86/x84_64 Kali linux (or Debian...) with https://github.com/quarkscript/xe303c12_play_linux and config from attached earlier zip file. But on "gadebli" script some lines should be modified:

and do not use |& tee -a build.log because it may interfere with kernel config tool; rcn patches was not used in my case. Link to kernel source https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.244.tar.xz

Marietto2008 commented 1 year ago

I'm planning to restart from the beginning,as explained on the main and maybe only tutorial that should work,on the virtual open system website,where they used kernel 3.3 and the patched u-boot. Once it will work,I will update this post,if you want. We can take that old installation as a solid base to improve it with an higher kernel and a recompiled bootloader. To be continued....

Marietto2008 commented 1 year ago

I've restarted to follow this tutorial : (I'm using ubuntu 14.04 as host os)

http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/

I've got this kernel conf file : http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/config

and I've placed inside this folder : /home/marietto/Scrivania/chromebook/linux-kvm-arm

at this point with nano I saw that at the end of the file there are the kvm entries :

nano .config

# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.13.0-rc8 Kernel Configuration
#
.....
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_KVM_MMIO=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_ARM_HOST=y
CONFIG_KVM_ARM_MAX_VCPUS=4
CONFIG_KVM_ARM_VGIC=y
CONFIG_KVM_ARM_TIMER=y

as you can see it is for the kernel 3.13. it's ok for now,let's start from the beginning.

At this point I do :

root@marietto-Z87-HD3:/home/marietto/Scrivania/chromebook/linux-kvm-arm# make menuconfig

and I see that the KVM entries aren't specified :

350803432_545175114272074_3054239681728126395_n

where are them ?

quarkscript2 commented 1 year ago

I assume that you have installed cross compiler. config should be .config (with dot at beginning) and commands like

export CROSS_COMPILE=arm-linux-gnueabihf-
make ARCH=arm menuconfig

or

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
make menuconfig

or CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make menuconfig

You may add -j5 after 'make' command for faster compiling, 5 mean count of used cpu cores for compiling.

Marietto2008 commented 1 year ago

I'm doing as you suggested. I see that the kernel is compiling with kvm,but when I do make menuconfig,I don't see the entries within the menus.

quarkscript2 commented 1 year ago

Well i suggested to use it on script that earlier export same variables to environment. On top of screenshot writed '.config - Linux/x86' that mean you configuring kernel for host system. But that script makes system for factory firmware and may not fit this kvm guide. edit 2: kvm guide suggest to compile kernel as uImage and gadebli script compiles it to zImage than convert it to uImage and sign. So yes there is a difference.

Marietto2008 commented 1 year ago

I've been able to achieve something. I've followed the virtual open system tutorial,but instead of ubuntu 13.0 userland,I've installed ubuntu 18.04. It booted,but at some point,it gave some errors and the booting process freezed :

Untitled

what do you suggest to do now ?

quarkscript2 commented 1 year ago

Try to press Ctrl+Alt+F2(right arrow key on top of keyboard near Esc button) and login to console. If login will be succesfull enter mount command and check root fs mount. In whole it looks like that root partition mounted in read only mode. I suggest to look at /etc/fstab is there a something like /dev/mmcblk1p4 / ext4 rw 0 0 (or UUID=lot of symbols instead of /dev/mmcblk1p4) Ubuntu is a systemD type distro. A have a similiar trouble with Opensuse (systemD too) at Chromebook. Solution in case of Opensuse was adding /etc/fstab itself and adding systemd.gpt_auto=0 to kernel bootstring. Since your use nonstadart bootloader there must be file with kernel boot parameters that bootloader use.

Marietto2008 commented 1 year ago

yes,the file /etc/fstab was empty. I've added this line :

/dev/mmcblk1p4 / ext4 rw 0 0

regarding the u-boot bootloader,I'm not sure,but since it is u-boot,I've already learnt how to configure it because I also have the nvidia jetson nano. I presume that it works the same. So,Im going to create a folder called extlinux on the boot partition of the sd card and inside it I want to put this conf file (called extlinux.conf) :


TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/uImage
      APPEND ${cbootargs} quiet root=/dev/mmcblk1p4 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 systemd.gpt_auto=0

I'm not sure that it works,anyway. I'm deducing.

Marietto2008 commented 1 year ago

After the modifications that I have applied,I believe that nothing is changed. But you can judje by your self :

Untitled

Marietto2008 commented 1 year ago

Maybe I can use a lower than 18.04 ubuntu userland or Devuan. Probably those errors are caused by a kernel that's too old (3.3) against a too new ubuntu userland (18.04)

PS : Ctrl+Alt+F2 does not work.

quarkscript2 commented 1 year ago

I see. Yes, it looks like nothing changes. I think default bootstring is hardcoded there https://github.com/virtualopensystems/u-boot/blob/eecfeb578e296ef3b739ac918a39b6c177dff58a/include/configs/snow.h#L101 guess it could be changed and recompiled.

By the way i suppose line https://github.com/virtualopensystems/u-boot/blob/eecfeb578e296ef3b739ac918a39b6c177dff58a/scripts/build.sh#L25 string should be changed to git clone https://chromium.googlesource.com/chromiumos/third_party/dtc ${DTCSRC}

Devuan could be a test solution too, you may move old contents from rootfs to folder like /ubuntu, copy all contents from devuan root to / , change /etc/fstab and copy modules from /ubuntu/lib/modules/"kernel ver string" to same dir at / and try to boot. devuan root could be mounted like sudo mount "disk image" "folder where mount" -o,loop,offset=20971520 but host system (in wich you do this) should support btrfs filesystem and zstd compression

Marietto2008 commented 1 year ago

I don't understand why,when I remove the files from the root partitions (for example of the 18.04) and I copy there the files of a new ubuntu userland (for example of the 14.04) with the classical commands rm -r * or mv(to another folder on the same sdcard) and cp -a trusty/* mnt/ and then I place the sdcard again on the chromebook slot,it has not be able to boot anymore.

quarkscript2 commented 1 year ago

When i do same thing i use mc with root privileges and "preserve attributes" checkbox should be clicked. Do you copy /lib/modules or /usr/lib/modules? because there are placed kernel drivers, in case requred drivers compiled as modules and not placed there the kernel will not initialize devices depended on it

for example screen-2023-06-02-23-44-21

Marietto2008 commented 1 year ago

Can you make two screenshots,please ?

1) of the folder /lib/modules 2) of the folder /usr/lib/modules

I want to see the content. Maybe some content is lost not when I copy it from the chroot to the root partition of the sd card,but before. I need to investigate. At the moment I'm trying to copy the content of the chroot / trusty to the root partition of the sd card. So,if you can take the screenshots of the folders which belong to trusty, is better.

Marietto2008 commented 1 year ago

On the physical installation of the trusty (that I use as host os) I see the folder called modules inside the folder /lib ; inside the chroot of the trusty I don't see the folder modules inside the folder /lib. Is this natural ? This could explains why as soon as I "burn" the sd card with a new installation of Ubuntu,it is able to boot,but if I change a single bit on the root folder,it will not boot anymore and I don't know how to made it boot again.

Marietto2008 commented 1 year ago

I've copied all the files from the chroot folder of trusty to the root partition of the sd card with mc,preserving the attributes. Unfortunately it didn't boot.

quarkscript2 commented 1 year ago

Some distros use symlinks /lib/ to /usr/lib/ and in depending of how it was created it may not work when you boot on other sys.

Do you fixed any disk errors at first rewriting system? Because ChromeOs use specific flags on disk tables that regular systems did not understands. Without that chromeos bootloader from spi flash may not recognize disk as chromeos disk and not to boot. In that case it double beeps and returns to chomeos boot white scrren. But if you got a black screen that probably means it booting and stuck.

/lib/modules/6.3.4 on my devuan (kernel ver is 6.3.4), there is no /usr/lib/modules in my case 1

Marietto2008 commented 1 year ago

Bad news here. I'd got a new sd card where I'd reinstalled everything (that time using ubuntu 18.04 as userland) and it "worked". At the same time I'd created the image of the whole sd card with dd. Now I have restored that old image to the same sd card. Didn't boot anymore. That's insane. Its impossible. dd copy byte by byte. It seems that it needs one sd card for each new installation.

quarkscript2 commented 1 year ago

You may completely erase sd card with sudo dd if=/dev/zero of=/dev/mmcblk1 status=progress bs=2M

bs=2M here playing a buffer role, lets coping be faster

Probably some mistakes was, even hw errors could be. If some important sectors on sd card dead that could be possible

rebuilding disk structure by cgpt and flashing uboot and copying files again should help if that errors was not caused by dead sectors

quarkscript2 commented 1 year ago

To install ubuntu 13.04 take disk image from https://old-releases.ubuntu.com/releases/13.04/ after installing base system and rebooting edit /etc/apt/sources.list and add deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted multiverse universe to it then you could continue following kvm guide. This https://askubuntu.com/questions/1069702/dpkg-error-processing-package-install-info helped to fix some issue

At least it let u-boot compilation end with succes (i did not change the bootstring)

make[1]: Leaving directory `/root/u-boot/examples/standalone'
Image Name:   U-Boot 2011.12-geecfeb5-dirty fo
Created:      Sat Jun  3 16:41:57 2023
Image Type:   ARM U-Boot Firmware (uncompressed)
Data Size:    281392 Bytes = 274.80 kB = 0.27 MB
Load Address: 42400000
Entry Point:  00000000
Image Name:   Non-verified u-boot
Created:      Sat Jun  3 16:41:57 2023
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    302804 Bytes = 295.71 kB = 0.29 MB
Load Address: 42400000
Entry Point:  42400000

Now run:
sudo dd if=nv_uboot-snow.kpart of=/dev/<sd_card_part_1>

but i changed dtc source link as pointed earlier nv_uboot-snow.zip

quarkscript2 commented 1 year ago

I guess debootstrap scripts of ubuntu 13.04 should be fixed too bacause main repo was moved to archive.

Changing bootstring in bootloader works, but i cannot succesfully boot system even with kernel 3.13.

Since it is a old nv-u-boot-simplefb it has some requrements to booted kernel, that should not add exynos video devices. Regular kernel will do it because of dtb's.

Devuan's Chimaera dmesg says kvm not enabled because of cpu mode when installed kernel 5.4.244-kvm. I suppose nv-uboot (not simplefb mod) with proper patch could enable it. But i do not have more free time to investige it, sorry.

Marietto2008 commented 1 year ago

My main Ubuntu 22.04 installation was infected by some kind of GPU miner that compromised even the network connection. I've passed the whole weekend trying to remove the miner without reinstalling the whole OS. For sure was faster reinstall everything,but you know,usually I want to achieve exactly what I want,without "workarounds". Regarding the Chromebook I was able to install succesfully ubuntu on the chromebook with the kernel 3.13 and everything worked fine,but later I tried the userland of ubuntu 18.04 that didn't boot and when I tried to switch back to an old userland, I never been able to boot any ubuntu distro after that. I will investigate again and I will inform you if I will achieve some relevant goal if you want.

Marietto2008 commented 1 year ago

Hello are you still there ?

I've installed ubuntu 14.04 + kernel 3.13 and kvm is enabled on the arm chromebook. almost everything works. I've also got your kernel sources (from this link : https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.244.tar.xz),I have unpacked it and I've added at the bottom of the .config file these lines :

CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_KVM_MMIO=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_ARM_HOST=y
CONFIG_KVM_ARM_MAX_VCPUS=4
CONFIG_KVM_ARM_VGIC=y
CONFIG_KVM_ARM_TIMER=y

I've been forced to add those lines,because as soon as I wrote "make menuconfig",I saw that the KVM entries weren't there,as you can see :

https://ibb.co/WcXPTj5

unfortunately those lines don't stick on the kernel config file. When I save it and I reopen it,I see that the kvm lines have been deleted. (I'm trying to compile the 5.4 kernel directly on the chromebook using an SSH connection). Why you have them and I don't ? what's the trick ?

Marietto2008 commented 1 year ago

I've used the kernel config file offered by virtual open systems,I've added the kvm voices and then I tried to recompile it with the command :

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make uImage dtbs -j2

and the command :

make uImage dtbs -j2

this is what happened :

arch/arm/kernel/asm-offsets.c:45:2: error: #error Your compiler is too buggy; it is known to miscompile kernels
 #error Your compiler is too buggy; it is known to miscompile kernels
  ^
arch/arm/kernel/asm-offsets.c:46:2: error: #error and result in filesystem corruption and oopses.
 #error and result in filesystem corruption and oopses.
  ^
make[2]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2
quarkscript2 commented 1 year ago

this gcc ver has a bug https://github.com/torvalds/linux/blob/219d54332a09e8d8741c1e1982f5eae56099de85/arch/arm/kernel/asm-offsets.c#L38 version condition at line 42 #if defined(GCC_VERSION) && GCC_VERSION >= 40800 && GCC_VERSION < 40803 so you need another ver of gcc

in case you use make menuconfig and enable something you need to press save button while exit from it

adding some lines to config file not always enabling something, because of condition depends and before compiling there will be config checks that will turn off any features that wants other features that not on

if you do not like menuconfig use another configuring tool

Marietto2008 commented 1 year ago

Actually my problem is that only 2 times over 10 tries my cromebook is able to boot correctly the same setup. I've also completely erased the sd card with sudo dd if=/dev/zero of=/dev/mmcblk1 status=progress bs=2M but very rarely it wants to boot. I don't understand where is the error. When I insert the sd card into the slot it beeps and it prepares itself to boot chrome OS from the internal memory,not Linux from the sd card.

quarkscript2 commented 1 year ago

My cromebook has degradated electrical connections with sdcard and sometimes it did not boot from sd card adapter + microSD. When i boot from emmc in that case i got some mmc errors in dmesg.

In most cases beep means that uboot from spi-flash did not recognize SDcard or did not recognize chrome os disk partitions scheme on SDcard. Does this happens after first succesfull boot from SDcard? Did you make your backup after first succesful boot, not before?

It is possible to chroot to system on SDcard from any armv7 linux or chromeos and read journals and bootlogs to find out what system done at boot.

Chromeos specific disk partitions flags could be checked or set by cgpt i guess.

After complete zeroing sdcard, disk's partitions should be created again and so on.

Marietto2008 commented 1 year ago

For sure it does not happen if I use a new sd card for the first time with Linux freshly installed there. But if something goes wrong and I should repeat the setup on the same sd card,the chance that it does not boot from there anymore,is high. Yes,when it booted,the first thing I did has been to backup and later I have restored the backup to the sd card,but it didn't even boot. If I remember well,chromeos can be removed totally from the internal memory and its place can be taken by Linux. I'd found a tutorial a lot of time ago to do this,but I lost it. This wil cut the problem of the SD card electrical degradation from the root :P

quarkscript2 commented 1 year ago

I mean systemd always tries to check and fix disk errors and it did not support natively chromeos disk partitions flags. So it may broke that flags after first boot. I do not know how systemd works on ubuntu but on archlinuxarm it gives errors to dmesg and did not touched disks at all.

So as i understand you may succesfully boot from same system couple of times. In that case it is not a systemd.

Zeroing sdcard, creating disk scheme by cgpt, flashing kernel and writing rootfs always work to me without depends of how times i have used same sdcard for that. It did not works when i use broken kernel but that is another story.

Marietto2008 commented 1 year ago

Let's assume that systemd breaks something,devuan is systemd free,so it could be used to test the theory. Do you know if devuan uses ext4 or brtfs ? I prefer to don't complicate things,I don't want to use btrfs.

Marietto2008 commented 1 year ago

I mean systemd always tries to check and fix disk errors and it did not support natively chromeos disk partitions flags. So it may broke that flags after first boot. I do not know how systemd works on ubuntu but on archlinuxarm it gives errors to dmesg and did not touched disks at all.

So as i understand you may succesfully boot from same system couple of times. In that case it is not a systemd.

Zeroing sdcard, creating disk scheme by cgpt, flashing kernel and writing rootfs always work to me without depends of how times i have used same sdcard for that. It did not works when i use broken kernel but that is another story.

use "fsck.mode=skip" as a kernel parameter to bypass all filesystem checks at boot time.

systemd-fsck-root.service (8)

Marietto2008 commented 1 year ago

Hello.

Are you still there ? I have compiled successfully the kernel vers. 5.4.244 with all the kvm flags enabled and the exynos5250-snow.dtb file. Would you try them ? basically what you need to do is to follow this tutorial :

http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/

and do :

1) cp nv_uboot-snow.kpart/linux-kvm-arm/u-boot/scripts

NB : I always use the file nv_uboot-snow.kpart I get from here :

http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/nv_u-boot-snow.kpart

to be sure that it's good.

2) sudo ./scripts/sdcard.sh /dev/sdX 3) mkdir ../mnt/ 4) sudo mount /dev/sdX3 ../mnt/ 5) sudo cp arch/arm/boot/my_uImage ../mnt/ 6) sudo cp arch/arm/boot/dts/my_exynos5250-snow.dtb ../mnt/ 7) sudo umount /dev/sdX3 8) sudo mount /dev/sdX4 mnt/ 9) sudo cp -a ./here-it-needs-an-ubuntu-userland-compatible-with-the-kernel-5.4.244_which version ? /* mnt/ 10) sudo umount /dev/sdX4 11) I've attached the files : my_uImage,my_exynos5250-snow.dtb and .config on this message. 12) for building the userland,follow the section "Filesystems and booting the host" on the virtualopensystem tutorial

if you find that I have made some mistakes,please tell. It does not work for me. As I have already explained,I followed the original tutorial several times,I've zeroed the sd card,but it is able to boot rarely. Probably my chromebook has some hardware failure. But I'm not sure,since it is able to boot at first shot the pre images that I dd directly to the sd card (those images are ready to go,but they don't use u-boot and the patched bootloader,so they are useless for this project).

my_exynos.tar.gz

quarkscript2 commented 1 year ago

That guide require a registration for full access.. well, i will assume there is a 2 Mb chromeos kernel partition, some Mb fat32 partition, 8 Mb boot and other is root part.

that nv-uboot is a simple-fb ver and according to https://chromium.googlesource.com/playground/chromium-org-site/+/refs/heads/main/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook.md

nv-U-Boot with simplefb and simplified environment variables If all you want to do is use a simple nv-u-boot so you can get a firmware prompt and load a non-Chrome OS kernel, then it might be easier for you to use the “simplefb” U-boot. The two CLs for enabling this are: Here and here.

There are a couple of things to keep in mind with it:

It instantiates the ‘simplefb’ device in the kernel device-tree, so that a kernel with the corresponding driver (CONFIG_FB_SIMPLE) will configure and use it Since the framebuffer is kept alive from u-boot, it means that if you build your kernel with SYSMMU support, and use the regular FIMD graphics driver that Samsung provides, your system will crash on boot since the mapping that the simplefb is using will be invalidated when SYSMMU is enabled. The simplefb firmware (linked at the top of the page above) has most of the environment variables removed, to make it easier to see what is actually used to boot the system, and edit them accordingly.

so there is high chance vanilla kernel will conflict with that nv-uboot unless you did cleared the source of dtb from video devices

i may try it but can answer not earlier than tomorrow evening

Marietto2008 commented 1 year ago

No,I didn't cleared the source of dtb from video devices. I don't know how to do this. Can you do it and explain how ?

Marietto2008 commented 1 year ago

Here my compiled files worked. I'm also sure that we can even use a greater kernel version. My chromebook accepted them and it booted,but as you had expected,the monitor became black some seconds after I saw it did. So,we are one step away from achieving the goal : we should clear the source of dtb from video devices. I have also had the certainty that my chromebook is almost damaged,because the first time I tried the new files it didn't boot. The second time it did,but I changed nothing from the first to the second try. If we are able to clear the dtb file and kvm works with a recent kernel maybe I will buy another used chromebook if I find one with a good price.

Marietto2008 commented 1 year ago

To clear the source of dtb from video devices is enough to do something like this ?

$ sudo dd if=nv_uboot-snow-simplefb.kpart of=/dev/sdX1

quarkscript2 commented 1 year ago

No, it just write uboot to first partition

Here my compiled files worked.

Great. Tried it with debian 12 user environment and no luck, got only uboot messages. I also checked the boot logs there and they were zeroed out. It means system didn't boot to the point where the bootlogs are saved.

https://github.com/quarkscript/linux-armv7-xe303c12-only/assets/122259273/fca34145-7ab6-4c1b-9808-4d0e3e4d29ac

and that is all, no any printiks

I never deal with nv-uboot, all i know it is that finded on chrome os wiki. I am not a C dev or device tree dev, i just assume that devices from https://github.com/torvalds/linux/blob/v5.4/arch/arm/boot/dts/exynos5.dtsi https://github.com/torvalds/linux/blob/v5.4/arch/arm/boot/dts/exynos5250.dtsi https://github.com/torvalds/linux/blob/v5.4/arch/arm/boot/dts/exynos5250-snow.dts should be somehow syncronized with https://github.com/virtualopensystems/u-boot/blob/chromebook/board/samsung/dts/exynos5250-snow.dts ( https://github.com/virtualopensystems/linux-kvm-arm/blob/kvm-arm-master/arch/arm/boot/dts/exynos5.dtsi https://github.com/virtualopensystems/linux-kvm-arm/blob/kvm-arm-master/arch/arm/boot/dts/exynos5250.dtsi https://github.com/virtualopensystems/linux-kvm-arm/blob/kvm-arm-master/arch/arm/boot/dts/exynos5250-snow.dts ) or removed gpu from kernel 5.4 maybe. i do not know actually

Marietto2008 commented 1 year ago

----> No, it just write uboot to first partition

which file did u use ? where you got it ?

I think that you could try with a lower ubuntu userland. Debian 12 is too new if you have used my kernel,that's much older , 5.4 ! . I used ubuntu jammy,not so far from ubuntu 5.4,but probably still too new. It's a good idea to keep syncronized the kernel with the userland. To try kernel 4.4 with ubuntu 16.04 could be a good compromise to see if we find the point where the problem arises. Anyway I think that it's a progress to see so much messages scrolling on the screen. What do you think bro'.

Marietto2008 commented 1 year ago

can you give a look at this tutorial ?

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/virtualization-on-the-chromebook-using-kvm-tool

what it means "(these patches should not be required after kernel 3.13.0)" ? It seems that an higher kernel version is supported.

Marietto2008 commented 1 year ago

I would like to restart from here :

https://github.com/quarkscript/linux-armv7-xe303c12-only/issues/18#issuecomment-1573846659

because I think to know how to fix the error shown there. Hardcoding the parameter "clk_ignore_unused systemd.unified_cgroup_hierarchy=0" within the u-boot parameters and recompiling u-boot :

[#define] CONFIG_BOOTARGS \ "console=tty1 root=/dev/mmcblk1p4 rw rootwait clk_ignore_unused systemd.unified_cgroup_hierarchy=0 --no-log"

that parameter is needed because when I did the experiment I've used the kernel 3.13,but ubuntu 18.04 as userland. The problem is that the kernel 3.13 does not support cgroup version 2,but ubuntu 18.04 does it. So,we should enable the cgroup version 1. If you see the picture where ubuntu 18 shows its boot messages,you will see that it supports the kernel 3.13 wthout many problems,but everything stops working correctly when it tries to use cgroup v.2. I'm sure that we can at least use ubuntu 18.04 with the kernel that has been patched by virtual open systems.

242914372-989dd44a-ebc8-41e6-87e0-9e57f0fafcf0

Marietto2008 commented 1 year ago

I will try this experiment,but can you do the same ? because my Chromebook is damaged,I could get a false positive.

quarkscript2 commented 1 year ago

As i know there is no matter what userland or even without any of it, printicks should appear if it did not forbiden at kernel

which file did u use ? where you got it ?

I compiled uboot from virtualopensystem's source on github and use your kernel for test

I can not help wuth cgroup because i know nothing of it. Same about armv7 cpu registers and modes.

You know, i used Ubuntu on my home pc 10 years ago or so and got only problems with it, so i switch to Arch and never back to Ubuntu since that.

if you place link to your disk image i can try run it

Marietto2008 commented 1 year ago

https://stackoverflow.com/questions/54574521/systemd1-failed-to-mount-tmpfs-at-sys-fs-cgroup-no-such-file-or-directory