User talk:HP LSX

Last Modified: 2017-12-16 @ (SGT) by HP_LSX First Created: 2017-12-15 @ (SGT) by HP_LSX

Hi, my name is "HP", as people find easier to call me so... ;-)

This is my personal page (and contribution?)on the Wiki.

About me
I am basically an Electrical Engineer who started learning on his own electronic and IT, around 25 years ago. (...) I discovered the Cubieboard 2 - aka CB2 around 2 years ago when someone sold an old stock at a very attractive price.

Now, I can't stop imagining new project ideas based on these little boards since still very decent for most (if not all) of my needs...

Current Project
Like many people, I'm building my own Home Automation system on my own and, since having a bunch of CB2 (more than 20...), I decided to give them a second life. So, I started to "play" with them around a year ago by using the uSD card + serial console approach to make them boot OpenSUSE, then Arch Linux (my preferred one, at the moment ;-) ) These days, I am trying to learn how to make the CB2 booting from the following options:    - NAND    - Network / PXE  I need to do this for security reasons when the CB2 are exposed to outdoor world: No uSD card = No "sensitive" data leaking too easily  in the wild... ;-) I may be wrong about the security improvement (the NAND memory can still be read by someone...), but I found this NAND and PXE boot options quite interesting on their own... So, here I am ! ;-)

Targeted Points

 * Booting and running from NAND (while using uSD card for writes) => Getting access to the NAND memory => Creating special Boot-able uSD card from scratch
 * Getting access to the NAND memory
 * Making use of LiveSuit
 * Making use of a special U-Boot version built from scratch
 * Mainline/UpStream Kernel => NAND access may be (not) (yet/well) (?) supported from readings from "here and there" in the Wiki (...)
 * Legacy/ Kernel => NAND supported but Obsolete and un-maintained Kernel...
 * Creating special Boot-able uSD card from scratch
 * NAND Memory Access Driver
 * Device Tree Blob (DTB) needed
 * Customised Kernel needed
 * Customised U-Boot needed

General Progress

 * Booting from NAND - Map Work in progress... Please do not edit this. Thank you.
 * Installing to NAND                                  ( http://linux-sunxi.org/Installing_to_NAND )
 * Pre-Requisite =  Making a Bootable uSD card      ( http://linux-sunxi.org/Manual_build_howto )
 * Pre-Requisite = Getting Cross Compiling Toolchain            ( http://linux-sunxi.org/Toolchain )
 * Buidling U-Boot
 * Legacy                                                        ( http://linux-sunxi.org/U-Boot#Compile_U-Boot )
 * Mainline
 * Is the CB2 supported ?  YES!                           ( http://linux-sunxi.org/Category:Mainline_U-Boot )
 * Must create u-boot-sunxi-with-spl.bin                    ( http://linux-sunxi.org/Mainline_U-Boot#Compile_U-Boot )
 * Pre-Requisite = Getting Cross Compiling Toolchain             ( http://linux-sunxi.org/Toolchain )
 * Pre-Requisite = Getting Device Tree Compiler                  ( http://linux-sunxi.org/Device_Tree#Get_the_Device-tree_Compiler )
 * Getting the Device Tree Compiler
 * Compiling the Device Tree (Wondering about the correct device name)
 * Using the Device Tree                                   ( http://linux-sunxi.org/Mainline_Kernel_Howto#Boot )
 * Mainline Kernel - Boot
 * SD-Card Boot partition    ( http://linux-sunxi.org/Manual_build_howto#Setting_up_the_boot_partition ) => Sends back to the beginning of 1.1. Making a Bootable uSD card (...) In "mainline version", the board-specific .dts file generated during the kernel compilation will be utilised instead of the usual script.bin for the "legacy version".
 * Creating the boot.cmd file See http://linux-sunxi.org/Manual_build_howto#boot.cmd (sending back to the beginning of the page...) and use the following: fatload mmc 0 0x46000000 zImage  fatload mmc 0 0x49000000 .dtb  setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p rootwait panic=10 ${extra}  bootz 0x46000000 - 0x49000000  Optional "EarlyPrintK": - http://linux-sunxi.org/Mainline_Kernel_Howto#Early_printk
 * Build the Kernel (Not yet there)
 * Building the Kernel
 * Sunxi/Legacy kernel Not the actual scenario => skipping this part
 * Upstream/Mainline kernel                               ( http://linux-sunxi.org/Mainline_Kernel_Howto ) Remember to also build the device tree binaries.
 * HERE
 * Set up SD-Card for booting
 * Clean SD-Card                                            ( http://linux-sunxi.org/Bootable_SD_card#Cleaning ) zeroing the first 1MB: dd if=/dev/zero of=${card} bs=1M count=1 or without losing the partition table: dd if=/dev/zero of=${card} bs=1k count=1023 seek=1
 * Backing-up the existing NAND (Not yet there)
 * First MB
 * Backing-up the existing NAND (Not yet there)
 * First MB

-  - Cross compiling toolchain    ( http://linux-sunxi.org/Toolchain ) - Sunxi-Tools for NAND        ( http://linux-sunxi.org/Sunxi-tools ) -
 * Learning about the Boot Process
 * Software tools ready. (? didn't use them yet...)

Progress with Linux-Sunxi
Starting point: - http://linux-sunxi.org/NAND => Legacy un-maintained U-Boot-Sunxi       - http://linux-sunxi.org/NAND => Mainline Kernel version                 - http://linux-sunxi.org/MTD_Driver Mainline Kernel version targeted: - http://linux-sunxi.org/MTD_Driver

NAND Memory Access Support
Two options exist:
 * By using the Legacy un-maintained Kernels and U-Boot versions (which would be deprecated for Internet security reasons...)
 * By using the current Mainline Kernels and U-Boot versions (which are preferable)

By Mainline Kernel
NAND support may be (not) (yet/well) possible (?), based on the following:

2017-12-16 @ 08h55 (SGT): The red banner atop the "Installing_to_NAND" page says the following:

2017-12-16 @ 08h57 (SGT): The red banner atop the "MTD_Driver" page says the following:

By Legacy Kernel
>>> ToDo <<<

U-Boot versions
u-boot-sunxi is said legacy unmaintained (see the red banner in "Installing to NAND" page)

Sunxi Kernel versions

 * Mainline Kernel is said for versions 3.14+ (see the red banner in "Installing to NAND" page)
 * However, there seem to exist a fork at version 3.4 to support NAND memory access (see the red banner in "Installing to NAND" page)

Encountered Issues with Linux-Sunxi's Wiki
Here is my humble participation to help maintaining the accuracy of this site while just being a "lambda" user.

Missing Information
>>> ToDo <<<

Unclear for me
in http://linux-sunxi.org/Device_Tree#Compiling_the_Device_Tree : *       Q1: What is supposed to be  ? Q2: Could it be any arbitrary name or something following particular rules, as it is usually... ?     Q3: Any example ?? A1, A2: After reading some more around, especially there: http://linux-sunxi.org/Mainline_Kernel_Howto#Boot, my guess is that any arbitrary name may do the job. =>> To be confirmed by real world experience ! <<=

ToDo
>>> ToDo <<<

Dead links
in http://linux-sunxi.org/Toolchain#External_links : * [Direct download] - http://sourcery.mentor.com/public/gnu_toolchain/ = "HTTP Error 403: Forbidden" in http://linux-sunxi.org/Device_Tree#Get_the_Device-tree_Compiler : * [standalone version] - https://www.devicetree.org/Device_Tree_Compiler = "HTTP Error 404: Page Not Found"