Giter Site home page Giter Site logo

hyphop / mizy-spi-image-builder Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 2.0 66 KB

SPI-flash firmware image builder (for sunxi Orange Pi Zero, another sunxi boards maybe work too )

License: Other

Perl 40.63% Shell 53.05% Batchfile 6.31%
spi mizy image orangepi sunxi spi-flash mmc-image

mizy-spi-image-builder's Introduction

ABOUT miZy_spi_image_builder

SPI-flash miZy firmware image builder (for sunxi Orange Pi Zero, another sunxi boards maybe work too ) also Hybrid-image generate for SD card (spi emulate on sd card)

Its just a part or miZy project, and same as other our parts can standalone used

This perl script no need any libs or another deps

Get Source

mkdir /tmp/zero_builder
cd /tmp/zero_builder
git clone https://github.com/hyphop/miZy-spi-image-builder.git
cd miZy-spi-image-builder

USAGE

help

./miZy_spi_image_builder --help

common usage for 8M image, output to firmwares/orange_pi_zero_hyphop_mizy_spi_flash_demo-8M.bin

./miZy_spi_image_builder

custom config

./miZy_spi_image_builder miZy-spi_image_builder_custom.conf

set 16M image size

img_size=16M ./miZy_spi_image_builder

not padded by flash size, save only used space

img_size=0 ./miZy_spi_image_builder

override image out name

img_name=out/my_image_name%s.bin ./miZy_spi_image_builder

check build status in shell

./miZy_spi_image_builder && echo "build ok"
./miZy_spi_image_builder || echo "build fail"

BUILD EXAMPLES

https://github.com/hyphop/miZy-spi-image-builder/tree/master/examples

write image to SPI from host to working device

easy way for upgrade / rewrite system

scp firmwares/*.bin root@zeru:/tmp
dd bs=65536 of=/dev/mtdblock5 < /tmp/*.bin

163+1 records in
163+1 records out
10743872 bytes (10.2MB) copied, 61.941887 seconds, 169.4KB/s

Hybrid image

by default miZy_spi_image_builder generate hybrid image its simple raw image, which can used for SPI and same for SD/MMC. this image equal spi-flash rom and ready for direct write to SPI flash, but we can write this image to SD/MMC for test work on device, and next copy this image to SPI from booted SD/MMC,

write hybrid image to SD/MMC

dd seek=16 bs=512 of=/dev/mmcblk0 < firmwares/mizy_spi_flash_demo-8M.bin

write hybrid image direct to SPI ( /dev/mtdblock5 - full size spi-flash mtd block dev)

dd bs=65536 of=/dev/mtdblock5 < /tmp/mizy_spi_flash_demo-8M.bin

write hybrid image direct to SPI via mtd

mtd write /tmp/mizy_spi_flash_demo-8M.bin full

write hybrid image to SPI via sunxi-tooll FEL mode from host machine

sunxi-fel -p spiflash-write 0 firmwares/mizy_spi_flash_demo-8M.bin

generate MMC image

output raw mmc image (this image usable for mmc, not for SPI )

MMC=1 img_name=firmwares/mizy_mmc_image.bin ./miZy_spi_image_builder 

add one partiotion and write some readme info there

./miZy_mmc_add_partitions firmwares/mizy_mmc_image.bin 8x8

write mmc image to SD/MMC

dd of=/dev/mmcblk0 < firmwares/mizy_mmc_image.bin

copy from booted MMC image to SPI, directly from working device

mmc_copy_to_spi
mmc_copy_to_spi yes

## FOUND mizy hybrid image info:
8388608                                                        
mizy_mmc_image.bin                                             
miZy_spi_image_builder Thu Apr  6 16:17:17 2017 ## hyphop ##   

## WRITE IMAGE CMD:
> dd if=/dev/mmcblk0 skip=1 bs=8192 count=1024 of=/dev/mtdblock5
1024+0 records in
1024+0 records out
8388608 bytes (8.0MB) copied, 45.987770 seconds, 178.1KB/s

ok system is ready for full loading from spi now u can remove sd card, and reboot system from spi already!

CONFIG FILE

default config

miZy-spi_image_builder.conf

config file its a same pure perl code!

PATHS

put your files (uboot scripts env fex/dtc kernel squashfs initramfs userdata) in @SCAN_PATH dirs by default are

.
./bin
./bin.local

TOOLS

miZy

tiny fast embedded linux, for sunxi Orange Pi Zero (and maybe other boards) and mods. Now under active development, but is usable already )

write image to device in FEL mode

in FEL mode via sunxi-fel tools

check spi flash size

./tools/fel_spi_info
Manufacturer: Winbond (EFh), model: 40h, size: 16777216 bytes.

ok! write image - u can write any image size <= flash size

./tools/fel_spi_write firmwares/orange_pi_zero_hyphop_mizy_spi_flash_demo-8M.bin

LINKS

mizy-spi-image-builder's People

Contributors

hyphop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mizy-spi-image-builder's Issues

missing files bin.local

Hi,

trying to build a spi image with the script.
It complains about 'file "boot.all.cmd" not found'.
After cloning the repository only links to files are in bin.local and they are pointing to locations not available, like '../../miZy/boot.all.cmd'
Please assist me in solving this ...

btw
Plan is to start using your small Linux on a orange pi zero running from an 16MB spi flash as a base for restoring an old internet radio (Tangent Quattro MK II)

Thanks,
J

Issue/question with miZy-spi-image-builder

@hyphop
Hi,
Thank you for your effort in building SPI image for Orange PI
I was trying to build image for my newly purchased Orange PI Zero Allwinner H2+
I installed successfully Armbian stable and update to latest ARMBIAN 5.36 user-built Ubuntu 16.04.3 LTS 3.4.113-sun8i
Once I loged in I followed your instructions:
mkdir /tmp/zero_builder cd /tmp/zero_builder git clone https://github.com/hyphop/miZy-spi-image-builder.git cd miZy-spi-image-builder
Now when I'm trying to run following
img_size=16M ./miZy_spi_image_builder
I get following
[i] ./ miZy_spi_image_builder => CONF: ./miZy_spi_image_builder.conf [i] 16M bytes => firmwares/orange_pi_zero_hyphop_mizy_spi_flash_demo-%s%s.bin [i] MTD_PART 0xHEX_SIZE( DEC_SIZE){ USED_SZ} FILES Died at ./miZy_spi_image_builder line 237. [e] file "" not found ERR: 2

I tried to run
./miZy_spi_image_builder

with the same result
[i] ./ miZy_spi_image_builder => CONF: ./miZy_spi_image_builder.conf [i] 8M bytes => firmwares/orange_pi_zero_hyphop_mizy_spi_flash_demo-%s%s.bin [i] MTD_PART 0xHEX_SIZE( DEC_SIZE){ USED_SZ} FILES Died at ./miZy_spi_image_builder line 237. [e] file "" not found ERR: 2
What I'm missing or doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.