Discussion:
Debian on Lenovo Chromebook (ARMv8)
(too old to reply)
Thomas Uwe Grüttmüller
2023-03-30 20:40:01 UTC
Permalink
Hello everyone,

I recently bought a Chromebook with the intent to delete Chrome and
install Debian. I’m not talking about running Debian in a virtual
machine or chroot environment under ChromeOS, but booting directly into
it. The laptop is a
  Lenovo IdeaPad Flex3 CB 11M735,
and its processor is a
  MediaTek MT8173C (4 core ARMv8).

The problem is that instead of a normal BIOS or UEFI, thelaptop has the
nasty ChromeOS bootloader which refuses to boot the normal Debian ARM64
Netinst installer. The only thing it wants to boot from USB is the
ChromeOS recovery.

In theory, I could boot into ChromeOS from the eMMC, login as root and
copy Debian from the stick to the eMMC, but I don’t know how to
partition the eMMC. Where does the nasty bootloader expect to find
things? Can I make it boot into GRUB, or do I have to put the Linux
kernel from Debian onto a special partition? I’m completely clueless.

Thank you for any help :-)

Thomas
Brian Sammon
2023-03-30 22:00:01 UTC
Permalink
I currently have a Lenovo Duet 5 chromebook (with ARM processor) that runs debian off an SD Card via USB.
Post by Thomas Uwe Grüttmüller
The problem is that instead of a normal BIOS or UEFI, thelaptop has the
nasty ChromeOS bootloader which refuses to boot the normal Debian ARM64
Netinst installer. The only thing it wants to boot from USB is the
ChromeOS recovery.
hexbuilder's VelvetOS (a (slightly?) modified version of Debian) builds might boot from USB--that's what I'm using.
Check out https://github.com/hexdump0815/imagebuilder/blob/main/systems/chromebook_oak/readme.md
Post by Thomas Uwe Grüttmüller
In theory, I could boot into ChromeOS from the eMMC, login as root and
copy Debian from the stick to the eMMC, but I don’t know how to
partition the eMMC. Where does the nasty bootloader expect to find
things? Can I make it boot into GRUB, or do I have to put the Linux
kernel from Debian onto a special partition? I’m completely clueless.
The process seems to be:
1) compress the kernel image with lz4
2) create a FIT image with mkimage
(mkimage is found in the "u-boot-tools" package in debian)
3) sign the FIT image and add the kernel commandline with vbutil_kernel
(vbutil_kernel is found in the "vboot-kernel-utils" package in debian)
4) dd the signed image to one of a "Kernel" partition
5) use cgpt to set the relevant flags that mark the chosen Kernel
partition as bootable/preferred.
(there's a "cgpt" package in debian)

The documentation for this (and the individual tools) is a bit suboptimal and scattered, so I don't have any documentation pointers--I extracted this process from the build scripts for hexbuilder's VelvetOS images.
I haven't gotten to the point of understanding if/why all these steps are actually necessary, but I've used this process successfully to customize the install and partition table on the SD card I'm using on my Chromebook.
I suspect that a similar process could be applied to the internal storage of a Chromebook, but I haven't explored that yet.
Jérémy Lal
2023-03-31 08:20:01 UTC
Permalink
Le jeu. 30 mars 2023 à 23:54, Brian Sammon <
Post by Brian Sammon
I currently have a Lenovo Duet 5 chromebook (with ARM processor) that runs
debian off an SD Card via USB.
Post by Thomas Uwe Grüttmüller
The problem is that instead of a normal BIOS or UEFI, thelaptop has the
nasty ChromeOS bootloader which refuses to boot the normal Debian ARM64
Netinst installer. The only thing it wants to boot from USB is the
ChromeOS recovery.
hexbuilder's VelvetOS (a (slightly?) modified version of Debian) builds
might boot from USB--that's what I'm using.
Check out
https://github.com/hexdump0815/imagebuilder/blob/main/systems/chromebook_oak/readme.md
Post by Thomas Uwe Grüttmüller
In theory, I could boot into ChromeOS from the eMMC, login as root and
copy Debian from the stick to the eMMC, but I don’t know how to
partition the eMMC. Where does the nasty bootloader expect to find
things? Can I make it boot into GRUB, or do I have to put the Linux
kernel from Debian onto a special partition? I’m completely clueless.
1) compress the kernel image with lz4
2) create a FIT image with mkimage
(mkimage is found in the "u-boot-tools" package in debian)
3) sign the FIT image and add the kernel commandline with vbutil_kernel
(vbutil_kernel is found in the "vboot-kernel-utils" package in debian)
4) dd the signed image to one of a "Kernel" partition
5) use cgpt to set the relevant flags that mark the chosen Kernel
partition as bootable/preferred.
(there's a "cgpt" package in debian)
The documentation for this (and the individual tools) is a bit suboptimal
and scattered, so I don't have any documentation pointers--I extracted this
process from the build scripts for hexbuilder's VelvetOS images.
I haven't gotten to the point of understanding if/why all these steps are
actually necessary, but I've used this process successfully to customize
the install and partition table on the SD card I'm using on my Chromebook.
I suspect that a similar process could be applied to the internal storage
of a Chromebook, but I haven't explored that yet.
Alper Nebi Yasak was working on making it easier to do all that in debian,
you might find interesting things at https://salsa.debian.org/alpernebbi
I know depthcharge-tools is in debian and is working (i'm using it on c201
chromebooks).
However I don't know if it's possible to install debian the usual way right
now.
I had luck with https://github.com/SolidHal/PrawnOS - just to install a
base os, then I switched to debian sources.

Jérémy
Alper Nebi Yasak
2023-04-05 15:40:01 UTC
Permalink
Post by Thomas Uwe Grüttmüller
I recently bought a Chromebook with the intent to delete Chrome and
install Debian. I’m not talking about running Debian in a virtual
machine or chroot environment under ChromeOS, but booting directly into
it. The laptop is a
Lenovo IdeaPad Flex3 CB 11M735,
and its processor is a
MediaTek MT8173C (4 core ARMv8).
Unfortunately, support for MediaTek SoCs is not enabled in the Debian
arm64 kernel builds yet (not even CONFIG_ARCH_MEDIATEK). So a vanilla
Debian installation is not going to work regardless of the ChromeOS
bootloader stuff.

I've been looking into what changes we can appropriate from their kernel
configuration to support more chromebooks, but I'm not a kernel expert
and I fear the changes might be too big and too late for bookworm.
Post by Thomas Uwe Grüttmüller
Post by Brian Sammon
I currently have a Lenovo Duet 5 chromebook (with ARM processor) that runs
debian off an SD Card via USB.
The SC7180 one? Does it work with the Debian-built kernel?
Post by Thomas Uwe Grüttmüller
Post by Brian Sammon
Post by Thomas Uwe Grüttmüller
The problem is that instead of a normal BIOS or UEFI, thelaptop has the
nasty ChromeOS bootloader which refuses to boot the normal Debian ARM64
Netinst installer. The only thing it wants to boot from USB is the
ChromeOS recovery.
[...]
I haven't gotten to the point of understanding if/why all these steps are
actually necessary, but I've used this process successfully to customize
the install and partition table on the SD card I'm using on my Chromebook.
I suspect that a similar process could be applied to the internal storage
of a Chromebook, but I haven't explored that yet.
It's just how Google designed their bootloader to boot ChromeOS, instead
of using UEFI... What those steps do is to package Debian's files their
way, so that the bootloader will find and boot them as if it's booting
ChromeOS. Works on the internal eMMC and on a USB drive as well.

I've automated the entire thing in depthcharge-tools (as Jérémy
mentioned). So if you did the partitioning and have a working kernel,
running e.g. `sudo depthchargectl write` would handle the rest.
Post by Thomas Uwe Grüttmüller
Alper Nebi Yasak was working on making it easier to do all that in debian,
you might find interesting things at https://salsa.debian.org/alpernebbi
I know depthcharge-tools is in debian and is working (i'm using it on c201
chromebooks).
However I don't know if it's possible to install debian the usual way right
now.
Debian Installer can create ChromeOS kernel partitions (manually) and
can use depthcharge-tools to make things bootable now, assuming you can
get the installer to boot (wrt/ kernel support, manual image
preparation, size limits).

I need to work more on generating pre-built installer images, and I
expect I'll need to write a wiki page for some parts eventually. But
things are looking good (kernel config aside).
Brian Sammon
2023-04-07 18:00:01 UTC
Permalink
On Wed, 5 Apr 2023 18:31:10 +0300
Post by Alper Nebi Yasak
Post by Brian Sammon
I currently have a Lenovo Duet 5 chromebook (with ARM processor) that
debian off an SD Card via USB.
The SC7180 one? Does it work with the Debian-built kernel?
It's a Qualcomm Snapdragon 7c Ver2.
I'm running the kernel that came with the image I downloaded from https://github.com/hexdump0815/imagebuilder a few months ago. I believe it's a 5.19.1 kernel minimally patched from kernel.org sources (and possibly some customization of the .config and devicetree). Reportedly, v6 of the kernel should work unpatched.
I should start a DebianOn page for the wiki.
Post by Alper Nebi Yasak
Post by Brian Sammon
I haven't gotten to the point of understanding if/why all these steps
actually necessary, but I've used this process successfully to
It's just how Google designed their bootloader to boot ChromeOS, instead
Right, I get the general idea. Just not sure if you need to follow that process 100%, or if there's some flexibility. In particular, I don't know if the lz4 step is necessary, and whether other compression formats are allowed.

Relatedly, I'm wondering how many kernel partitions I can have. Can I have (usefully) a "KERN-Z" partition?
Post by Alper Nebi Yasak
Debian Installer can create ChromeOS kernel partitions (manually) and
can use depthcharge-tools to make things bootable now, assuming you can
get the installer to boot (wrt/ kernel support, manual image
preparation, size limits).
I need to work more on generating pre-built installer images, and I
expect I'll need to write a wiki page for some parts eventually. But
things are looking good (kernel config aside).
Is there anywhere (besides this list) that I should be reading/subscribed to to learn more about debian-installer support for Chromebooks?
Alper Nebi Yasak
2023-04-10 20:00:01 UTC
Permalink
On Wed, 5 Apr 2023 18:31:10 +0300 Alper Nebi Yasak
Post by Alper Nebi Yasak
The SC7180 one? Does it work with the Debian-built kernel?
It's a Qualcomm Snapdragon 7c Ver2. I'm running the kernel that came
with the image I downloaded from
https://github.com/hexdump0815/imagebuilder a few months ago. I
believe it's a 5.19.1 kernel minimally patched from kernel.org
sources (and possibly some customization of the .config and
devicetree). Reportedly, v6 of the kernel should work unpatched. I
should start a DebianOn page for the wiki.
Ah, OK. I want to eventually go through VelvetOS sources to see what we
need to enable for each device, but didn't have the time yet. (As a
start I have filed #1034159 based on ChromiumOS sources)
Post by Alper Nebi Yasak
It's just how Google designed their bootloader to boot ChromeOS, instead
Right, I get the general idea. Just not sure if you need to follow
that process 100%, or if there's some flexibility. In particular, I
don't know if the lz4 step is necessary, and whether other
compression formats are allowed.
It's a mess, depends on the board. For arm64, the kernel can either be
uncompressed, lz4 or lzma. There is a size limit for the final image
(e.g. 32MiB for RK3399 ones, 512MiB for Duet 5) so that can make it
necessary to compress things. Newer boards can have compressed dtb files
as well.

Even older, 32-bit arm boards have 8/16MiB limits, can't compress the
kernel (but it's already self-compressed) and don't properly support
initramfs in FIT. x86 ones don't use FIT, just the kernel "bzImage" not
even meant to have an initramfs. (Insane hacks needed but possible to
use initramfs in both).

Also, AFAIK you can use your own keys for vbutil_kernel and make the
firmware specifically check for them in verified mode, but that takes
some work.
Relatedly, I'm wondering how many kernel partitions I can have. Can
I have (usefully) a "KERN-Z" partition?
I don't know if there's a hard limit, but the "priority" flag can only
be in a 0-15 range. In daily use, having two partitions will let you do
A/B upgrades and safe rollbacks, but having more than two doesn't seem
to add much value.
Is there anywhere (besides this list) that I should be
reading/subscribed to to learn more about debian-installer support
for Chromebooks?
Installer discussion in general happens at the debian-boot@ list and
#debian-boot IRC channel. I'm not exactly talkative while I work, though
I'm bound to announce things there eventually. If you want a general
overview of things, I had a talk at DebConf22 [1], but it's somewhat
outdated as things progressed.

[1] Solving "How Can I Run Debian on My Chromebook?" For Good
https://debconf22.debconf.org/talks/87-solving-how-can-i-run-debian-on-my-chromebook-for-good/
Brian Sammon
2023-04-15 04:40:01 UTC
Permalink
On Mon, 10 Apr 2023 22:54:09 +0300
Post by Alper Nebi Yasak
Post by Brian Sammon
Is there anywhere (besides this list) that I should be
reading/subscribed to to learn more about debian-installer support
for Chromebooks?
#debian-boot IRC channel. I'm not exactly talkative while I work, though
I'm bound to announce things there eventually. If you want a general
overview of things, I had a talk at DebConf22 [1], but it's somewhat
outdated as things progressed.
So, how far have things progressed? Have they reached the point where I (or owners of other model chromebooks) should be testing the latest snapshot of the Debian Installer on my (ARM) chromebook, and submitting bug reports? Or should I wait for an announcement?
Thomas U. Grüttmüller
2023-04-09 12:20:01 UTC
Permalink
Post by Brian Sammon
hexbuilder's VelvetOS (a (slightly?) modified version of Debian)
builds might boot from USB--that's what I'm using.
Check out
https://github.com/hexdump0815/imagebuilder/blob/main/systems/chromebook_oak/readme.md

It works!!! :-) Thank you very much.

The laptop boots fine from the stick, and after booting from the stick,
I dd-ed the entire stick to /dev/mmcblk0, so now the laptop boots from
the MMC into Velvet OS as well.

BTW, I tried what happens when the OS verification is accidentally
turned on again by pressing [Space] and then [Enter] at The Scary Screen.
As expected, it refuses to boot Velvet OS from then on, but fortunately
this can be easily reversed by holding [ESC]+[F3] on the next boot.
Then, at the recovery screen, press [Ctrl]+[D] to turn on Developer Mode.
There will be a warning that all data will be deleted, but what happens
instead is, it will boot normally into Velvet OS again. This is good to
know, because other people might accidentally follow the instructions on
The Scary Screen.

Velvet OS is not ideal for me, but it’s good to know that using and
installing something Debian-like is that easy on this weird machine.
And now I know where to look at.

These things I find not ideal about the current situation:

• Velvet OS is based on Debian sid, not stable.

• Velvet OS comes with a lot of packages pre-installed. Usually, I
  start by installing a base system only, and then install the packages
  I need using apt.

• Velvet OS comes with XFCE. I don’t know how to uninstall XFCE,
  so that startx will start IceWM. This is weird, but propably due to
  my lack of knowledge.

• /dev/mmcblk0p4 which is mounted as / is only 2.9 GB large, so most
  of the MMC is still free space. So the next step would be to enlarge
  this partitition, but I don’t know how.

• /dev/mmcblk0p4 which is mounted as / is formatted as BTRFS. I’ve
  never heared of this before. Is this good or bad, compared to EXT4?
  Also, I don’t know what would be the steps to replace it with an
  EXT4 partition.

Yours,
Thomas
Brian Sammon
2023-04-10 17:40:01 UTC
Permalink
I'll start with the most important thing first.

On Sun, 9 Apr 2023 14:14:33 +0200
Post by Thomas U. Grüttmüller
• /dev/mmcblk0p4 which is mounted as / is only 2.9 GB large, so most
  of the MMC is still free space. So the next step would be to enlarge
  this partitition, but I don’t know how.
Beware of using parted and parted-based tools (I think a lot of graphical
partitioners use libparted). My experience is that they will delete the ChromeOS-firmware boot flags on the partitions, rendering your install unbootable. If you want to use parted and friends, get familiar with cgpt (which is packaged for debian) which you should use after each partition edit to verify/reset the ChromeBoot flags.
Alternatively, VelvetOS should come with a /scripts/ directory in its filesystem image, containing /scripts/extend-rootfs.sh. When I used it, it was a pretty simple/inflexible script to grow your / to take up all the empty space. There's some details at https://github.com/hexdump0815/imagebuilder/blob/main/doc/first-steps.md
Post by Thomas U. Grüttmüller
• Velvet OS is based on Debian sid, not stable.
If you reconfigure apt to target bookworm, I think this should evolve pretty smoothly over the next few "apt-get"s.
Post by Thomas U. Grüttmüller
• Velvet OS comes with XFCE. I don’t know how to uninstall XFCE,
  so that startx will start IceWM. This is weird, but propably due to
  my lack of knowledge.
There's two things here:
1) It sounds like you want it to boot into text mode instead of the graphical login. But maybe you have already figured this part out.
2) You're having trouble figuring out how to get the package manager to uninstall xfce and/or install IceWM.
If you provide more detail, I'm sure someone here (or on debian-user, or IRC, or something) can help you.
Post by Thomas U. Grüttmüller
• /dev/mmcblk0p4 which is mounted as / is formatted as BTRFS. I’ve
  never heared of this before. Is this good or bad, compared to EXT4?
  Also, I don’t know what would be the steps to replace it with an
  EXT4 partition.
I've only heard good things about BTRFS. However, one caveat... If you have other computers running older versions of Linux, they may have trouble reading BTRFS partitions -- I ran into this when trying to read my VelvetOS thumbdrive on another computer.


Anyways, congratulations! You may want to post on
https://github.com/hexdump0815/imagebuilder/issues/68, either for general discussion or just to report your success/gratitude to the author.

One question:
Do you have sound? I set up mine a few months ago, and it has no sound. I'm wondering if I should try a newer version.
Jeffrey Walton
2023-04-10 20:20:01 UTC
Permalink
Post by Thomas Uwe Grüttmüller
I recently bought a Chromebook with the intent to delete Chrome and
install Debian. I’m not talking about running Debian in a virtual
machine or chroot environment under ChromeOS, but booting directly into
it. The laptop is a
Lenovo IdeaPad Flex3 CB 11M735,
and its processor is a
MediaTek MT8173C (4 core ARMv8).
The problem is that instead of a normal BIOS or UEFI, thelaptop has the
nasty ChromeOS bootloader which refuses to boot the normal Debian ARM64
Netinst installer. The only thing it wants to boot from USB is the
ChromeOS recovery.
In theory, I could boot into ChromeOS from the eMMC, login as root and
copy Debian from the stick to the eMMC, but I don’t know how to
partition the eMMC. Where does the nasty bootloader expect to find
things? Can I make it boot into GRUB, or do I have to put the Linux
kernel from Debian onto a special partition? I’m completely clueless.
I think you have to do more than just boot to a thumb drive. You have
to unlock the bootloader and boot to a special developer mode, if I
recall correctly. I _think_ enabling developer mode unlocks the
bootloader, if it is allowed. (It's been several years since I did
it).

And you need to verify you can actually unlock the bootloader. Some
device manufacturers don't allow it. I had one Chromebook that did not
allow it. I eventually donated the Chromebook to a church. (I don't
recall if "it" was developer mode, or overwriting the image).

Also see https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md
.

You might consider a PineBook Pro instead. It is open hardware and
software. It only cost $219 USD. You won't have to dick around with
the extra hoops.

Jeff
Loading...