Sign inSign up

imdocked/sn98600-sdk

By imdocked

•Updated over 8 years ago

Firmware cross compile build environment for the Sonix sn98600 chipset based IP Camera's

Image
0

1.1K

imdocked/sn98600-sdk repository overview

⁠Dockerfile:

# Based upon: ril3y/sonix-sn98600-toolchain
#
# Build Docker image:
# 	1. Create a directory "sonix-sn98600-toolchain"
# 	2. Place this dockerfile in the directory
# 	3. Place the SDK file also in this directory
# 	4. Execute: docker build -t sn98600-sdk  --build-arg SDK=SN986_1.60_QR_Scan_019a_20160606_0951 . 
#
# Run:
# 	1. Start container: docker run --privileged -it -v /temp/image/:/root/snx_sdk/image/:rw sn98600-sdk
# 	2. Execute in container: make sn98660_402mhz_sf_defconfig
#      3a. Execute in container: make help
#      3b. Execute in container: make menuconfig
#	4. Execute in container: make
#	5. Execute in container: make install
#
#	Or:
#	1. cd /root/xiaofang/
#	2. chmod +x option1.sh
#	2. ./option1.sh

FROM bashell/alpine-bash

# Filename of the SDK (without .tgz file extension)
ARG SDK=SN986_1.60_QR_Scan_019a_20160606_0951

# Unpack the SDK
ADD $SDK.tgz /root/
WORKDIR /root/$SDK
RUN bash ./sdk.unpack

FROM fedora:latest
WORKDIR /root/
ARG SDK=SN986_1.60_QR_Scan_019a_20160606_0951
COPY --from=0 /root/$SDK/snx_sdk/ ./

WORKDIR /root/buildscript/

RUN yum update -y -q; yum clean all
RUN yum install cpan vim lzop lzma bzip2 ncurses-devel wget findutils redhat-rpm-config cpanminus cpan gcc gcc-c++ patch glibc.i686 zlib.i686 hostname cpio -y -q ; yum clean all

RUN ./setup_env.sh

ENV PERL_MM_USE_DEFAULT=1
RUN cpan install Test::More
RUN cpan install Encode::Detect
RUN cpan install Digest::CRC

# Fix deprecated defined(@array)
RUN if [ "$SDK" = "SN986_1.60_QR_Scan_019a_20160606_0951" -o "$SDK" = "SN986_1.50_20160511_1053_d_054a_20160511_1320" ] ; then sed -i '373s/.*/if (!@val) {/' /root/kernel/linux-2.6.35.12/src/kernel/timeconst.pl ; fi

ENV SDK=$SDK

COPY xiaofang/ /root/xiaofang/

ENTRYPOINT ["/bin/bash"]

⁠CustomizeRootFSR.sh:

#!/bin/sh

# This script will generate a flashable firmware using the extracted ROOTFS-R from the original firmware.
# The ROOTFS-R is enlarged to allow more tools.

cd /root/buildscript/

# Configure for device
make sn98660_402mhz_sf_defconfig

# Do a make and make install so that everything is configured. But delete generated output afterwards.
make
make install
rm /root/image/* -f -r

#
make menuconfig

# * Flash Layout and firmware/_f setting -->
# * 	Uboot Partition Size -->
# * 		deselect both options
# * 	NVRAM Partion --> deselect
# * 	Kernel Partition --> 
# * 		deslect options 
# * 	Root File System Partition --> 
# * 		Put Rootfs into FIRMWARE.bin --> select
# * 		Put Rootfs into FIRMWARE_F.bin --> deselect
# * 		Root file system partition --> 224	(7MB)	increase to 	256  (x 32KB = 8MB)
# * 	Rescue System Partition --> deselect
# * 	Configure File Partition --> select erase FIRMWARE.bin, deselect erase FIRMWARE_F.bin
# Exit and save configuration

# Mount original cramfs filesystem
mkdir -p /media/rootfs.org
mount -t cramfs -o loop /root/xiaofang/rootfs.cramfs /media/rootfs.org

# Duplicate original contents to a new directory
mkdir /media/rootfs.new
find /media/rootfs.org > /tmp/filelist.txt
cat /tmp/filelist.txt | cpio -pdm /media/rootfs.new

# Make changes to the filesystem in /media/rootfs.new
pause

mkdir -p /root/image

# Create rootfs.cramfs from directory
/root/toolchain/crosstool-4.5.2/bin/mkcramfs /media/rootfs.new/media/rootfs.new/ /root/image/rootfs.cramfs
make rootfsimage

# Place the original kernel (needed to satify the tools)
cp /root/xiaofang/uImage /root/image/
make kernelimage

make u-boot-2011-09

make firmware

Tag summary

Content type

Image

Digest

Size

394.6 MB

Last updated

over 8 years ago

docker pull imdocked/sn98600-sdk:1.3