Dobrica Pavlinušić's random unstructured stuff
Toshiba AC100: Revision 31
{file: Compal_LA-6352P_PAZ00_AC100.pdf}

{toc: }

[Tegra] 2 device

^ kernel

* https://gitlab.com/groups/ac100 (gitorious is dead)

^ cpuinfo

.pre
$ cat /proc/cpuinfo
Processor : ARMv7 Processor rev 0 (v7l)
processor : 0
BogoMIPS : 1998.84

Features : swp half thumb fastmult vfp edsp vfpv3 vfpv3d16
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part : 0xc09
CPU revision : 0

Hardware : NVIDIA Harmony Development System
Revision : 0000
Serial : 0000000000000000

$ cat /proc/meminfo
MemTotal: 383348 kB
MemFree: 106528 kB
Buffers: 30116 kB
Cached: 123316 kB
SwapCached: 0 kB
Active: 164792 kB
Inactive: 85020 kB
Active(anon): 96692 kB
Inactive(anon): 0 kB
Active(file): 68100 kB
Inactive(file): 85020 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 96412 kB
Mapped: 44536 kB
Shmem: 312 kB
Slab: 8940 kB
SReclaimable: 4848 kB
SUnreclaim: 4092 kB
KernelStack: 2528 kB
PageTables: 8324 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 191672 kB
Committed_AS: 6569284 kB
VmallocTotal: 614400 kB
VmallocUsed: 30656 kB
VmallocChunk: 520068 kB
.pre

^ Rooting

^^ nvflash

Press CTRL + ESC + power button to get into APX mode

.pre
[Thu Oct 11 06:31:57 2018] usb 2-2.4: new high-speed USB device number 13 using xhci_hcd
[Thu Oct 11 06:31:57 2018] usb 2-2.4: New USB device found, idVendor=0955, idProduct=7820, bcdDevice= 1.02
[Thu Oct 11 06:31:57 2018] usb 2-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Thu Oct 11 06:31:57 2018] usb 2-2.4: Product: APX
[Thu Oct 11 06:31:57 2018] usb 2-2.4: Manufacturer: NVIDIA Corp.
.pre

* http://tegradeveloper.nvidia.com/tegra-android-development-pack

In theory. In practice driver package from

* http://developer.download.nvidia.com/assets/mobile/files/tegra-linux-12.alpha.1.0.tar.gz

is everything you need. It's from http://developer.nvidia.com/content/linux-tegra-release-12-alpha-1-released

^^ fastboot.stock.bin

.pre
t61p:/home/dpavlin/Downloads/ldk/bootloader/alt# wget https://github.com/muromec/putusb/raw/master/bin/fastboot.stock.bin
--2011-09-12 20:40:17-- https://github.com/muromec/putusb/raw/master/bin/fastboot.stock.bin
Resolving github.com (github.com)... 207.97.227.239
Connecting to github.com (github.com)|207.97.227.239|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.github.com/muromec/putusb/master/bin/fastboot.stock.bin [following]
--2011-09-12 20:40:19-- https://raw.github.com/muromec/putusb/master/bin/fastboot.stock.bin
Resolving raw.github.com (raw.github.com)... 207.97.227.243
Connecting to raw.github.com (raw.github.com)|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 936016 (914K) [application/octet-stream]
Saving to: `fastboot.stock.bin'

100%[=====================================================>] 936,016 645K/s in 1.4s

2011-09-12 20:40:22 (645 KB/s) - `fastboot.stock.bin' saved [936016/936016]

t61p:/home/dpavlin/Downloads/ldk/bootloader/alt# md5sum fastboot.stock.bin
9197365fb42c5801b4124e75ea00512c fastboot.stock.bin
.pre

^^ backup

Following instructions at http://gitorious.org/ac100/pages/Installation

.pre
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash --bl fastboot.stock.bin --go
Nvflash started
rcm version 0X20001
System Information:
chip name: t20
chip id: 0x20 major: 1 minor: 2
chip sku: 0x8
chip uid: 0x1700618943a00317
macrovision: disabled
hdcp: enabled
sbk burned: false
dk burned: false
boot device: emmc
operating mode: 3
device config strap: 0
device config fuse: 0
sdram config strap: 0

downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: fastboot.stock.bin
| 936016/936016 bytes sent
fastboot.stock.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully


t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --getpartitiontable partitiontable.txt
Nvflash started
[resume mode]
Succesfully updated partition table information to partitiontable.txt


t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 2 part-2.img
Nvflash started
[resume mode]
receiving file: part-2.img, expected size: 3145728 bytes
/ 3145728/3145728 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 3 part-3.img
Nvflash started
[resume mode]
receiving file: part-3.img, expected size: 524288 bytes
/ 524288/524288 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# /nvflash -r --read 4 part-4.img
bash: /nvflash: No such file or directory
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 4 part-4.img
Nvflash started
[resume mode]
receiving file: part-4.img, expected size: 2097152 bytes
/ 2097152/2097152 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 5 part-5.img
Nvflash started
[resume mode]
receiving file: part-5.img, expected size: 5242880 bytes
/ 5242880/5242880 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 6 part-6.img
Nvflash started
[resume mode]
receiving file: part-6.img, expected size: 8388608 bytes
/ 8388608/8388608 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 7 part-7.img
Nvflash started
[resume mode]
receiving file: part-7.img, expected size: 1048576 bytes
/ 1048576/1048576 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 8 part-8.img
Nvflash started
[resume mode]
receiving file: part-8.img, expected size: 314572800 bytes
/ 314572800/314572800 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 9 part-9.img
Nvflash started
[resume mode]
receiving file: part-9.img, expected size: 419430400 bytes
/ 419430400/419430400 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 10 part-10.img
Nvflash started
[resume mode]
receiving file: part-10.img, expected size: 2097152 bytes
/ 2097152/2097152 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 11 part-11.img
Nvflash started
[resume mode]
receiving file: part-11.img, expected size: 524288 bytes
/ 524288/524288 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 12 part-12.img
Nvflash started
[resume mode]
receiving file: part-12.img, expected size: 1294991360 bytes
/ 1294991360/1294991360 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 13 part-13.img
Nvflash started
[resume mode]
receiving file: part-13.img, expected size: 524288 bytes
/ 524288/524288 bytes received
file received successfully
t61p:/home/dpavlin/Downloads/ldk/bootloader# ./nvflash -r --read 14 part-14.img
Nvflash started
[resume mode]
receiving file: part-14.img, expected size: 5891424256 bytes
/ 5891424256/5891424256 bytes received
file received successfully


.pre

^ Linux

^^ links

{fetchrss: http://feeds.delicious.com/v2/rss/dpavlin/ac100?count=15 full}

^^ phh 2.6.32 kernel with working suspend and audio

* http://salaliitto.com/~gildean/ac100/wiki/phh/

.pre
t61p:/home/dpavlin/ac100/linux4tegra_10.9.3# LD_LIBRARY_PATH=./nvflash/ ./nvflash/nvflash --bl ./prebuilt/fastboot.stock.bin --read 6 tegra_partition_6.bin --go
Nvflash started
rcm version 0X20001
System Information:
chip name: t20
chip id: 0x20 major: 1 minor: 2
chip sku: 0x8
chip uid: 0x1700618943a00317
macrovision: disabled
hdcp: enabled
sbk burned: false
dk burned: false
boot device: emmc
operating mode: 3
device config strap: 0
device config fuse: 0
sdram config strap: 0

downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: ./prebuilt/fastboot.stock.bin
| 936016/936016 bytes sent
./prebuilt/fastboot.stock.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
receiving file: tegra_partition_6.bin, expected size: 8388608 bytes
/ 8388608/8388608 bytes received
file received successfully



t61p:/home/dpavlin/ac100/linux4tegra_10.9.3# LD_LIBRARY_PATH=./nvflash/ ./nvflash/nvflash --wait --bl ./prebuilt/fastboot.stock.bin --download 6 ../32.boot.menu.v1.img --go
Nvflash started
rcm version 0X20001
System Information:
chip name: t20
chip id: 0x20 major: 1 minor: 2
chip sku: 0x8
chip uid: 0x1700618943a00317
macrovision: disabled
hdcp: enabled
sbk burned: false
dk burned: false
boot device: emmc
operating mode: 3
device config strap: 0
device config fuse: 0
sdram config strap: 0

downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: ./prebuilt/fastboot.stock.bin
| 936016/936016 bytes sent
./prebuilt/fastboot.stock.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
sending file: ../32.boot.menu.v1.img
/ 8388608/8388608 bytes sent
../32.boot.menu.v1.img sent successfully

.pre

^ mainline kernel

* Newest howto for arch: https://gist.github.com/Nokius/81cd46405b537931a472e0a55abb7ccd

* https://archlinuxarm.org/forum/viewtopic.php?f=49&t=10116

^ u-boot from APX

This should allow you to send u-boot, kernel and initramfs to any tegra2 board which can be in APX mode without
modifying internal storage.

^^ build u-boot

.pre
dpavlin@klin:/klin/u-boot$ cat env.sh
export CROSS_COMPILE="arm-none-eabi-" ARCH=arm
dpavlin@klin:/klin/u-boot$ . env.sh

dpavlin@klin:/klin/u-boot$ make paz00_defconfig

make


.pre

^^ build kernel

.pre
dpavlin@klin:/klin/Tegra/linux$ git remote -v
origin https://github.com/grate-driver/linux (fetch)
origin https://github.com/grate-driver/linux (push)
samsung-tab-10.1 https://github.com/Decatf/linux (fetch)
samsung-tab-10.1 https://github.com/Decatf/linux (push)

dpavlin@klin:/klin/Tegra/linux$ git branch -vv
* master 63a6317580f8 [origin/master] ARM: tegra: Clear EMC interrupts on resume from LP1 on Tegra30+

dpavlin@klin:/klin/Tegra/linux$ cat /klin/u-boot/env.sh
export CROSS_COMPILE="arm-none-eabi-" ARCH=arm
dpavlin@klin:/klin/Tegra/linux$ . /klin/u-boot/env.sh

dpavlin@klin:/klin/Tegra/linux$ make tegra_defconfig

make


.pre

^^^ create initrd with new modules

.pre
dpavlin@klin:/klin/Tegra/linux$ cat tegra-ramdisk.sh
#!/bin/sh -xe

test -d initrd && rm -Rf initrd

mkdir initrd
cd initrd

gzip -cd /tmp/initrd.img | fakeroot -- cpio -i -d -H newc --no-absolute-filenames

rm -R lib/modules/*

cd ..
make modules_install INSTALL_MOD_PATH=initrd/ INSTALL_MOD_STRIP=1

cd initrd

find . | cpio -o -R 0:0 -H newc > ../initrd.new.cpio

cd ..

gzip -f -6 initrd.new.cpio

/klin/u-boot/tools/mkimage -A arm -O linux -T ramdisk -C gzip -n uInitrd -d initrd.new.cpio.gz uInitrd.new
.pre

run it to create initrd:

.pre
dpavlin@klin:/klin/Tegra/linux$ ./tegra-ramdisk.sh

Image Name: uInitrd
Created: Fri Oct 12 11:20:42 2018
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 4082917 Bytes = 3987.22 KiB = 3.89 MiB
Load Address: 00000000
Entry Point: 00000000

.pre

^^ create bootloader file

latest version seems to be: https://gitlab.com/uboot-ac100/create_bootimage.git

.pre
dpavlin@nuc:/nuc/Tegra/ac100/create_bootimage/example$ ../create_image.pl /mnt/klin/klin/u-boot/u-boot-dtb-tegra.bin /m
nt/klin/klin/Tegra/linux/arch/arm/boot/zImage /tmp/postmarketOS-export/initrd.img /mnt/klin/klin/Tegra/linux/arch/arm/b
oot/dts/tegra20-paz00.dtb uboot.scr boot.img
Creating boot image for tegrarcm ...

./tmp_uboot.scr
image layout:
section loadaddr size
=================================
uboot : 0x108000 505627
kernel : 0x190000 6485800
initrd : 0x7c0000 4082981
fdt : 0xbb0000 29659
script : 0xbc0000 226

image written to boot.img
.pre

Now press CTRL + ESC + power on to enter APX mode

.pre
dpavlin@nuc:/nuc/Tegra/ac100/create_bootimage/example$ sudo apt-get install libcrypto++6

dpavlin@nuc:/nuc/Tegra/ac100/create_bootimage/example$ /mnt/klin/klin/Tegra/tegrarcm/src/tegrarcm --bct paz00-micron-toshiba-8g.bct --bootloader boot.img --loadaddr 0x108000
bct file: paz00-micron-toshiba-8g.bct
bootloader file: boot.img
load addr 0x108000
entry addr 0x108000
device id: 0x7820
uid: 0x1700618943a00317
RCM version: 2.1
downloading miniloader to target at address 0x40008000 (132976 bytes)...
miniloader downloaded successfully
Chip UID: 0x00000000000000001700618943a00317
Chip ID: 0x20
Chip ID Major Version: 0x1
Chip ID Minor Version: 0x2
Chip SKU: 0x8 (t20)
Boot ROM Version: 0x1
Boot Device: 0x2 (EMMC)
Operating Mode: 0x3 (developer mode)
Device Config Strap: 0x0
Device Config Fuse: 0x0
SDRAM Config Strap: 0x0
sending file: paz00-micron-toshiba-8g.bct
- 4080/4080 bytes sent
paz00-micron-toshiba-8g.bct sent successfully
sending file: boot.img
- 11239650/11239650 bytes sent
boot.img sent successfully

.pre

u-boot loads detects initrd (it's small enough thanks to MODULES_STRIP to be detected without CRC errors) but no output from kernel.

https://archlinuxarm.org/forum/viewtopic.php?f=23&t=10044&p=51142&hilit=ac100#p51142

suggests CONFIG_TEGRA_DEBUG_UARTA instead of CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA but it doesn't work for me.

.pre
dpavlin@klin:/klin/Tegra/linux$ grep 'TEGRA.*UART' .config
# CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA is not set
CONFIG_TEGRA_DEBUG_UARTA=y
# CONFIG_TEGRA_DEBUG_UARTB is not set
# CONFIG_TEGRA_DEBUG_UARTC is not set
# CONFIG_TEGRA_DEBUG_UARTD is not set
# CONFIG_TEGRA_DEBUG_UARTE is not set
CONFIG_DEBUG_TEGRA_UART=y


.pre

^ serial port

https://ac100.grandou.net/serial_port_modification

{image: IMG_20181014_181159-800px.jpg}

The serial port is the JP1 connector, near the left speaker connector. Pinout, from right to left:

* 1 - in - RX UART1
* 2 - out - TX UART1
* 3 - out - T20_WAKE#
* 4 - out - +3V
* 5 - out - +1.8V
* 6
* 7
* 8 - in - SYSTEM_RESET#
* 9 - in - EC_TX80_PDATA
* 10 - in - GND

I decided to solder GND to outer pin of connector to the right of pin 1 as opposed to other side of connector.

After that, a peace of capton tape was put over solder connectors to somewhat re-enforce them and provide insulation
to keyboard cover.

Serial is 3.3V, 115200 8n1.

Output is:

.pre
dpavlin@nuc:/nuc/Tegra$ microcom -p /dev/ttyUSB2
connected to /dev/ttyUSB2
Escape character: Ctrl-\
Type the escape character to get to the prompt.

U-Boot SPL 2018.11-rc1-00130-g0a60a81ba3 (Oct 12 2018 - 11:18:01 +0200)
Trying to boot from RAM


U-Boot 2018.11-rc1-00130-g0a60a81ba3 (Oct 12 2018 - 11:18:01 +0200)

TEGRA20
Model: Toshiba AC100 / Dynabook AZ
Board: Compal Paz00
DRAM: 512 MiB
MMC: sdhci@c8000000: 1, sdhci@c8000600: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
Hit any key to stop autoboot: 0
## Executing script at 00b30000
## Loading init Ramdisk from Legacy Image at 00700000 ...
Image Name: uInitrd
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 4269789 Bytes = 4.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 00b20000
Booting using the fdt blob at 0xb20000
Using Device Tree in place at 00b20000, end 00b2a3da

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
r1=0x00000c38, r2=0x00000000
Available machine support:

ID (hex) NAME
ffffffff Generic DT based system
ffffffff NVIDIA Tegra SoC (Flattened Device Tree)

Please check your kernel config and/or bootloader.

.pre