<markdown> Didj Development notes
Building Emerald Boot
1. Extract RidgeRun toolchain and move to `/opt` using root
2. Extract `LF-Linux-2826-20111215-1417.tar.gz` sources
3. Extract `emerald-boot-supplement_v2.2.2`
4. Move files within `emerald-boot-supplement` to `LF-Linux-2826-20111215-1417`
5. Within `LF-Linux-2826-20111215-1417`, run:
```sh patch -p1 < emerald-boot-supplement_v2.2.2.patch ```
6. Make a `crosscompile_env_vars` file within `LF-Linux-2826-20111215-1417`:
```sh export PROJECT_PATH=$PWD
export CROSS_COMPILER_ROOT=/opt/RidgeRun/arm-eabi-uclibc export PATH=$CROSS_COMPILER_ROOT/bin/:$PATH
export CROSS_COMPILE=arm-linux- export UBOOT_CROSS_COMPILE=arm-linux- export TARGET_MACH=LF_LF1000
export ROOTFS_PATH=$PROJECT_PATH/target/rootfs export EROOTFS_PATH=$PROJECT_PATH/target/erootfs export TFTP_PATH=$PROJECT_PATH/target/tftp export RELEASE_PATH=$PROJECT_PATH/target/release ```
7. Run:
```sh source crosscompile_env_vars ```
8. Change directory to `emerald-boot`
9. Fix `dump32.py` by changing:
```python data=array.array ('L', raw) ``` to ```python data=array.array('I', raw) ```
10. Run:
```sh DIDJ=1 ./install.sh cp emerald-boot_DIDJ.bin ../.. DIDJ=1 MICRO=1 ./install.sh cp emerald-boot_UART.bin ../.. ``` This should leave you with two emerald-boot binaries in the `LF-Linux-2826-20111215-1417` parent directory: ``` emerald-boot_DIDJ.bin emerald-boot_UART.bin ```
Build Surgeon
1. Clone mac2612's retroleap repository:
```sh git clone https://github.com/mac2612/retroleap buildroot ```
2. Setup out-of-tree build:
```sh cd buildroot make O=didj_surgeon lf1000_didj_surgeon_defconfig ```
3. Build:
```sh cd didj_surgeon make ```
4. Copy zImage to buildroot parent directory:
```sh cp images/zImage ../../lf1000_didj_surgeon_zImage ```
Custom Kernel
Within your buildroot build directory, make a `local.mk` file with the following contents:
LINUX_OVERRIDE_SRCDIR = /path/to/kernel/source
Then you can rebuild the kernel package like so:
make linux-rebuild all
Run Emerald Boot via UART
1. Setup baremetal as instructed [here](https://github.com/jkent/pollux-baremetal). Be sure to `source export.sh` too.
2. Connect a USB cable if you have not already to the Didj.
3. Run `ram_boot.py emerald-boot_UART.bin` when it gets close to completing, hold down 'L', 'R', and '?' buttons so it enters USB repair mode.
Booting surgeon
1. Clone mac2612's sshflash repository:
```sh git clone https://github.com/mac2612/sshflash ```
2. Make a CBF (Common Boot Format) file from a kernel zImage:
```sh python2 sshflash/make_cbf.py high lf1000_didj_surgeon_zImage lf1000_didj_surgeon_zImage.cbf ```
3. Start Emerald Boot in USB mode.
4. Boot the kernel:
```sh sudo python2 sshflash/boot_surgeon.py lf1000_didj_surgeon_zImage.cbf ```
Installing Emerald Boot to NAND
1. Boot surgeon as above
2. Run:
```sh chmod 700 keys/id_rsa SSH="ssh -i sshflash/keys/id_rsa root@169.254.8.1" ${SSH} "/usr/sbin/flash_erase /dev/mtd0 0 0" cat emerald-boot_DIDJ.bin | ${SSH} "/usr/bin/nandwrite -p /dev/mtd0 -" ```
3. Reboot in NAND mode
</markdown>