<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Talpa</id>
	<title>PINE64 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Talpa"/>
	<link rel="alternate" type="text/html" href="https://wiki.pine64.org/wiki/Special:Contributions/Talpa"/>
	<updated>2026-05-08T21:26:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15597</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15597"/>
		<updated>2023-01-15T20:10:40Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Information about sending the SPL when in Maskrom mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in Maskrom/Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
* SPI NOR flash&lt;br /&gt;
* SPI NAND flash&lt;br /&gt;
* eMMC&lt;br /&gt;
* SD-Card&lt;br /&gt;
&lt;br /&gt;
In the case of the PineNote there is only the eMMC.&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters Maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have ''libusb 1.0'', its development headers and ''scdoc'' installed.&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
 sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
 sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Entering Maskrom/Rockusb Mode ==&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
The first two will result in Rockusb mode where drivers for the eMMC are loaded and rkdeveloptool can be used without further action.&lt;br /&gt;
This mode can be identified by ''Loader'' in the output when running &amp;lt;code&amp;gt;rkdeveloptool list&amp;lt;/code&amp;gt;&lt;br /&gt;
  rkdeveloptool list&lt;br /&gt;
  DevNo=1	Vid=0x2207,Pid=0x350a,LocationID=402	Loader&lt;br /&gt;
&lt;br /&gt;
The last method is used to recover from a bad u-boot and leaves the device in ''Maskrom''.&lt;br /&gt;
Here rkdevelop must first be used to upload the loader code with the driver for the eMMC.&lt;br /&gt;
This mode can be identified by ''Maskrom'' in the output when running &amp;lt;code&amp;gt;rkdeveloptool list&amp;lt;/code&amp;gt;&lt;br /&gt;
  rkdeveloptool list-devices&lt;br /&gt;
  DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
===  The magnet way ===&lt;br /&gt;
&lt;br /&gt;
[[File:PineNoteMagnetOnBack.jpg|right|500px|PineNote with magnet on circle]]&lt;br /&gt;
&lt;br /&gt;
# Remove the USB-C cable if connected&lt;br /&gt;
# Turn the PineNote off (press the power button for 5 seconds), and flip it around so that the display faces down&lt;br /&gt;
# Place a magnet in the correct place on the back of the PineNote, use one of the following methods:&lt;br /&gt;
#* Place a magnet on the small circle printed on the back, the pens magnetic cap can be used for this.&lt;br /&gt;
#* Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Connect the PineNote to the PC using a USB-C cable, this will wake it up and boot. Wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that ''Loader'' here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays ''Maskrom'' (not ''Loader'') from the RK3566).&lt;br /&gt;
&lt;br /&gt;
In case it doesn't work the first time just try again.&lt;br /&gt;
&lt;br /&gt;
=== The U-Boot way ===&lt;br /&gt;
# Interrupt the U-Boot startup using ''ctrl-c'' (while attached using an UART dongle)&lt;br /&gt;
# While in U-Boot use the command &amp;lt;code&amp;gt;rockusb 0 mmc 0&amp;lt;/code&amp;gt; to start Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between U-Boot and Rockusb, for example when trying to develop on U-Boot.&lt;br /&gt;
&lt;br /&gt;
=== Shorting test points ===&lt;br /&gt;
{{Warning | This has the potential to damage you PineNote}}&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Ensure the device is off by pressing and holding the power button for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0), this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Perform the short using one of:&lt;br /&gt;
 * A small tweezers&lt;br /&gt;
 * The programming pogo pins for a PineTime (mask the two unused pins with tape), the spring loaded nature of pogo pins helps getting a good contact&lt;br /&gt;
When shorting the test pads take great care to not short / touch other components or scratch the PCB as this '''may damage your PineNote'''.&lt;br /&gt;
&lt;br /&gt;
While keeping the test pads shorted plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
 &lt;br /&gt;
 $ rkdeveloptool list-devices&lt;br /&gt;
 DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
==== Sending the loader to the RK3566 (Not needed in &amp;quot;Loader&amp;quot;/rockusb mode) ====&lt;br /&gt;
In Maskrom you must first send a SPL (Secondary program loader) with contains the drivers for accessing the eMMC.&lt;br /&gt;
&lt;br /&gt;
The spl_loader .bin file can be obtained by compiling the downstream u-boot, the version number may or may not match the one displayed below depending on the sources used.&lt;br /&gt;
&lt;br /&gt;
The spl .bin file is send and executed using the ''rkdeveloptool boot'' command, see below:&lt;br /&gt;
&lt;br /&gt;
 rkdeveloptool boot rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&lt;br /&gt;
This should output &amp;quot;Downloading bootloader succeeded&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 rkdeveloptool read-flash-info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15596</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15596"/>
		<updated>2023-01-15T19:55:25Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Mentions the two different modes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in Maskrom/Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
* SPI NOR flash&lt;br /&gt;
* SPI NAND flash&lt;br /&gt;
* eMMC&lt;br /&gt;
* SD-Card&lt;br /&gt;
&lt;br /&gt;
In the case of the PineNote there is only the eMMC.&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters Maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have ''libusb 1.0'', its development headers and ''scdoc'' installed.&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
 sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
 sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Entering Maskrom/Rockusb Mode ==&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
The first two will result in Rockusb mode where drivers for the eMMC are loaded and rkdeveloptool can be used without further action.&lt;br /&gt;
This mode can be identified by ''Loader'' in the output when running &amp;lt;code&amp;gt;rkdeveloptool list&amp;lt;/code&amp;gt;&lt;br /&gt;
  rkdeveloptool list&lt;br /&gt;
  DevNo=1	Vid=0x2207,Pid=0x350a,LocationID=402	Loader&lt;br /&gt;
&lt;br /&gt;
The last method is used to recover from a bad u-boot and leaves the device in ''Maskrom''.&lt;br /&gt;
Here rkdevelop must first be used to upload the loader code with the driver for the eMMC.&lt;br /&gt;
This mode can be identified by ''Maskrom'' in the output when running &amp;lt;code&amp;gt;rkdeveloptool list&amp;lt;/code&amp;gt;&lt;br /&gt;
  rkdeveloptool list-devices&lt;br /&gt;
  DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
===  The magnet way ===&lt;br /&gt;
&lt;br /&gt;
[[File:PineNoteMagnetOnBack.jpg|right|500px|PineNote with magnet on circle]]&lt;br /&gt;
&lt;br /&gt;
# Remove the USB-C cable if connected&lt;br /&gt;
# Turn the PineNote off (press the power button for 5 seconds), and flip it around so that the display faces down&lt;br /&gt;
# Place a magnet in the correct place on the back of the PineNote, use one of the following methods:&lt;br /&gt;
#* Place a magnet on the small circle printed on the back, the pens magnetic cap can be used for this.&lt;br /&gt;
#* Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Connect the PineNote to the PC using a USB-C cable, this will wake it up and boot. Wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that ''Loader'' here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays ''Maskrom'' (not ''Loader'') from the RK3566).&lt;br /&gt;
&lt;br /&gt;
In case it doesn't work the first time just try again.&lt;br /&gt;
&lt;br /&gt;
=== The U-Boot way ===&lt;br /&gt;
# Interrupt the U-Boot startup using ''ctrl-c'' (while attached using an UART dongle)&lt;br /&gt;
# While in U-Boot use the command &amp;lt;code&amp;gt;rockusb 0 mmc 0&amp;lt;/code&amp;gt; to start Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between U-Boot and Rockusb, for example when trying to develop on U-Boot.&lt;br /&gt;
&lt;br /&gt;
=== Shorting test points ===&lt;br /&gt;
{{Warning | This has the potential to damage you PineNote}}&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Ensure the device is off by pressing and holding the power button for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0), this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Perform the short using one of:&lt;br /&gt;
 * A small tweezers&lt;br /&gt;
 * The programming pogo pins for a PineTime (mask the two unused pins with tape), the spring loaded nature of pogo pins helps getting a good contact&lt;br /&gt;
When shorting the test pads take great care to not short / touch other components or scratch the PCB as this '''may damage your PineNote'''.&lt;br /&gt;
&lt;br /&gt;
While keeping the test pads shorted plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
 &lt;br /&gt;
 $ rkdeveloptool list-devices&lt;br /&gt;
 DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15590</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15590"/>
		<updated>2023-01-15T19:00:48Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Added a image with a PineNote with a magnet on the back&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in maskrom/rockusb mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
* SPI NOR flash&lt;br /&gt;
* SPI NAND flash&lt;br /&gt;
* eMMC&lt;br /&gt;
* SD-Card&lt;br /&gt;
&lt;br /&gt;
''In the case of the PineNote there is only the eMMC''&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
 sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
 sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Entering Maskrom/Rockusb Mode ==&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
===  The magnet way ===&lt;br /&gt;
[[File:PineNoteMagnetOnBack.jpg|right|500px|PineNote with magnet on circle]]&lt;br /&gt;
# Remove the USB-C cable if connected&lt;br /&gt;
# Turn the PineNote off (press the power button for 5 seconds), and flip it around so that the display faces down&lt;br /&gt;
# Place a magnet in the correct place on the back of the PineNote, use one of the following methods:&lt;br /&gt;
#* Place a magnet on the small circle printed on the back, the pens magnetic cap can be used for this.&lt;br /&gt;
#* Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Connect the PineNote to the PC using a USB-C cable, this will wake it up and boot. Wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that ''Loader'' here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays ''Maskrom'' (not ''Loader'') from the RK3566).&lt;br /&gt;
&lt;br /&gt;
In case it doesn't work the first time just try again.&lt;br /&gt;
&lt;br /&gt;
=== The u-boot way ===&lt;br /&gt;
# Interrupt the u-boot startup using ''ctrl-c'' (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;lt;code&amp;gt;rockusb 0 mmc 0&amp;lt;/code&amp;gt; to start Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between U-Boot and Rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
=== Shorting test points ===&lt;br /&gt;
{{Warning | This has the potential to damage you PineNote}}&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Ensure the device is off by pressing and holding the power button for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0), this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Perform the short using one of:&lt;br /&gt;
 * A small tweezers&lt;br /&gt;
 * The programming pogo pins for a PineTime (mask the two unused pins with tape), the spring loaded nature of pogo pins helps getting a good contact&lt;br /&gt;
When shorting the test pads take great care to not short / touch other components or scratch the PCB as this '''may damage your PineNote'''.&lt;br /&gt;
&lt;br /&gt;
While keeping the test pads shorted plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
 &lt;br /&gt;
 $ rkdeveloptool list-devices&lt;br /&gt;
 DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineNoteMagnetOnBack.jpg&amp;diff=15588</id>
		<title>File:PineNoteMagnetOnBack.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineNoteMagnetOnBack.jpg&amp;diff=15588"/>
		<updated>2023-01-15T18:55:58Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Image of a PineNote with a 25% opacity magnet on the printed circle&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Image of a PineNote with a 25% opacity magnet on the printed circle&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{cc-by-sa-4.0}}&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15587</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15587"/>
		<updated>2023-01-15T18:48:43Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Added using the circle and ensuring that the device is off before trying to get into rockusb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in maskrom/rockusb mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
* SPI NOR flash&lt;br /&gt;
* SPI NAND flash&lt;br /&gt;
* eMMC&lt;br /&gt;
* SD-Card&lt;br /&gt;
&lt;br /&gt;
''In the case of the PineNote there is only the eMMC''&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
 sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
 sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Entering Maskrom/Rockusb Mode ==&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
===  The magnet way ===&lt;br /&gt;
&lt;br /&gt;
# Remove the USB-C cable if connected&lt;br /&gt;
# Turn the PineNote off (press the power button for 5 seconds), and flip it around so that the display faces down&lt;br /&gt;
# Place a magnet in the correct place on the back of the PineNote, use one of the following methods:&lt;br /&gt;
#* Place a magnet on the small circle printed on the back, the pens magnetic cap can be used for this.&lt;br /&gt;
#* Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Connect the PineNote to the PC using a USB-C cable, this will wake it up and boot. Wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that ''Loader'' here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays ''Maskrom'' (not ''Loader'') from the RK3566).&lt;br /&gt;
&lt;br /&gt;
In case it doesn't work the first time just try again.&lt;br /&gt;
&lt;br /&gt;
=== The u-boot way ===&lt;br /&gt;
# Interrupt the u-boot startup using ''ctrl-c'' (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;lt;code&amp;gt;rockusb 0 mmc 0&amp;lt;/code&amp;gt; to start Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between U-Boot and Rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
=== Shorting test points ===&lt;br /&gt;
{{Warning | This has the potential to damage you PineNote}}&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Ensure the device is off by pressing and holding the power button for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0), this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Perform the short using one of:&lt;br /&gt;
 * A small tweezers&lt;br /&gt;
 * The programming pogo pins for a PineTime (mask the two unused pins with tape), the spring loaded nature helps get a good contact&lt;br /&gt;
When shorting the test pads take great care to not short / touch other components or scratch the PCB as this '''may damage your PineNote'''.&lt;br /&gt;
&lt;br /&gt;
While keeping the test pads shorted plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
 Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
 &lt;br /&gt;
 $ rkdeveloptool list-devices&lt;br /&gt;
 DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15581</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15581"/>
		<updated>2023-01-15T13:52:04Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Copied in the how to get into rockusb mode and added some warnings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in maskrom/rockusb mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
  SPI NOR flash&lt;br /&gt;
  SPI NAND flash&lt;br /&gt;
  eMMC&lt;br /&gt;
  SD-Card&lt;br /&gt;
&lt;br /&gt;
''In the case of the PineNote there is only the eMMC''&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
  git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
  cd rkdeveloptool&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
  cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
  sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
  sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Entering Maskrom/Rockusb Mode ==&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
===  The magnet way ===&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that ''Loader'' here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays ''Maskrom'' (not ''Loader'') from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
=== The u-boot way ===&lt;br /&gt;
# Interrupt the u-boot startup using ''ctrl-c'' (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;lt;code&amp;gt;rockusb 0 mmc 0&amp;lt;/code&amp;gt; to start Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between U-Boot and Rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
=== Shorting test points ===&lt;br /&gt;
{{Warning | This has the potential to damage you PineNote}}&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Ensure the device is off by pressing and holding the power button for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0), this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Perform the short using one of:&lt;br /&gt;
 * A small tweezers&lt;br /&gt;
 * The programming pogo pins for a PineTime (mask the two unused pins with tape), the spring loaded nature helps get a good contact&lt;br /&gt;
When shorting the test pads take great care to not short / touch other components or scratch the PCB as this '''may damage your PineNote'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While keeping the test pads shorted plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
  Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
  Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
  &lt;br /&gt;
  $ rkdeveloptool list-devices&lt;br /&gt;
  DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15580</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15580"/>
		<updated>2023-01-15T13:24:52Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Copied more of the build instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in maskrom/download mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
  SPI NOR flash&lt;br /&gt;
  SPI NAND flash&lt;br /&gt;
  eMMC&lt;br /&gt;
  SD-Card&lt;br /&gt;
&lt;br /&gt;
''In the case of the PineNote there is only the eMMC''&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in USB download mode&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 develops a [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool forked version] of the rkdeveloptool by RockChip, the following describes how to build the fork:&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
  git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
  cd rkdeveloptool&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
  cmake ..&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
  sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
  sudo udevadm control --reload&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15579</id>
		<title>User:Talpa/Using rkdeveloptool</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Using_rkdeveloptool&amp;diff=15579"/>
		<updated>2023-01-15T13:07:30Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Initial page dedicated to using rkdeveloptool&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using rkdeveloptool =&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line tool that can communicate with a some Rockchip SOCs like the RK3566 in the PineNote when they are in maskrom/download mode.&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool can among other things read and write to the eMMC inside the PineNote.&lt;br /&gt;
&lt;br /&gt;
It is therefor useful for [[PineNote_Development/Backup | backups]] and installing an OS to the PineNote.&lt;br /&gt;
&lt;br /&gt;
== About the boot process of the PineNote ==&lt;br /&gt;
When the RK3566 is powered on it checks the attached storage devices in the ''boot order'':&lt;br /&gt;
&lt;br /&gt;
  SPI NOR flash&lt;br /&gt;
  SPI NAND flash&lt;br /&gt;
  eMMC&lt;br /&gt;
  SD-Card&lt;br /&gt;
&lt;br /&gt;
''In the case of the PineNote there is only the eMMC''&lt;br /&gt;
&lt;br /&gt;
If the SOC finds a storage device with a valid ID BLOCK it proceeds to boot from the device.&lt;br /&gt;
&lt;br /&gt;
If no usable storage device is found the ROM in the SOC enters maskrom mode and awaits a connection over USB&lt;br /&gt;
&lt;br /&gt;
The PineNote additionally has a magnet sensor that is read by U-Boot during startup and if it detects a magnet U-Boot places the device in download mode&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Compiling rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
Pine64 has forked the rkdeveloptool by RockChip, the following describes how to build the fork&lt;br /&gt;
&lt;br /&gt;
  git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
  cd rkdeveloptool&lt;br /&gt;
  mkdir build&lt;br /&gt;
  cd build&lt;br /&gt;
  cmake ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15578</id>
		<title>User:Talpa/Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15578"/>
		<updated>2023-01-15T12:15:10Z</updated>

		<summary type="html">&lt;p&gt;Talpa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Backup =&lt;br /&gt;
&lt;br /&gt;
{{Info|A backup of the content of the internal eMMC before any of the irreplaceable '''unique''' data gets messed up is '''mandatory'''.}}&lt;br /&gt;
The '''first 64 sectors''' of the eMMC and the '''''waveform'' partition''' contains irreplaceable data unique to your PineNote and must be backed up.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large ''userdata'' partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched U-Boo for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
Build rkdeveloptool:&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
Download mode&lt;br /&gt;
Enter the download mode by placing the pen as pictured below. A magnet placed where the pen's cap is should also work (haven't tried). I guess the dot on the case also indicates the position of the sensor.&lt;br /&gt;
&lt;br /&gt;
placing pen on the back&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; should now recognize the PineNote as:&lt;br /&gt;
&lt;br /&gt;
 2207:350a Fuzhou Rockchip Electronics Company USB download gadget&lt;br /&gt;
&lt;br /&gt;
List partitions:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; rkdeveloptool list-partitions                      &lt;br /&gt;
 #   LBA start (sectors)  LBA end (sectors)  Size (bytes)       Name                &lt;br /&gt;
 00                16384              24575       4194304       uboot&lt;br /&gt;
 01                24576              32767       4194304       trust&lt;br /&gt;
 02                32768              36863       2097152       waveform&lt;br /&gt;
 03                36864              45055       4194304       misc&lt;br /&gt;
 04                45056              53247       4194304       dtbo&lt;br /&gt;
 05                53248              55295       1048576       vbmeta&lt;br /&gt;
 06                55296             137215      41943040       boot&lt;br /&gt;
 07               137216             145407       4194304       security&lt;br /&gt;
 08               145408             407551     134217728       recovery&lt;br /&gt;
 09               407552            1193983     402653184       backup&lt;br /&gt;
 10              1193984            3291135    1073741824       cache&lt;br /&gt;
 11              3291136            3323903      16777216       metadata&lt;br /&gt;
 12              3323904            9697279    3263168512       super&lt;br /&gt;
 13              9697280            9730047      16777216       logo&lt;br /&gt;
 14              9730048            9861119      67108864       device&lt;br /&gt;
 15              9861120          241827775  118766927872       userdata&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|this process is very new! Proceed at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/m-weigand/pinenote-debian-recipes/releases/tag/v0.1 instructions on this artifact]. It will instruct you on extracting the rootfs into an empty ext4 partition. This can be done from Linux or Android. Further instructions on building your own rootfs [https://github.com/m-weigand/pinenote-debian-recipes can be found here].&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk.&lt;br /&gt;
&lt;br /&gt;
It also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using ''dd''.&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the eMMC.&lt;br /&gt;
&lt;br /&gt;
[[Category:PineNote]]&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15577</id>
		<title>User:Talpa/Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15577"/>
		<updated>2023-01-15T12:07:54Z</updated>

		<summary type="html">&lt;p&gt;Talpa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Backup =&lt;br /&gt;
&lt;br /&gt;
{{Info|A backup of the content of the internal eMMC before any of the '''unique''' data gets messed up is '''mandatory'''.}}&lt;br /&gt;
Especially the first 64 sectors of the eMMC and the ''waveform'' partition contains data '''unique''' irreplaceable data to your PineNote and must be backed up.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large ''userdata'' partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched U-Boo for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
Build rkdeveloptool:&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
Download mode&lt;br /&gt;
Enter the download mode by placing the pen as pictured below. A magnet placed where the pen's cap is should also work (haven't tried). I guess the dot on the case also indicates the position of the sensor.&lt;br /&gt;
&lt;br /&gt;
placing pen on the back&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; should now recognize the PineNote as:&lt;br /&gt;
&lt;br /&gt;
 2207:350a Fuzhou Rockchip Electronics Company USB download gadget&lt;br /&gt;
&lt;br /&gt;
List partitions:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; rkdeveloptool list-partitions                      &lt;br /&gt;
 #   LBA start (sectors)  LBA end (sectors)  Size (bytes)       Name                &lt;br /&gt;
 00                16384              24575       4194304       uboot&lt;br /&gt;
 01                24576              32767       4194304       trust&lt;br /&gt;
 02                32768              36863       2097152       waveform&lt;br /&gt;
 03                36864              45055       4194304       misc&lt;br /&gt;
 04                45056              53247       4194304       dtbo&lt;br /&gt;
 05                53248              55295       1048576       vbmeta&lt;br /&gt;
 06                55296             137215      41943040       boot&lt;br /&gt;
 07               137216             145407       4194304       security&lt;br /&gt;
 08               145408             407551     134217728       recovery&lt;br /&gt;
 09               407552            1193983     402653184       backup&lt;br /&gt;
 10              1193984            3291135    1073741824       cache&lt;br /&gt;
 11              3291136            3323903      16777216       metadata&lt;br /&gt;
 12              3323904            9697279    3263168512       super&lt;br /&gt;
 13              9697280            9730047      16777216       logo&lt;br /&gt;
 14              9730048            9861119      67108864       device&lt;br /&gt;
 15              9861120          241827775  118766927872       userdata&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|this process is very new! Proceed at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/m-weigand/pinenote-debian-recipes/releases/tag/v0.1 instructions on this artifact]. It will instruct you on extracting the rootfs into an empty ext4 partition. This can be done from Linux or Android. Further instructions on building your own rootfs [https://github.com/m-weigand/pinenote-debian-recipes can be found here].&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk.&lt;br /&gt;
&lt;br /&gt;
It also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using ''dd''.&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the eMMC.&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15576</id>
		<title>User:Talpa/Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15576"/>
		<updated>2023-01-15T12:07:37Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Reduced amount of text and insists on backing up the 64 first sectors (they contain the vendor storage data)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Backup =&lt;br /&gt;
&lt;br /&gt;
{{Info|A backup of the content of the internal eMMC before any of the '''unique''' data gets messed up is '''mandatory'''.&lt;br /&gt;
Especially the first 64 sectors of the eMMC and the ''waveform'' partition contains data '''unique''' irreplaceable data to your PineNote and must be backed up.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large ''userdata'' partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched U-Boo for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
Build rkdeveloptool:&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
Download mode&lt;br /&gt;
Enter the download mode by placing the pen as pictured below. A magnet placed where the pen's cap is should also work (haven't tried). I guess the dot on the case also indicates the position of the sensor.&lt;br /&gt;
&lt;br /&gt;
placing pen on the back&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; should now recognize the PineNote as:&lt;br /&gt;
&lt;br /&gt;
 2207:350a Fuzhou Rockchip Electronics Company USB download gadget&lt;br /&gt;
&lt;br /&gt;
List partitions:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; rkdeveloptool list-partitions                      &lt;br /&gt;
 #   LBA start (sectors)  LBA end (sectors)  Size (bytes)       Name                &lt;br /&gt;
 00                16384              24575       4194304       uboot&lt;br /&gt;
 01                24576              32767       4194304       trust&lt;br /&gt;
 02                32768              36863       2097152       waveform&lt;br /&gt;
 03                36864              45055       4194304       misc&lt;br /&gt;
 04                45056              53247       4194304       dtbo&lt;br /&gt;
 05                53248              55295       1048576       vbmeta&lt;br /&gt;
 06                55296             137215      41943040       boot&lt;br /&gt;
 07               137216             145407       4194304       security&lt;br /&gt;
 08               145408             407551     134217728       recovery&lt;br /&gt;
 09               407552            1193983     402653184       backup&lt;br /&gt;
 10              1193984            3291135    1073741824       cache&lt;br /&gt;
 11              3291136            3323903      16777216       metadata&lt;br /&gt;
 12              3323904            9697279    3263168512       super&lt;br /&gt;
 13              9697280            9730047      16777216       logo&lt;br /&gt;
 14              9730048            9861119      67108864       device&lt;br /&gt;
 15              9861120          241827775  118766927872       userdata&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|this process is very new! Proceed at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/m-weigand/pinenote-debian-recipes/releases/tag/v0.1 instructions on this artifact]. It will instruct you on extracting the rootfs into an empty ext4 partition. This can be done from Linux or Android. Further instructions on building your own rootfs [https://github.com/m-weigand/pinenote-debian-recipes can be found here].&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk.&lt;br /&gt;
&lt;br /&gt;
It also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using ''dd''.&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the eMMC.&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15575</id>
		<title>User:Talpa/Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Talpa/Backup&amp;diff=15575"/>
		<updated>2023-01-15T11:57:26Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Copy of the moved backup instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Backup ==&lt;br /&gt;
&lt;br /&gt;
{{Info|A backup of the content of the internal eMMC before anything gets messed is '''mandatory'''.}}&lt;br /&gt;
&lt;br /&gt;
Especially the ''waveform'' partition contains data '''unique''' to your PineNote and is a prime candidate for backup.&lt;br /&gt;
&lt;br /&gt;
But other partitions like U-Boot (need for any operation of the device) or the un-partitioned space at the beginning containing the GPT partition table (and presumably the VCOM setting for the e-ink display and maybe device mac addresses) contains data you may wish to backup.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large ''userdata'' partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched U-Boo for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
Build rkdeveloptool:&lt;br /&gt;
&lt;br /&gt;
 git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
 cd rkdeveloptool&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
&lt;br /&gt;
Download mode&lt;br /&gt;
Enter the download mode by placing the pen as pictured below. A magnet placed where the pen's cap is should also work (haven't tried). I guess the dot on the case also indicates the position of the sensor.&lt;br /&gt;
&lt;br /&gt;
placing pen on the back&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt; should now recognize the PineNote as:&lt;br /&gt;
&lt;br /&gt;
 2207:350a Fuzhou Rockchip Electronics Company USB download gadget&lt;br /&gt;
&lt;br /&gt;
List partitions:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; rkdeveloptool list-partitions                      &lt;br /&gt;
 #   LBA start (sectors)  LBA end (sectors)  Size (bytes)       Name                &lt;br /&gt;
 00                16384              24575       4194304       uboot&lt;br /&gt;
 01                24576              32767       4194304       trust&lt;br /&gt;
 02                32768              36863       2097152       waveform&lt;br /&gt;
 03                36864              45055       4194304       misc&lt;br /&gt;
 04                45056              53247       4194304       dtbo&lt;br /&gt;
 05                53248              55295       1048576       vbmeta&lt;br /&gt;
 06                55296             137215      41943040       boot&lt;br /&gt;
 07               137216             145407       4194304       security&lt;br /&gt;
 08               145408             407551     134217728       recovery&lt;br /&gt;
 09               407552            1193983     402653184       backup&lt;br /&gt;
 10              1193984            3291135    1073741824       cache&lt;br /&gt;
 11              3291136            3323903      16777216       metadata&lt;br /&gt;
 12              3323904            9697279    3263168512       super&lt;br /&gt;
 13              9697280            9730047      16777216       logo&lt;br /&gt;
 14              9730048            9861119      67108864       device&lt;br /&gt;
 15              9861120          241827775  118766927872       userdata&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|this process is very new! Proceed at your own risk.}}&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/m-weigand/pinenote-debian-recipes/releases/tag/v0.1 instructions on this artifact]. It will instruct you on extracting the rootfs into an empty ext4 partition. This can be done from Linux or Android. Further instructions on building your own rootfs [https://github.com/m-weigand/pinenote-debian-recipes can be found here].&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk.&lt;br /&gt;
&lt;br /&gt;
It also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using ''dd''.&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the eMMC.&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15254</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15254"/>
		<updated>2022-12-30T12:09:04Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Additional information on getting WiFi and BT driver blobs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Backup of the content of the internal MMC before you mess anything up ==&lt;br /&gt;
Especially the '''waveform''' partition contains data '''unique''' to your PineNote and is a prime candidate for backup.&lt;br /&gt;
&lt;br /&gt;
But other partitions like uboot (need for any operation of the device) or the un-partitioned space at the beginning containing the GPT partition table (and presumably the VCOM setting for the e-ink display and maybe device mac addresses) contains data you may wish to backup.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large userdata partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched uboot for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk&lt;br /&gt;
&lt;br /&gt;
I also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
For any one knowing how and with which caveats: Write ME&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using dd&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the MMC.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0) with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware for WiFi &amp;amp; Bluetooth and Waveform data ===&lt;br /&gt;
&lt;br /&gt;
==== Using Maximilian's Debian image  ====&lt;br /&gt;
If the Android partition (super) and waveform partition (waveform) is left intact the image extracts the WiFi, BT driver and waveform from the partitions on first run.&lt;br /&gt;
&lt;br /&gt;
For instance if you repartitions the userdata partition and installs the image there.&lt;br /&gt;
&lt;br /&gt;
==== Getting it from the Android install manually ====&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
==== Getting the Wifi and Bluetooth driver blobs from &amp;quot;other&amp;quot; sources ====&lt;br /&gt;
===== WiFi =====&lt;br /&gt;
The WiFi firmware .bin blob can be obtained by installing the Debian package firmware-brcm80211 (in the non-free section)&lt;br /&gt;
&lt;br /&gt;
The WiFi brcmfmac43455-sdio.txt file can according to Eugen be sourced from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/brcm/brcmfmac43455-sdio.AW-CM256SM.txt needs a renaming when copying it to /lib/firmware/brcm/brcmfmac43455-sdio.txt)&lt;br /&gt;
&lt;br /&gt;
''The content of the upstream .txt is different than the Android configuration, but is supposed to work.''&lt;br /&gt;
&lt;br /&gt;
As you don't have WiFi yet you need to get the firmware-brcm80211*.deb and brcmfmac43455-sdio.txt file on the PineNote by other means, for instance using an USB stick&lt;br /&gt;
&lt;br /&gt;
===== Bluetooth =====&lt;br /&gt;
&lt;br /&gt;
Once you have WiFi working you can get BCM4345C0.hcd by installing the bluez-firmware &lt;br /&gt;
  sudo apt install bluez-firmware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configuring the E-ink refresh mode ===&lt;br /&gt;
https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches contains information on how/where to write in /sys to alter the refresh mode&lt;br /&gt;
&lt;br /&gt;
https://github.com/m-weigand/mw_pinenote_misc/tree/main/gnome_extension contains the gnome extension used in Maximilian image &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15253</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15253"/>
		<updated>2022-12-30T11:36:21Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Links to information about changing the e-ink refresh mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Backup of the content of the internal MMC before you mess anything up ==&lt;br /&gt;
Especially the '''waveform''' partition contains data '''unique''' to your PineNote and is a prime candidate for backup.&lt;br /&gt;
&lt;br /&gt;
But other partitions like uboot (need for any operation of the device) or the un-partitioned space at the beginning containing the GPT partition table (and presumably the VCOM setting for the e-ink display and maybe device mac addresses) contains data you may wish to backup.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large userdata partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched uboot for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk&lt;br /&gt;
&lt;br /&gt;
I also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
For any one knowing how and with which caveats: Write ME&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using dd&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the MMC.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0) with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Configuring the E-ink refresh mode ===&lt;br /&gt;
https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches contains information on how/where to write in /sys to alter the refresh mode&lt;br /&gt;
&lt;br /&gt;
https://github.com/m-weigand/mw_pinenote_misc/tree/main/gnome_extension contains the gnome extension used in Maximilian image &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15230</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15230"/>
		<updated>2022-12-25T14:40:29Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Some notes on backing up the MMC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Backup of the content of the internal MMC before you mess anything up ==&lt;br /&gt;
Especially the '''waveform''' partition contains data '''unique''' to your PineNote and is a prime candidate for backup.&lt;br /&gt;
&lt;br /&gt;
But other partitions like uboot (need for any operation of the device) or the un-partitioned space at the beginning containing the GPT partition table (and presumably the VCOM setting for the e-ink display and maybe device mac addresses) contains data you may wish to backup.&lt;br /&gt;
&lt;br /&gt;
Depending of your personal level of data hoarder you may want to backup more than this or even just everything (the large userdata partition is supposed to be able to be repopulated as empty space by Android)&lt;br /&gt;
&lt;br /&gt;
In any case it is easier to restore/extract data from a backup than not having one if you need one.&lt;br /&gt;
&lt;br /&gt;
=== Manually using rkdeveloptool ===&lt;br /&gt;
Dorian has some nice [https://github.com/DorianRudolph/pinenotes notes regarding the PineNote]&lt;br /&gt;
&lt;br /&gt;
Don't forget to install a patched uboot for reading beyond 32MB and to respect the 2GB limit/bug of the current rkdeveloptool as per his notes&lt;br /&gt;
&lt;br /&gt;
=== Automated backup using a script and rkdeveloptool ===&lt;br /&gt;
[https://github.com/talpadk/pinenote-backup pinenote-backup] is a python script for detecting the partitions and automating the backup of partitions or the whole disk&lt;br /&gt;
&lt;br /&gt;
I also requires a patched u-boot but automatically handles the 2GB limit by splitting up larger reads into smaller ones&lt;br /&gt;
&lt;br /&gt;
=== Using the factory Android installation ===&lt;br /&gt;
For any one knowing how and with which caveats: Write ME&lt;br /&gt;
&lt;br /&gt;
=== Using a user installed Linux ===&lt;br /&gt;
A Linux installed to the cache partition should be able to easily backup everything over WiFi or to a USB stick/disk using dd&lt;br /&gt;
&lt;br /&gt;
However the user would need to backup the cache partition themself (if they want that).&lt;br /&gt;
&lt;br /&gt;
And more importantly they would only be getting the backup ''after'' they started playing with the content of the MMC.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0) with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15132</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15132"/>
		<updated>2022-12-10T19:52:38Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Description of what the test points TP1301 and TP1302 are&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 (GND) and TP1302 (eMMC_D0/FLASH_D0) with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15130</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15130"/>
		<updated>2022-12-10T13:06:46Z</updated>

		<summary type="html">&lt;p&gt;Talpa: /* The u-boot way */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using an UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 and TP1302 with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15129</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15129"/>
		<updated>2022-12-10T13:04:02Z</updated>

		<summary type="html">&lt;p&gt;Talpa: /* The u-boot way */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using am UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have an UART dongle that allows to simultaneous having an UART and USB connection, there is no need to plug and unplug cables and flipping the PineNote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.&lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 and TP1302 with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15128</id>
		<title>PineNote Development</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineNote_Development&amp;diff=15128"/>
		<updated>2022-12-10T13:03:09Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Added a third way to enter rockusb mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article seeks to provide general development information for the [[PineNote]]. If you are new and down to try a new installation process, the easiest way to get linux is likely to [https://wiki.pine64.org/wiki/PineNote_Development/Installing_Debian install Debian] -- NOTE THAT THIS INSTALLATION PROCESS IS VERY NEW. While many people have been using the kernel that will be installed safely at this point, the instructions for installing Debian via rootfs are very new. Take backups!&lt;br /&gt;
&lt;br /&gt;
The more stable recommended approach is described below:&lt;br /&gt;
&lt;br /&gt;
Start with [https://github.com/DorianRudolph/pinenotes Dorian's guide] which will guide you through getting Arch installed. For instructions on building the latest kernel, see [[PineNote Development/Building Kernel]]. For helpful configurations, see [[PineNote Development/Apps]]. For ways to pitch in, see [[PineNote Development/TODOs]]. To boot Linux by default instead of Android, see [[PineNote Development/Booting Linux]]. [https://www.youtube.com/watch?v=ZCLyJfbzbrU Here is a video] of a user running Manjaro and some apps on their PineNote on 9/10/2022.&lt;br /&gt;
&lt;br /&gt;
= More Information = &lt;br /&gt;
== High-level developer new to embedded linux? ==&lt;br /&gt;
Here are some resources I have found helpful in learning to develop on embedded linux devices:&lt;br /&gt;
* Great youtube series introducing you to the kernel and lower-level components of Linux: https://www.youtube.com/watch?v=WiZ05pnHZqM&lt;br /&gt;
* https://embetronicx.com/&lt;br /&gt;
* https://bootlin.com/training/&lt;br /&gt;
* https://www.nand2tetris.org&lt;br /&gt;
&lt;br /&gt;
== Notes Written by Some Developers ==&lt;br /&gt;
&lt;br /&gt;
* https://github.com/m-weigand/mw_pinenote_misc (Not super legible &amp;quot;notes&amp;quot;, but very helpful repo with patches, videos, etc)&lt;br /&gt;
** specifically see this section for helpful install/configure scripts: https://github.com/m-weigand/mw_pinenote_misc/tree/main/rockchip_ebc/patches#compiling. &lt;br /&gt;
* https://github.com/0cc4m/pinenote-misc&lt;br /&gt;
** patch for enabling gpu: https://github.com/0cc4m/pinenote-misc/blob/main/mesa-archlinux-arm/mesa/rockchip_ebc.patch&lt;br /&gt;
** prebuilt pkg's: https://github.com/0cc4m/pinenote-misc/releases&lt;br /&gt;
* https://pwarren.id.au/pinenote/build_notes.txt&lt;br /&gt;
* https://github.com/DorianRudolph/pinenotes&lt;br /&gt;
* https://github.com/tpwrules/nixos-pinenote&lt;br /&gt;
&lt;br /&gt;
== Alternative to patching of mesa ==&lt;br /&gt;
Mesa needs to be patched to add the driver entry point. The alternative to this, is the renaming of the ebc driver to an existing mesa driver entry point. A good existing name can be &amp;quot;repaper&amp;quot;. To change the driver name, edit in the kernel tree the following files:&amp;lt;br&amp;gt;&lt;br /&gt;
- replace &amp;quot;rockchip-ebc&amp;quot; with &amp;quot;repaper&amp;quot; in the two places in the file: drivers/gpu/drm/rockchip/rockchip_ebc.c &amp;lt;br&amp;gt;&lt;br /&gt;
- preventive, replace &amp;quot;repaper&amp;quot; with &amp;quot;repaper-disabled&amp;quot; in the two places in the file: drivers/gpu/drm/tiny/repaper.c &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the most recent kernel ==&lt;br /&gt;
See [https://wiki.pine64.org/wiki/PineNote_Development/Building_Kernel here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Video of Factory Android OS ==&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=DWuTGgQHw98 PineNote Developer Edition w/Tech Demo Android OS (Video Only)]&lt;br /&gt;
&lt;br /&gt;
Informal walkthrough of the factory Android installation on the PineNote Developer Edition, recorded by a community member (Apr 2022). This is useful to look back at the original OS after erasing it from your device, or to get some additional detail before your device arrives.&lt;br /&gt;
&lt;br /&gt;
The video also includes a chapter at the end showing [https://www.youtube.com/watch?v=DWuTGgQHw98&amp;amp;t=802s how to enable Android Debug Bridge (`adb`) over USB]. Once enabled, keep the device powered and connect a USB cable directly to the PineNote (i.e. no UART breakout) to a computer running `adb`.&lt;br /&gt;
&lt;br /&gt;
== Emulator for Developing/Testing Pinenote Apps ==&lt;br /&gt;
https://github.com/michaelshiel/picom-epaper&lt;br /&gt;
&lt;br /&gt;
= Flashing Software =&lt;br /&gt;
&lt;br /&gt;
Currently, the only ways to flash software are from the factory Android installation (UART shell, adb, or fastboot) or by using rkdeveloptool.&lt;br /&gt;
&lt;br /&gt;
== Side-by-side setup ==&lt;br /&gt;
&lt;br /&gt;
It is possible to set up a partition for mainline development without disturbing the factory Android installation. This allows updating a mainline kernel, DTB, and initramfs over Wi-Fi until WiFi or USB OTG is working in mainline Linux.&lt;br /&gt;
&lt;br /&gt;
=== Without Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
The recommended partition for this is &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt; aka &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. It is large and already formatted as &amp;lt;tt&amp;gt;ext4&amp;lt;/tt&amp;gt;, so it is readable from U-Boot. Here are some general steps:&lt;br /&gt;
&lt;br /&gt;
# From the UART or adb shell, set up your chroot in &amp;lt;tt&amp;gt;/cache&amp;lt;/tt&amp;gt;. I used the Alpine Linux rootfs tarball.&lt;br /&gt;
# Copy in your kernel and DTB, using for example &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; inside the chroot.&lt;br /&gt;
# Finally, create and boot an &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below.&lt;br /&gt;
&lt;br /&gt;
=== With Repartitioning ===&lt;br /&gt;
&lt;br /&gt;
It is possible to shrink the &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; partition, and create a new partition at the end for use with mainline Linux. This provides much more space than &amp;lt;tt&amp;gt;cache&amp;lt;/tt&amp;gt;. However, because &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt; is formatted with &amp;lt;tt&amp;gt;f2fs&amp;lt;/tt&amp;gt;, and that filesystem cannot be shrunk, resizing the partition requires wiping &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# Back up any necessary files from userdata&lt;br /&gt;
# Boot to a mainline kernel from &amp;lt;tt&amp;gt;mmcblk0p11&amp;lt;/tt&amp;gt;, either using that partition as rootfs (see above), or using an initramfs with repartitioning tools&lt;br /&gt;
# Modify the partition table with your favorite tool, e.g. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;parted&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Reboot into &amp;lt;tt&amp;gt;fastboot&amp;lt;/tt&amp;gt; and wipe &amp;lt;tt&amp;gt;userdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Reboot into Android, where you can now chroot in and install your favorite distribution to the new partition.&lt;br /&gt;
&lt;br /&gt;
== Using rkdeveloptool ==&lt;br /&gt;
&lt;br /&gt;
rkdeveloptool is a command line utility built on libusb.&lt;br /&gt;
&lt;br /&gt;
=== Downloading and Building rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
PINE64 develops [https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool its own updated fork of rkdeveloptool on GitLab].&lt;br /&gt;
&lt;br /&gt;
You will need to have libusb 1.0, its development headers and scdoc installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/pine64-org/quartz-bsp/rkdeveloptool.git&lt;br /&gt;
cd rkdeveloptool&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sets up all the build files. You can then compile with &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; inside the build directory.&lt;br /&gt;
&lt;br /&gt;
After you're done, you'll likely also need to install the udev rules, or else your user won't have permission to access the USB devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp 99-rk-rockusb.rules /etc/udev/rules.d/&lt;br /&gt;
sudo udevadm control --reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copying the udev rules is also performed automatically when you &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Building Downstream U-Boot ===&lt;br /&gt;
&lt;br /&gt;
While in maskrom mode, we need to have a u-boot to download onto the device for any of the other commands to work. To build you'll also need to install device-tree-compiler.&lt;br /&gt;
&lt;br /&gt;
You also need to install Python and pyelftools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Note that rkbin is a &amp;amp;gt;5GB download!&amp;lt;/b&amp;gt; This will take some time to clone and process the deltas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone -b quartz64 https://gitlab.com/pgwipeout/u-boot-rockchip.git&lt;br /&gt;
git clone -b rkbin https://github.com/JeffyCN/rockchip_mirrors.git rkbin&lt;br /&gt;
cd u-boot-rockchip&lt;br /&gt;
# If using Arch Linux, export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
export CROSS_COMPILE=aarch64-none-linux-gnu-&lt;br /&gt;
make rk3566-quartz64_defconfig&lt;br /&gt;
./make.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In the version I cloned (current as of 2022-01-02), I had to make a change to one line to get a clean compilation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/lib/avb/libavb/avb_slot_verify.c b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
index 123701fc3b..64a1ce6450 100644&lt;br /&gt;
--- a/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
+++ b/lib/avb/libavb/avb_slot_verify.c&lt;br /&gt;
@@ -296,7 +296,7 @@ static AvbSlotVerifyResult load_and_verify_hash_partition(&lt;br /&gt;
   bool image_preloaded = false;&lt;br /&gt;
   uint8_t* digest;&lt;br /&gt;
   size_t digest_len;&lt;br /&gt;
-  const char* found;&lt;br /&gt;
+  const char* found = NULL;&lt;br /&gt;
   uint64_t image_size;&lt;br /&gt;
   size_t expected_digest_len = 0;&lt;br /&gt;
   uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For systems where the global python executable points to python2, compilation fails with an error related to pyelftools not being installed (even if it is). To fix this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/make.sh b/make.sh&lt;br /&gt;
index 2bba05b4e4..cfe5b0afd5 100755&lt;br /&gt;
--- a/make.sh&lt;br /&gt;
+++ b/make.sh&lt;br /&gt;
@@ -758,7 +758,7 @@ function pack_fit_image()&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        if [ &amp;quot;${ARM64_TRUSTZONE}&amp;quot; == &amp;quot;y&amp;quot; ]; then&lt;br /&gt;
-               if ! python -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
+               if ! python3 -c &amp;quot;import elftools&amp;quot; ; then&lt;br /&gt;
                        echo &amp;quot;ERROR: No python 'pyelftools', please: pip install pyelftools&amp;quot;&lt;br /&gt;
                        exit 1&lt;br /&gt;
                fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Entering Maskrom/Rockusb Mode ===&lt;br /&gt;
&lt;br /&gt;
There are three ways to get into Maskrom/Rockusb mode:&lt;br /&gt;
&lt;br /&gt;
====  The easy way ====&lt;br /&gt;
&lt;br /&gt;
# Flip the device around so that the display faces down&lt;br /&gt;
# Lay the pen on the right side, with its tip pointing towards the speaker grill, and its magnet pointing towards the upper right corner of the label on the back (or place the magnetic cap from the pen on the spot marked on the back).&lt;br /&gt;
# Turn the device on and wait for it to show up in &amp;lt;code&amp;gt;lsusb&amp;lt;/code&amp;gt;. It should now be in Loader mode, according to &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt; (note that &amp;quot;Loader&amp;quot; here indicates U-Boot's Rockusb; separately, booting with an erased eMMC displays &amp;quot;Maskrom&amp;quot; [not &amp;quot;Loader&amp;quot;] from the RK3566).&lt;br /&gt;
# Unplug the device and plug it back in. It should now be in Rockusb mode.&lt;br /&gt;
&lt;br /&gt;
This can be a bit fiddly to get right, and may need a few tries.&lt;br /&gt;
&lt;br /&gt;
==== The u-boot way ====&lt;br /&gt;
# Interrupt the u-boot startup using ctrl-c (while attached using a UART dongle)&lt;br /&gt;
# While in u-boot use the command &amp;quot;rockusb 0 mmc 0&amp;quot; to start rockusb mode.&lt;br /&gt;
&lt;br /&gt;
One benefit from this is, that if you have a UART dongle that allows to simultaneous having a UART and USB connection, there is no need to plug and unplug cables and flipping the pinenote around and placing magnets.  &lt;br /&gt;
&lt;br /&gt;
This is especially helpful when changing back and forth between u-boot and rockusb, for instance when trying to develop u-boot.  &lt;br /&gt;
&lt;br /&gt;
==== Shorting test points ====&lt;br /&gt;
&lt;br /&gt;
If the bootloader is broken/corrupted, you cannot get to Maskrom without opening up the device (it can be opened using spudger and a bit of patience).&lt;br /&gt;
&lt;br /&gt;
Once inside, short TP1301 and TP1302 with a small tweezers, this is how it looks on board view (credit to Caleb):&lt;br /&gt;
&lt;br /&gt;
[[File:PineNote_Maskrom_TP.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Then plug the device to the computer and if you see the device with VID=2207/PID=350a then it should be in Maskrom mode, you can verify by typing &amp;lt;code&amp;gt;rkdeveloptool list-devices&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device found, idVendor=2207, idProduct=350a, bcdDevice= 1.00&lt;br /&gt;
Jan 07 15:04:13 melttower kernel: usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0&lt;br /&gt;
&lt;br /&gt;
$ rkdeveloptool list-devices&lt;br /&gt;
DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=10e    Maskrom&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If nothing shows up, you can try to hold down the power button for 5 seconds and then try again.&lt;br /&gt;
&lt;br /&gt;
=== Running rkdeveloptool ===&lt;br /&gt;
&lt;br /&gt;
First, you'll want to make sure the device you've connected is in maskrom mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should output something like &amp;lt;code&amp;gt;DevNo=1 Vid=0x2207,Pid=0x350a,LocationID=202    Maskrom&amp;lt;/code&amp;gt;. If it doesn't, see [[PineNote Development#Entering Maskrom Mode]].&lt;br /&gt;
&lt;br /&gt;
You can now download u-boot onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool boot ../u-boot-rockchip/rk356x_spl_loader_v1.08.111.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should output &amp;lt;code&amp;gt;Downloading bootloader succeeded.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can now verify that this worked using e.g. the &amp;quot;read flash info&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./rkdeveloptool read-flash-info&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''TODO:''' finish this section&lt;br /&gt;
&lt;br /&gt;
=== Creating a mainline boot image ===&lt;br /&gt;
&lt;br /&gt;
You can create a filesystem image that replaces the Android boot or recovery partition by doing roughly the following:&lt;br /&gt;
&lt;br /&gt;
# Erase boot and dtbo with rkdeveloptool or fastboot (back them up first!!!)&lt;br /&gt;
# Create an ext2 partition image and mount it (fallocate, mkfs.ext2)&lt;br /&gt;
# Build your mainline kernel&lt;br /&gt;
# Copy the kernel, dtb and an initramfs to the root of the mounted image (use any old postmarketOS initramfs)&lt;br /&gt;
# Create a file in the root of the mounted image called &amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
# Unmount the image and then use rkdeveloptool to flash it to the &amp;quot;recovery&amp;quot; partition on the pinenote (it's about the right size until we get around to replacing the partition layout).&lt;br /&gt;
&lt;br /&gt;
== Using fastboot ==&lt;br /&gt;
&lt;br /&gt;
Follow the steps for &amp;quot;Creating a mainline boot.img&amp;quot;, but instead of flashing it with rkdeveloptool, use fastboot. You can enter fastboot in either of two ways:&lt;br /&gt;
&lt;br /&gt;
# Use &amp;quot;reboot bootloader&amp;quot; from adb or a UART console.&lt;br /&gt;
# Get a U-Boot prompt and run &amp;lt;code&amp;gt;fastboot usb 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Mainline development =&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
Some work happening here: https://gitlab.com/calebccff/linux, the idea is to import the parts of the eink/ebc drivers which are open source and use the downstream u-boot framebuffer driver as a reference to create a basic framebuffer driver.&lt;br /&gt;
&lt;br /&gt;
Currently mainline struggles to boot due to weird issues while probing fixed regulators (?). It also fails to detect eMMC.&lt;br /&gt;
&lt;br /&gt;
Further work is being done here: https://github.com/smaeul/linux/commits/rk356x-ebc-dev. This has a complete device tree, with working eMMC. Pen input also works out of the box. Wi-Fi and BT work with firmware copied from the factory Android image.&lt;br /&gt;
&lt;br /&gt;
== How to boot mainline ==&lt;br /&gt;
&lt;br /&gt;
UART is currently REQUIRED for this to work! We depend on u-boot falling back to console. Once we have a prebuilt u-boot which will use extlinux by default, UART won't be needed anymore.&lt;br /&gt;
&lt;br /&gt;
You can compile a u-boot that uses extlinux by default by following the instructions [https://github.com/JoshuaMulliken/pinenote_uboot/blob/aa9ecbd3d3e716f163f5a900824630f24e9f04ba/README.md#changing-default-boot-order here].&lt;br /&gt;
&lt;br /&gt;
=== Getting to a U-Boot prompt ===&lt;br /&gt;
&lt;br /&gt;
You can get to a U-Boot prompt by:&lt;br /&gt;
&lt;br /&gt;
# Holding Ctrl-C while the display panel initializes.&lt;br /&gt;
# Wiping the &amp;quot;boot&amp;quot; partition.&lt;br /&gt;
&lt;br /&gt;
=== Using sysboot ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;extlinux.conf&amp;lt;/code&amp;gt; should have the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 10&lt;br /&gt;
default MAINLINE&lt;br /&gt;
menu title boot prev kernel&lt;br /&gt;
&lt;br /&gt;
label MAINLINE&lt;br /&gt;
  kernel /vmlinuz&lt;br /&gt;
  fdt /rk3566-pinenote.dtb&lt;br /&gt;
  initrd /initramfs&lt;br /&gt;
  append earlycon console=tty0 console=ttyS2,1500000n8 fw_devlink=off PMOS_NO_OUTPUT_REDIRECT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the u-boot console, run the following command to boot your mainline kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sysboot ${devtype} ${devnum}:9 any ${scriptaddr} extlinux.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Booting with individual commands ===&lt;br /&gt;
&lt;br /&gt;
Booting with individual commands can be useful when you need to temporarily add some kernel command line arguments. Use these or similar commands at the U-Boot shell:&lt;br /&gt;
&lt;br /&gt;
 load mmc 0:b ${kernel_addr_r} boot/Image&lt;br /&gt;
 load mmc 0:b ${fdt_addr_r} boot/rk3566-pinenote.dtb&lt;br /&gt;
 setenv bootargs ignore_loglevel root=/dev/mmcblk0p11 rootwait init=/bin/bash&lt;br /&gt;
 booti ${kernel_addr_r} - ${fdt_addr_r}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
&lt;br /&gt;
Copy WiFi/BT firmware from Android:&lt;br /&gt;
 mkdir -p /cache/lib/firmware/brcm&lt;br /&gt;
 cp /vendor/etc/firmware/fw_bcm43455c0_ag_cy.bin /cache/lib/firmware/brcm/brcmfmac43455-sdio.bin&lt;br /&gt;
 cp /vendor/etc/firmware/nvram_ap6255_cy.txt /cache/lib/firmware/brcm/brcmfmac43455-sdio.txt&lt;br /&gt;
 cp /cache/lib/firmware/BCM4345C0.hcd /cache/lib/firmware/brcm/BCM4345C0.hcd&lt;br /&gt;
&lt;br /&gt;
Copy waveform partition (via previously dumped file):&lt;br /&gt;
 adb root&lt;br /&gt;
 adb push waveform.img /cache/lib/firmware/waveform.bin&lt;br /&gt;
&lt;br /&gt;
Or via dd within Linux:&lt;br /&gt;
 dd if=/dev/mmcblk0p3 of=/lib/firmware/waveform.bin bs=1k count=2048&lt;br /&gt;
&lt;br /&gt;
=== Touchscreen and Pen In X.org ===&lt;br /&gt;
&lt;br /&gt;
By default the pen config is flipped 180° (which makes it unusable) and the touchscreen doesn't work. Placing the following config in &amp;lt;code&amp;gt;/etc/X11/xorg.conf.d/50-touchscreen.conf&amp;lt;/code&amp;gt; will fix both problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier &amp;quot;evdev touchscreen&amp;quot;&lt;br /&gt;
    MatchProduct &amp;quot;tt21000&amp;quot;&lt;br /&gt;
    MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
    Driver        &amp;quot;evdev&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
    Identifier    &amp;quot;RotateTouch&amp;quot;&lt;br /&gt;
    MatchProduct    &amp;quot;w9013&amp;quot;&lt;br /&gt;
    Option    &amp;quot;TransformationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
EndSection&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Pinebook_Pro_Hardware_Accessory_Compatibility&amp;diff=6382</id>
		<title>Pinebook Pro Hardware Accessory Compatibility</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Pinebook_Pro_Hardware_Accessory_Compatibility&amp;diff=6382"/>
		<updated>2020-08-02T08:00:36Z</updated>

		<summary type="html">&lt;p&gt;Talpa: Added information about Goobay 62105 (and a test result for the Moreslan 11in1)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pinebook Pro accessories - by type =&lt;br /&gt;
&lt;br /&gt;
This page was started in the early days when not all accessories/peripherals were working.&lt;br /&gt;
&lt;br /&gt;
== NVMe SSD drives ==&lt;br /&gt;
Note that only PCIe type M.2 drives will work. Any SATA or USB type M.2 card will NOT work.&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
!Type || Make/Model || Size || Hardware IDs || Result || Notes || Power options&amp;lt;br/&amp;gt;Active only || Save&amp;lt;br/&amp;gt;power&amp;lt;br/&amp;gt;setting?&lt;br /&gt;
|-&lt;br /&gt;
| 2242 || Toshiba OCZ RC 100 || 240 GB || RC100-M22242-240G || good || || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2242 || Lexar NM520 || 256 GB || LNM520-256RBNA || good ||For some data on power use and performance, see [https://forum.pine64.org/showthread.php?tid=9029 here.]  || PS 0: 3.05W&amp;lt;br/&amp;gt;PS 1: 2.44W&amp;lt;br/&amp;gt;PS 2: 2.02W || No.  See [https://forum.pine64.org/showthread.php?tid=8737&amp;amp;pid=56481#pid56481 workaround].&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || XPS SX8200 || 512 GB || ASX8200PNP-512GT-C || good || Performed [https://forum.pine64.org/showthread.php?tid=8322 these] steps for physical installation.  Currently rooting from drive. || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Intel 660p M.2 || 512 GB || SSDPEKNW512G8X1 || good || PS 1 (2.70W) will work without issues, even under heavy load. Recommended over PS 2, as PS 2 will incur an additional 80% performance penalty. APSTE shows enabled but drive does not support it. || PS 0: 3.50W&amp;lt;br/&amp;gt;PS 1: 2.70W&amp;lt;br/&amp;gt;PS 2: 2.00W || No &lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Intel 660p M.2 || 1 TB || SSDPEKNW010T8X1 || good || || PS 0: 4.00W&amp;lt;br/&amp;gt;PS 1: 3.00W&amp;lt;br/&amp;gt;PS 2: 2.20W&amp;lt;br/&amp;gt;APSTE Disabled by default || No&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Intel 660p M.2 || 2 TB || SSDPEKNW020T8 || good || [https://forum.pine64.org/showthread.php?tid=7524&amp;amp;pid=49300#pid49300 Performance tests results] || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Intel 760p M.2 || 128 GB || SSDPEKKW128G8 || good || Firmware Revision 004C || PS 0: 9.00W&amp;lt;br/&amp;gt;PS 1: 4.60W&amp;lt;br/&amp;gt;PS 2: 3.80W&amp;lt;br/&amp;gt;PS 3: 0.045W&amp;lt;br/&amp;gt;PS 4: 0.004W&amp;lt;br/&amp;gt;APSTE: disabled by default with 4.4 kernel (mrfixit Debian), enabled by default with 5.6 kernel (Manjaro KDE) || Yes&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Intel 760p M.2 || 256 GB || SSDPEKKW256G8 || good || Firmware Revision 004C || PS 0: 9.00W&amp;lt;br/&amp;gt;PS 1: 4.60W&amp;lt;br/&amp;gt;PS 2: 3.80W&amp;lt;br/&amp;gt;PS 3: 0.045W&amp;lt;br/&amp;gt;PS 4: 0.004W&amp;lt;br/&amp;gt;Need to use lower power. || &lt;br /&gt;
|-&lt;br /&gt;
| 2280 || integral 256GB SSD M.2 2280 NVME || 256 GB || INSSD256GM280NM1 || usable ||  || PS 0: 9.00W || No&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Samsung 970 EVO Plus || 250 GB || MZ-V7S250BW || fail || Tested on Manjaro-ARM as root drive. Limited to PS 2 and Volatile Write Cache off gives the most stable results, but it will still hang on a hdparm test. || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Samsung 970 EVO Plus || 500 GB || MZ-V7S500 || fail || Too power hungry? || PS 0: 6.2W&amp;lt;br/&amp;gt;PS 1: 4.3W&amp;lt;br/&amp;gt;PS 2: 2.1W ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Samsung 970 EVO || 1 TB || MZ-V7E1T0BW || fail || Too power hungry? || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Corsair MP300 || 120 GB || CSSD-F120GBMP300 || good || || PS 0: 3.00W&amp;lt;br/&amp;gt;PS 1: 2.00W&amp;lt;br/&amp;gt;PS 2: 2.00W&amp;lt;br/&amp;gt;PS 3: 0.1W&amp;lt;br/&amp;gt;PS 4: 0.005W&amp;lt;br/&amp;gt;APSTE Disabled by default ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Silicon Power P34A60 || 1TB || SP001TBP34A60M28 || Usable || Power eager, but doesn't seem to use all 9W all the time, only under heavy I/O || PS 0: 9W || N/A&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Silicon Power P34A60 || 256 GB || SPCC M.2 PCIe SSD || detected || ASIN B07ZH6QR8Q &amp;quot;Silicon Power PCIe M.2 NVMe SSD 256GB Gen3x4&amp;quot; / PCIe A60 || PS 0: 6.77W&amp;lt;br/&amp;gt; PS 1: 5.71W&amp;lt;br/&amp;gt; PS 2: 5.19W&amp;lt;br/&amp;gt;APSTE Enabled by default || No&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Silicon Power P34A60 || 256 GB || ??? || fail || Isn't detected || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Sabrent Rocket || 256 GB || SB-ROCKET-256 || good || || || No&lt;br /&gt;
|-&lt;br /&gt;
| 2242 || Sabrent Rocket Nano || 512 GB || SB-1342-512 || good* || No touchpad issues, didn't trim NVME adapter board.&amp;lt;br/&amp;gt;(*Might be too power hungry. More testing needed.) || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || MyDigitalSSD SBXe || 960 GB || || good || || APST enabled&amp;lt;br/&amp;gt;Power states N/A || N/A &lt;br /&gt;
|-&lt;br /&gt;
| 2280 || HP SSD EX900 || 250GB || || good || No low-power modes available || || &lt;br /&gt;
|-&lt;br /&gt;
| 2280 || WD BLUE SN550 || 1TB || WDC WDS100T2B0C-00PXH0 || WARNING &amp;lt;br /&amp;gt;good || WARNING mine was SATA and does NOT work!&amp;lt;br /&amp;gt; Booted successfully from NVMe (Bionic MATE) || PS 0: 3.50W&amp;lt;br/&amp;gt;PS 1: 2.70W&amp;lt;br/&amp;gt;PS 2: 1.90W&amp;lt;br/&amp;gt;APSTE Disabled by default || N/A &lt;br /&gt;
|-&lt;br /&gt;
| 2280 || WD Blue SN500 || 500GB || WDS500G1B0C || fail || Works OK on power state 2 (2.5W), but hangs the system whenever there is intense IO (peak draw) on the drive || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2242 || WD PC SN520 || 256GB || - || fail || Power LED Flashes. Nothing else happens. || ||&lt;br /&gt;
|-&lt;br /&gt;
|2280 || WD BLACK SN750 || 250GB || WDS250G3X0C-00SJG0 || good || No touchpad issues, didn't trim NVME adapter board. || APSTE disabled by default&amp;lt;br/&amp;gt; PS 0: 5.00W&amp;lt;br/&amp;gt;PS 1: 3.50W&amp;lt;br/&amp;gt;PS 2: 3.00W||&lt;br /&gt;
|-&lt;br /&gt;
| 2242 || KingSpec NE-512 || 512 GB || NE512 || good || || APST enabled&amp;lt;br/&amp;gt;Power states N/A || N/A &lt;br /&gt;
|-&lt;br /&gt;
| 2230 || Kioxia BG4 256GBTB|| 256 GB || KBG40ZNS256G || good || || APST enabled by default&amp;lt;br/&amp;gt;Power states PS 0: 3.60W&amp;lt;br/&amp;gt;PS 1: 2.60W&amp;lt;br/&amp;gt;PS 2: 2.20W&amp;lt;br/&amp;gt;PS 3: 0.005W&amp;lt;br/&amp;gt;PS 4: 0.005W ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Patriot P300 || 256 GB || P300P256GM28US || good || Booted successfully with / on NVMe and /boot on eMMC (Armbian Buster) || APSTE disabled by default&amp;lt;br/&amp;gt; PS 0: 4.50W&amp;lt;br/&amp;gt; PS 1: 2.70W&amp;lt;br/&amp;gt; PS 2: 2.16W&amp;lt;br/&amp;gt;PS 3: 0.07W&amp;lt;br/&amp;gt;PS 4: 0.002W||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Team Group MP33 || 128 GB || TM8FP6128G0C101 || good   || || ||&lt;br /&gt;
|-&lt;br /&gt;
| 2280 || Team Group MP34 || 512 GB || TM8FP6512G0C101 || fail  ||APST enabled by default and scripts do not change the power mode. &amp;lt;br&amp;gt;Higher power consumption modes cause the PBP to crash&amp;lt;br/&amp;gt; || PS 0 5.55W &amp;lt;br/&amp;gt;PS 1 4.49W&amp;lt;br/&amp;gt;PS 2 3.97W &amp;lt;br/&amp;gt;PS 3 0.0490W &amp;lt;br/&amp;gt;PS 4 0.0018W ||No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== USB hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
!Type || Make/Model || Hardware IDs || Result || Notes&lt;br /&gt;
|-&lt;br /&gt;
|USB-2 SDHC reader || Sandisk MobileMate+ || 0781:b2b3 || good ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-3 SDHC/CF reader || Transcend TS-RDF8K || 8564:4000 || good ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Hub || Totu 8-in-1 || 058f:8468, 2109:0817 USB3, 1a40:0801, 2109:2817 USB2, bda:8153 RTL8153 Gigabit Ethernet || Network, USB, Card Reader, Power Good, HDMI Not Working || Amazon Smile [https://smile.amazon.com/gp/product/B07FX2LW35/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1]&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Hub || Delock 87721 || || Network Works, USB Works, Card Reader not tested, Power Good, HDMI Works but does not show as an extra output in X. It just mirrors the default display || Delock 87721 [https://www.delock.de/produkte/G_87721/merkmale.html?setLanguage=en]&lt;br /&gt;
|-&lt;br /&gt;
|USB-3 combo hub (network, card slots, usb ports) || generic || 05e3:0610 hub, 0bda:8153 gigE, 05e3:0743 card reader || Network good, usb ports good, card reader good ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub (network, card slots, usb ports) || generic || 05e3:0612 hub, 0bda:8153 realtek gigE || Network good, usb ports fail, card reader fail ||&lt;br /&gt;
|-&lt;br /&gt;
|5-1 USB-C hub || [https://www.aliexpress.com/item/32954358411.html from aliexpress] ||  05e3:0626 hub || HDMI, Network, USB-3, USB-C PD [http://www.sympato.ch/~dryak/files/usbc-dock.jpg good] || Might need changing orientation or USB-C cable &lt;br /&gt;
|-&lt;br /&gt;
|Yubikey original || Yubico || 1050:0010 || good ||&lt;br /&gt;
|- &lt;br /&gt;
|4 Port USB 3 NIC || Delock 62966 || || good || 4 individually controllable Gigabit Ethernet Ports. Consider using it with own power supply&lt;br /&gt;
|-&lt;br /&gt;
|USB-2 Fast Ethernet adapter || Realtek RTL8152 || 0bda:8152 || good || &lt;br /&gt;
|-&lt;br /&gt;
|USB-2 Ethernet adapter || ASIX AX77882 || 0b95:7720 || good || &lt;br /&gt;
|-&lt;br /&gt;
|USB Wifi Dongle || TP-Link TL-WN725N || 0bda:8179 || good || RTL8188EUS, Driver=rtl8188eu from MrFixit stock Debian, works better than internal Broadcom, but signal still not great, https://www.amazon.com/gp/product/B008IFXQFU/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&amp;amp;psc=1&lt;br /&gt;
|-&lt;br /&gt;
|USB Wifi Dongle || Shenzhen Dudes Tech #8541553244 || 0bda:c811 || mixed || plug/play on stock Armbian Buster with driver rtl8821cu; could not get operating driver built on MrFixit Debian or Manjaro KDE Plasma. Works 2x+ better than internal Broadcom on Armbian. https://www.amazon.com/gp/product/B07F595V22/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&amp;amp;psc=1&lt;br /&gt;
|-&lt;br /&gt;
|USB 3 to Gigabit Ethernet Adapter || Pluggable USB 3.0 to Ethernet Gigabit (ASIX AX88179 chipset) || 0b95:1790 || good ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub || [https://www.amazon.com/gp/product/B07XKRGQQ2/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 from Amazon] || 0c76:161f 0c45:6321 2109:0813 1a40:0101 || good || Everything works: AltMode DP, Ethernet, SD card, USB-A and C, and charging using the stock Debian, and Ubuntu.&lt;br /&gt;
|-&lt;br /&gt;
|USB Drawing tablet || XP Pen G430s || 28bd:0913 || good || Hardware works, with qemu usermode and some hacks it should be possible to use the official configuration software (runs but does not work on my setup for unrelated reasons) but it may also be able to be configured using more standard methods&lt;br /&gt;
|-&lt;br /&gt;
|USB-C dock || i-Tec USB-C Metal Nano Dock 4K HDMI w/ LAN || 0bda:0411 hub, 0bda:8153 ethernet || mixed || plug &amp;amp; play with Manjaro, HDMI tested w/ fullHD only, works but only in one polarity. Sound output works, USB hub works. HDMI output may not be recognized by Plasma if dock is connected with HDMI port disconnected. NIC recognized by kernel, but untested if link actually works. USB power delivery works only in one polarity. Unfortunately HDMI works with opposite polarity than USB PD.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C dock || Planet Computers Gemini USB-C hub || 0bda:0411 hub, 0bda:8153 ethernet || good || USB works, NIC recognized by kernel, but untested if link actually works. Interestingly, dmesg shows unconnected alternate mode DP, but no connector is present. It seems as if PlanetCom actually made custom version of above i-Tec device.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== USB C alternate mode DP ==&lt;br /&gt;
Note that only USB C alternate mode Display Port will pass video. Any HDMI, DVI or VGA port must be converted internally by the device from Display Port - or the device won't work for video.&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
!Type || Make/Model || Hardware IDs || Result || Notes&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to HDMI adapter 201018 || Cable Matters || || good || Tested up to 1080p30, audio works&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to HDMI adapter || Choetech HUB-H06 || || good || Advertises support for 4K@60Hz, tested up to 1080p@60Hz, worked in both Debian and Manjaro 2020-04-04&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to HDMI adapter || generic || || good || Tested up to 4k60&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to DP Adapter || OrxnQ || 04b4:5210 || good || Advertises support for 4K@60Hz, tested up to 1080p. Only FullHD resolutions available on Debian.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C HDMI adapter (DP-alt mode) || QGeeM || || good || Manjaro 2020-01-25&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub (HDMI, network, card slots, USB ports) || generic || || fail ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub (HDMI, VGA, Ethernet, card slots, USB 2 &amp;amp; 3 || Powlaken || 05e3:0610 0bda:8153 || USB, Power, Ethernet and SD good, HDMI and VGA fail ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Dock (HDMI, VGA, Ethernet, microSD/SD card slots, 2 USB 3 Ports, 1 USB-C Port, USB-Power Passthru || Digitus DA-70865 || || USB, Ethernet and MicroSD/SD good, video crashes System (fail). || Tested on Manjaro w/ Kernel 5.5. You have to turn the USB-C connector upside down for it to work. Video seems to be a driver issue.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Dock (HDMI, VGA, Ethernet, microSD/SD card slots, 2 USB 3 Ports, 1 USB-C Port, USB-Power pass-through) || generic || || Ethernet and MicroSD/SD good, USB fail, video up to 1080p. || https://forum.pine64.org/showthread.php?tid=8728&lt;br /&gt;
|- &lt;br /&gt;
|USB-C Dock (DP, HDMI, 1Gbps Ethernet, SD card slot, 2 USB 3 Ports, USB-C power in port || goFanco || || DP, Ethernet &amp;amp; USB good, (HDMI &amp;amp; SD card untested). Video tested good to 1080p || Tested on default Debian&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Dock (HDMI, USB 3.0 x 2, USB-C PD Pass Thru Power Port Up to 100W, SD/TF Card Reader || Hiearcool 7-in-1 || || HDMI, USB, Power Port good, SD/TF Reader fail || Default Debian &lt;br /&gt;
|-&lt;br /&gt;
|USB-C 3.0 Multi-Port Hub (HDMI, USB 3.0 x 1, USB-C charge only) || Linden LITCAD17 || || HDMI and USB good, Power Port fail || Default Debian &amp;amp; ayufan Ubuntu&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to DP adapter || Nekteck || 04b4:5210 || good || Shows up as &amp;quot;Cypress Semiconductor Corp. Billboard Device&amp;quot; in lsusb and dmesg output. Works in latest Manjaro (as of January 26, 2020) with no issues. Only FullHD resolutions available on Debian.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to HDMI adapter || MHL TH002 || || good || Tested at 1080p@60&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub (USB-C power, HDMI, 2xUSB, 1xUSB-C(no power)) || Baseus || || good ||&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Travel Dock with DP ALT-MODE || Targus DOCK411-A || 0835:2a01 (BILLBOARD DEVICE) 0bda:8153 (RTL8153 GbE Adapter) || GbE: works, HDMI: works, USB3.0 port: works, VGA: unknown || HDMI@1080p@60Hz: works OK, HDMI@4K@30Hz: works but buggy. GbE is only picked up when the USB C is plugged in with one certain side facing upwards. It is not detected the other way around. (Sounds weird, but reproduced it multiple times.) &lt;br /&gt;
|-&lt;br /&gt;
|USB-C to DP adapter || MediaGearPro AC0011 || 2109:0100 (USB 2.0 BILLBOARD) || DP: works || Only 1080p@60Hz is available, 4K resolutions not possible in contrast to what the manufacturer claims. &lt;br /&gt;
|-&lt;br /&gt;
|USB-C to DP cable || Generic on ebay ||  || good but with issues || Had some wonky framerates when tested on a 144hz monitor, 60hz mode was actually sent as ~48hz, 120hz mode was actually sent at ~112hz and 144hz mode was actually sent at ~120hz&lt;br /&gt;
|-&lt;br /&gt;
|UGREEN Hub USB C 9 in 1 HDMI and VGA || UGREEN || || good || VGA and HDMI works but not at the same time. HDMI audio not tested. Switching between HDMI and VGA need to replug the hub.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Dock 6-in-1 HDMI || Ugreen 50771 || || HDMI: works, Ethernet: works, 3x USB: works, USB-PD: works || Tested on Manjaro 2020/03/18 Works USB-C PD Chargers provided they can do 5V3A, works with 5V3A USB-C Raspberry Pi 4 power supply (Doesn't work with 5V2A USB-C). No HDMI Audio.&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to DP cable || [https://www.amazon.es/gp/product/B01N5RFAI4/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 CHOETECH V-XCP-0012BK] || || good &lt;br /&gt;
|-&lt;br /&gt;
| [https://www.apple.com/ca/shop/product/MQ4H2AM/A/thunderbolt-3-usb%E2%80%91c-cable-08-m Thunderbolt 3 (USB‑C) Cable (0.8 m)] || Apple || || Display Port Alternate Mode: Fails, USB-PD: works || Tested on Manjaro 2020/05/29 - Charges but no video&lt;br /&gt;
|-&lt;br /&gt;
|USB-C to HDMI cable || Planet Computers USB-C to HDMI cable ||  || fail || does not work regardless of orientation in USB slot&lt;br /&gt;
|-&lt;br /&gt;
|USB-C combo hub || Moreslan 11in1 (https://www.amazon.fr/gp/product/B08397B66G) || || good || GbE: OK, HDMI: OK, 4 usb ports: OK, Power via USB-C: OK, microSD: OK, TFT: OK, Jack: OK, VGA: Not tested&lt;br /&gt;
|-&lt;br /&gt;
|USB-C Multiport Adapter || [https://www.wentronic.com/en/usb-ctm-multiport-adapter-hdmi-ethernet-pd-white-62105 Goobay 62105] || || Fail || GbE: OK, UBS port: OK, Power via USB-C: OK, HDMI: Does generate an image, but it jumps X pixels right from time to time (4K@30 and FHD)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
!Type || Make/Model || Hardware IDs || Result || Notes &lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || HP Z5000 || E5C13AA || good || &lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Logitech MX Vertical || || good || Battery level is not detected over bluetooth, detected when using the logitech receiver&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Logitech Triathlon M720 || || good ||&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Logitech Ultra-Thin Touch Mouse || || good || Detects battery level as &amp;quot;keyboard&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Logitech MX Anywhere 2 ||  || good || &lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Logitech M535 || 910-004432 || good || &lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Microsoft Bluetooth Mouse || RJN-00002 || good || &lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Fenifox low profile || MX106-Black || good ||&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Mouse || Technet || MGS479 || good ||&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Keyboard || Logitech MX Keys || || good || Battery level is not detected over bluetooth, detected when using the logitech receiver&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Speaker || Ivation Acoustix || || good || Use audio sink profile&lt;br /&gt;
|-&lt;br /&gt;
|Headphone || Sony WH-1000XM2 || || good* || Needs pulseaudio-module-bluetooth. *Recording untested.&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Headphone || COWIN SE7 Noise Cancelling Headphones || || good || Pairs and plays audio with stock Debian OS.  More detail [https://forum.pine64.org/showthread.php?tid=8192&amp;amp;pid=60682#pid60682 here].&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.aliexpress.com/item/32831647303.html USB charging cable] || - || - || good || Got the cable a while back so may not be identical to current product&lt;br /&gt;
|-&lt;br /&gt;
|USB Audio &amp;amp; Bluetooth Headset || Sony SBH90C ||  || good || Works well connected via USB Type-C and Bluetooth. &lt;br /&gt;
|-&lt;br /&gt;
|SD Card || Samsung Evo Select 512GB || MB-ME512GA/AM || good || &lt;br /&gt;
|-&lt;br /&gt;
|SD Card || Samsung Evo Plus 64GB || || good || Hdparm tested 44MBps read speeds&lt;br /&gt;
|-&lt;br /&gt;
|SD Card || Sandisk Ultra 400GB || || good || Works fine as a storage extension. Mounted for pictures, etc.&lt;br /&gt;
|-&lt;br /&gt;
|Printer || HP DeskJet Ink Advantage 3775 || || good* || Using hplip-gui: via USB and WiFi. *Only print function tested.&lt;br /&gt;
|-&lt;br /&gt;
|Bluetooth Headset || BlueAnt Ribbon || 7252A-RB || good || a2dp mode works, headset mode seems to work, out of box with manjaro&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Talpa</name></author>
	</entry>
</feed>