I try to update the nand flash of my A13 board with a debian.
I installed live suit and download the image "A13_debian_34_75_WIFI_RALINK_GCC_GPIO_X_I2C_100KHz_UVC_TS_FTDI_video_release_9.img"
but live suit said the image is invalid
something is wrong ?? where i can download a correct image tu update my a13 nand flash??
thanks for you help
Hello yphos07,
The problem is that LiveSuit is meant for uploading Android images.
The Debian image you have downloaded can be downloaded to microSD card via win32diskimager.exe under Windows or by dd command under Linux.
Please check this article on how to prepare Debian Linux for microSD card: https://www.olimex.com/wiki/Prebuilt_SD_card_images_running_debian (https://www.olimex.com/wiki/Prebuilt_SD_card_images_running_debian)
For Android from NAND please check here: https://www.olimex.com/wiki/A13-OLinuXino#Using_an_operating_system_-_Nand_flash (https://www.olimex.com/wiki/A13-OLinuXino#Using_an_operating_system_-_Nand_flash)
Best regsards,
Lub/OLIMEX
i do this,
debian is working in my sd card
But How i can update the nand flsah with debian image??
there is no NAND Flash Debian image yet
Quote from: olimex on June 10, 2014, 07:45:23 AM
there is no NAND Flash Debian image yet
Is there still no image yet ?
Does anybody have working NAND Flash Debian image?
Thanks,
I've got working Debian image in NAND.
My configuration is: A13-Olinuxino-Wifi with 4Gb Hynix.
1)
You must setup Android image with LiveSuit. (later we will use u-boot from Android to load Linux image). You must load image for your type of board from here
https://ftp.olimex.com/Allwinner_Images/A13-OLinuXino/4.%d0%b0ndroid_images/nand/
For my board image is
https://ftp.olimex.com/Allwinner_Images/A13-OLinuXino/4.%d0%b0ndroid_images/nand/A13_android_NAND_LCD_800x480_EN_second_release.img
2)
You must prepare SD-card with Debian image, which is good for your board. Be careful - ONLY OLD LINUX KERNEL 3.4.x supports NAND. In later releases NAND support is missing.
For my board Debian image is
https://ftp.olimex.com/Allwinner_Images/A13-OLinuXino/2.legacy_images_kernel_3.4.x/A13_debian_34_90_mainline_u-boot_release_11_3.7z
3) Check boot from Android. After that insert SD card with Linux and boot from SD-card. Check that you have access to NAND memory partitions with Android installed.
4) Under Debian you must replace in /etc/apt/sources.list
deb http://deb.debian.org/debian/
with
deb http://archive.debian.org/debian/
in order to get updates for your old kernel.
5) IF all is OK - than under Debian run this script to delete all Android stuff and replace with Linux files. Android partitions remain unchanged.
5.1) Insert text below into movetonand.sh file.
5.1.1) If you make this under Windows be carefull in Windows EOL is (\r\n) in Linux EOL is (\n). If you insert this script in Windows Notepad the script will not run.
5.2) Add permission to execute with: chmod +x movetonand.sh
5.3) sudo ./movetonand.sh
#!/bin/sh
apt-get install rsync
apt-get clean
apt-get autoclean
umount /dev/nandi
mkfs.ext4 /dev/nandi
tune2fs -o journal_data_writeback /dev/nandi
tune2fs -O ^has_journal /dev/nandi
e2fsck -f /dev/nandi
umount /dev/nandd
mkfs.ext4 /dev/nandd
tune2fs -o journal_data_writeback /dev/nandd
tune2fs -O ^has_journal /dev/nandd
e2fsck -f /dev/nandd
umount /dev/nande
mkfs.ext4 /dev/nande
tune2fs -o journal_data_writeback /dev/nande
tune2fs -O ^has_journal /dev/nande
e2fsck -f /dev/nande
umount /dev/nandh
mkfs.ext4 /dev/nandh
tune2fs -o journal_data_writeback /dev/nandh
tune2fs -O ^has_journal /dev/nandh
e2fsck -f /dev/nandh
mkdir /mnt/nandroot
mount /dev/nandi /mnt/nandroot
rsync -aAXHv \
--exclude=/proc \
--exclude=/home \
--exclude=/sys \
--exclude=/dev \
--exclude=/tmp \
--exclude=/run \
--exclude=/mnt \
--exclude=/media \
/ /mnt/nandroot
mkdir /mnt/nandroot/dev /mnt/nandroot/proc /mnt/nandroot/sys /mnt/nandroot/tmp /mnt/nandroot/run /mnt/nandroot/mnt /mnt/nandroot/media /mnt/nandroot/home
rm -rf /mnt/nandroot/var/log/*
rm -rf /mnt/nandroot/var/tmp/*
mkdir -p /mnt/nandroot/mnt/storage
mkdir -p /mnt/nandroot/mnt/backup
cat << 'EOF' > /mnt/nandroot/etc/fstab
/dev/nandi / ext4 defaults,noatime,nodiratime,commit=60 0 1
/dev/nande /home ext4 defaults,noatime,nodiratime,commit=60 0 2
/dev/nandh /mnt/storage ext4 defaults,noatime,nodiratime,commit=60 0 2
/dev/nandd /mnt/backup ext4 defaults,noatime,nodiratime,commit=60 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=64M 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755,size=32M 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777,size=32M 0 0
EOF
umount /mnt/nandroot
rmdir /mnt/nandroot
mkdir /mnt/new_home
mount /dev/nande /mnt/new_home
rsync -aHAXx /home/ /mnt/new_home/
umount /mnt/new_home
rmdir /mnt/new_home
mkdir -p /mnt/sdboot
mount -t vfat /dev/mmcblk0p1 /mnt/sdboot
dd if=/mnt/sdboot/uImage of=/dev/nandc bs=1M
dd if=/mnt/sdboot/script.bin of=/dev/nandf bs=1k
sync
umount /mnt/sdboot
rmdir /mnt/sdboot
cat << 'EOF' > u-boot.txt
baudrate=115200
bootdelay=1
console=ttyS0,115200
loglevel=8
machid=102a
nand_root=/dev/nandi
init=/sbin/init
setargs=setenv bootargs console=${console} root=${nand_root} rootwait init=${init} loglevel=${loglevel}
boot_normal=nand read 0x44000000 0x1300000 0x500000; nand read 0x43000000 0x33300000 0x20000; bootm 0x44000000
bootcmd=run setargs boot_normal
EOF
python -c "
import zlib, struct
with open('u-boot.txt', 'r') as f:
lines = [line.strip() for line in f if line.strip()]
data = '\x00'.join(lines) + '\x00'
target_size = 131072 - 4
data = data.ljust(target_size, '\x00')
crc = zlib.crc32(data) & 0xffffffff
header = struct.pack('<I', crc)
with open('env.bin', 'wb') as f:
f.write(header + data)
print('env.bin reafy! filesize:', len(header + data))
"
sudo dd if=env.bin of=/dev/nandb bs=1k
sync
rm env.bin u-boot.txt
echo "All done! Now power off the board, remove SD card and next time it will boot Linux from NAND!"
6)
Shut down your board, remove SD card and power-on. Linux will boot from NAND.
Android partitioning remains unchanged.
Debian root partition is installed in biggest nandi (around 2.6 Gb)
Debian Home partition is installed in nandd (around 512 Mb)
2 smaller partitions (256Mb each) are mounted as 'storage' and 'backup' under 'mnt' folder. Use them for your files as you wish.
One more Android 128Mb partition is mounted automatically by XFCE. You can delete Android files from it and use for your needs.
May be for another Android images (for example for 8Gb NAND) script must be changed.
I can't check this.
New script is ready! Now you can move Linux to NAND without step 4) of previous instruction. Also 7 different Android partitions are combined into nandc. After all you have 3 partitions nanda (uboot and kernel),nandb (configuration), nandc (root).
Please be patient during tar working part.
1) Install Android to NAND using LiveSuit
2) Install Debian to SD card.
3) Run Debian from SD card and run script.
All the steps are described thoroughly in previous posts.
#!/bin/sh
python -c '
import struct, zlib, os, sys
p = "/sys/class/block/nand/size"
if not os.path.exists(p):
print "Error"
sys.exit(1)
with open(p, "r") as f:
t = int(f.read().strip())
L = [("bootloader", 2048, 32768), ("env", 34816, 4096), ("rootfs", 38912, t - 36864)]
e = ""
for idx, (n, st, sz) in enumerate(L):
if idx == 0:
l1 = struct.pack("<BBB5sII", 0, 0, 3, "\x00" * 5, st, 0)
else:
l1 = struct.pack("<QII", 0, st, 0)
e += l1 + struct.pack("<I4sQ", sz, "DISK", 0) + n.ljust(16, "\x00") + "\x00" * 16
b = (struct.pack("<II8s", 0, 0x100, "softw311") + e).ljust(1024, "\x00")
out = ""
for i in range(4):
c = b[:17] + struct.pack("B", i) + b[18:]
out += struct.pack("<I", zlib.crc32(c[4:]) & 0xffffffff) + c[4:]
with open("nand_part.bin", "wb") as f:
f.write(out)
print "Done"
'
dd if=nand_part.bin of=/dev/nand bs=1k count=4
sleep 1
sync
sleep 1
sync
sleep 1
blockdev --rereadpt /dev/nand
sleep 2
blockdev --rereadpt /dev/nand
sleep 2
blockdev --rereadpt /dev/nand
sleep 2
umount /dev/nandc
mkfs.ext4 /dev/nandc
tune2fs -o journal_data_writeback /dev/nandc
tune2fs -O ^has_journal /dev/nandc
e2fsck -f /dev/nandc
mkdir /mnt/nandroot
mount /dev/nandc /mnt/nandroot
tar --exclude=/proc/* \
--exclude=/sys/* \
--exclude=/dev/* \
--exclude=/tmp/* \
--exclude=/run/* \
--exclude=/mnt/* \
--exclude=/media/* \
--exclude=/var/log/* \
--exclude=/var/tmp/* \
-cf - / | (cd /mnt/nandroot && tar -xf -)
cat << 'EOF' > /mnt/nandroot/etc/fstab
/dev/nandc / ext4 defaults,noatime,nodiratime,commit=60 0 1
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=64M 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755,size=32M 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777,size=32M 0 0
EOF
umount /mnt/nandroot
rmdir /mnt/nandroot
mkdir -p /mnt/sdboot
mount /dev/mmcblk0p1 /mnt/sdboot
mkdir -p /mnt/nandboot
mount /dev/nanda /mnt/nandboot
cp /mnt/sdboot/uImage /mnt/nandboot/
cp /mnt/sdboot/script.bin /mnt/nandboot/
umount /mnt/sdboot
rmdir /mnt/sdboot
umount /mnt/nandboot
rmdir /mnt/nandboot
cat << 'EOF' > u-boot.txt
baudrate=115200
bootdelay=1
console=ttyS0,115200
loglevel=8
machid=102a
nand_root=/dev/nandc
init=/sbin/init
setargs=setenv bootargs console=${console} root=${nand_root} rootwait init=${init} loglevel=${loglevel}
boot_normal=fatload nand 0:0 0x44000000 uImage; bootm 0x44000000
bootcmd=run setargs boot_normal
EOF
python -c "
import zlib, struct
with open('u-boot.txt', 'r') as f:
lines = [line.strip() for line in f if line.strip()]
data = '\x00'.join(lines) + '\x00'
target_size = 131072 - 4
data = data.ljust(target_size, '\x00')
crc = zlib.crc32(data) & 0xffffffff
header = struct.pack('<I', crc)
with open('env.bin', 'wb') as f:
f.write(header + data)
print('env.bin reafy! filesize:', len(header + data))
"
sudo dd if=env.bin of=/dev/nandb bs=1k
sync
rm env.bin u-boot.txt
echo "All done! Now power off the board, remove SD card and next time it will boot Linux from NAND!"