I have build an image using openwrt for imx6dl based custom board.
I made the image using uboot.img zImage dtb and root-imx6 files using this method:
dd if=/dev/zero of="$IMAGE_DIRPATH/boot_part.img" bs=1M count=4
parted "$IMAGE_DIRPATH/boot_part.img" mklabel msdos
mkfs.vfat "$IMGAE_DIRPATH"/boot_part.img
mcopy -i "$IMAGE_DIRPATH/boot_part.img" "$IMAGE_DIRPATH/openwrt-zImage " ::zImage
mcopy -i "$IMAGE_DIRPATH/boot_part.img" "$IMAGE_DIRPATH/imx6.dtb" ::imx6.dtb
make_ext4fs -l 125217728 -b 4096 -i 6000 -m 0 "$IMAGE_DIRPATH/root_overlay.img" "$ROOT_DIR"
dd if=/dev/zero of=Final.img bs=1M count=142
parted Final.img mklabel msdos
dd if=uboot.img of=Final.img bs=1K seek=1 conv=notrunc
parted Final.img mkpart p fat32 1 6
parted Final.img mkpart p ext4 8 140
dd if="$IMAGE_DIRPATH"/boot_part.img of=Final.img bs=1M seek=1 conv=notrunc
dd if="$IMAGE_DIRPATH"/root_overlay.img of=Final.img bs=1M seek=8 conv=notrunc
With this I'm able to generate an image of 142MB which is huge. I want generate a compressed image file less than 40MB. Any ideas?
Also suggest if by using other file systems I can get a better compression and can load on SD/eMMC cards.
Related
I have a toolchain from an older piece of hardware (W315 from Moxa), and when I run file on its library files, I get this:
[bf#localhost arm-linux-gnueabi]$ file /usr/local/arm-linux/lib/libssl.so.0.9.8
/usr/local/arm-linux/lib/libssl.so.0.9.8: ELF 32-bit LSB shared object, ARM, version 1 (ARM), dynamically linked, not stripped
As you can see, this OpenSSL library is quite old and does not support TLSv1.2, which I need (at least). So I am trying to find an ARM binary of that library of a newer version. I have found 1.0.0 from Debian, but that has a little different signature:
[bf#localhost arm-linux-gnueabi]$ file libssl.so.1.0.0
libssl.so.1.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=83c83f5d3da36759c7adc837405b28539569d26e, stripped
They are both 32 bit, and ELF, but I am not sure if the "ARM" part is comparable.
Could I use that 1.0.0 library in my application? And if not, what should I look for in searching for the right binary?
Results from cat /proc/cpuinfo:
root#Moxa:/home/fabs# cat /proc/cpuinfo
Processor : ARM922Tid(wb) rev 1 (v4l)
BogoMIPS : 76.59
Features : swp half thumb
CPU implementer : 0x66
CPU architecture: 4
CPU variant : 0x0
CPU part : 0x526
CPU revision : 1
Cache type : VIVT write-back
Cache clean : cp15 c7 ops
Cache lockdown : format B
Cache format : Harvard
I size : 16384
I assoc : 2
I line length : 16
I sets : 512
D size : 16384
D assoc : 2
D line length : 16
D sets : 512
Hardware : Moxa CPU development platform
Revision : 0000
Serial : 0000000000000000
No, they are not. But You can build a recent/supported/secure version of openssl for your platform by using the following procedure:
# openssl
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar zxf openssl-1.1.1k.tar.gz
# a toolchain I know is working for arm922t according to gcc documentation
wget "https://releases.linaro.org/components/toolchain/binaries/latest-6/arm-linux-gnueabi/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz" -O gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz
mkdir -p /opt/arm/6
tar Jxf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz -C /opt/arm/6
# building
cd openssl-1.1.1k
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k
Edit the Makefile, and replace
CFLAGS=-Wall -O3
by:
CFLAGS=-Wall -O3 -march=armv4t -mcpu=arm922t
Then:
make install
ls -gG /opt/openssl-1.1.1k/bin/
total 576
-rwxr-xr-x 1 6214 Jun 30 12:53 c_rehash
-rwxr-xr-x 1 579740 Jun 30 12:53 openssl
ls -gG /opt/openssl-1.1.1k/lib
total 6432
drwxr-xr-x 2 4096 Jun 30 12:53 engines-1.1
-rw-r--r-- 1 3312034 Jun 30 12:53 libcrypto.a
lrwxrwxrwx 1 16 Jun 30 12:53 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x 1 2152072 Jun 30 12:53 libcrypto.so.1.1
-rw-r--r-- 1 603100 Jun 30 12:53 libssl.a
lrwxrwxrwx 1 13 Jun 30 12:53 libssl.so -> libssl.so.1.1
-rwxr-xr-x 1 502704 Jun 30 12:53 libssl.so.1
file /opt/openssl-1.1.1k/bin/openssl
/opt/openssl-1.1.1k/bin/openssl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=7b0e69c478f4c7390d416247f95ac60d9a632bd8, with debug_info, not stripped
If needed, you can build a static version by adding the -static option at the end of the configuration command:
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k -static
I want to make a long video from a single image in ffmpeg.
I need it to be fastly encodeable and at the end the video should have a small file size.
Is it possible to fill the video with frames that point to the preivous(or the first) frame with no changes?
I tried with this code, but it was slow and made a big file:
ffmpeg -loop 1 -i image.jpg -c:v libx264 -tune stillimage -shortest -preset ultrafast -t 3600 output.mp4
You can do this in two steps:
1) Encode a short loop, say, 30 seconds.
ffmpeg -loop 1 -framerate 5 -i image.jpg -pix_fmt yuv420p -c:v libx264 -t 30 looped.mp4
2) Loop the encode for desired duration.
ffmpeg -stream_loop -1 -i looped.mp4 -c copy -t 3600 output.mp4
Maybe this will help - enter it all on a single line and it will stream a single image (called test.jpg) repeatedly. See: https://stackoverflow.com/a/71885708/18795194 for my post and an explanation of the parameters.
ffmpeg
-loop 1
-fflags +genpts
-framerate 1/30
-i test.jpg
-c:v libx264
-vf fps=25
-pix_fmt yuvj420p
-crf 30
-f fifo -attempt_recovery 1 -recovery_wait_time 1
-f flv rtmp://localhost:5555/video/test
To save time, I want to segment and transcode a large video file on multiple computers.
I use ffmpeg to transcode the segments of the large video file with:
ffmpeg -i large_movie.mp4 -ss 00:00:00 -t 00:01:00 -acodec libfaac seg0.flv
ffmpeg -i large_movie.mp4 -ss 00:01:00 -t 00:01:00 -acodec libfaac seg1.flv
...
And concatenate the segments with:
ffmpeg -i concat.conf -vcodec copy -acodec copy result.flv
The content of the concat.conf:
ffsconcat version 1.0
file seg0.flv
file seg1.flv
...
Now we get a result FLV file result.flv content all the segments. But when I play this file, I found the segment boundary audio may be momentarily interrupted ! I'm sure those segments is closely associated, and the timestamp is right.
When I decode the AAC sample in segment file to a wave format, and open the wave with CoolEdit, I found at the front and the end of the file, the value of audio sample is very small (mute?) ! At the front of the file, there is about 21ms 'mute' sample. And at the end of the file, there is about 3ms 'mute' sample.
Is the mute samples result the momentarily interrupt ? How to concatenate media file containing AAC smoothly ?
After further testing, I found if you split a wave file to small wave files, then encode this small wave files to small aac file use faac:
faac -P -R 48000 -B 16 -C 2 -X -o 1.aac 1.wav
faac -P -R 48000 -B 16 -C 2 -X -o 2.aac 2.wav
faac -P -R 48000 -B 16 -C 2 -X -o 3.aac 3.wav
faac -P -R 48000 -B 16 -C 2 -X -o 4.aac 4.wav
faac -P -R 48000 -B 16 -C 2 -X -o 5.aac 5.wav
The console output like this:
[hugeice#fedora19 trans]$ faac -P -R 48000 -B 16 -C 2 -X -o 5.aac 5.wav
Freeware Advanced Audio Coder
FAAC 1.28
Quantization quality: 100
Bandwidth: 16000 Hz
Object type: Low Complexity(MPEG-2) + M/S
Container format: Transport Stream (ADTS)
Encoding 5.wav to 5.aac
frame | bitrate | elapsed/estim | play/CPU | ETA
And concatenate this small aac files to a big aac files use:
cat 1.aac 2.aac 3.aac 4.aac 5.aac > big.aac
Now, if you play the big.aac, there is a momeniary interrupt at the segment boundary!
The question becomes how segment coding and concatenate aac files smoothly ?
ipk packages are the intallation packages used by opkg.
I'm trying to extract the contents of one of them and also create my own ipk.
I've read that I should be able to untar them but that is not true.
I've tried:
tar -zxvf mypack.ipk
and I get:
zip: stdin: not in gzip format
I've also tried:
tar -xvf mypack.ipk
and I get:
tar: This does not look like a tar archive
I've found that most of the information on the internet regarding ipk's are inaccurate.
My ipk was generated by bitbake. I'm having a hard time with bitbake and want to avoid using it.
Any ideas on how to extract and how to create ipk files? A simple template with a single package would be useful to have.
I figured it out.
You can extract the main package with the ar x command, then extract the control.tar.gz with the tar -zxf command.
I have tested "ar x package-name.ipk" command but it didn't help
I found bellow command which worked perfectly
tar zxpvf package-name.ipk
This extracts three files:
debian-binary
data.tar.gz
control.tar.gz
use the same command to open data.tar.gz and control.tar.gz files
for more information refer to
https://cognito.me.uk/computers/manual-extractioninstallation-of-ipk-packages-on-gargoyleopenwrt/
You need to create a control file, and then do some archiving using tar and ar. In my case, I was distributing just python scripts, so there was no architecture dependency. You should check the control and Makefile into version control, and delete all the other intermediate files.
Here are the contents of control
Package: my-thing-python
Version: 1.0
Description: python scripts for MyCompany
Section: extras
Priority: optional
Maintainer: John
License: CLOSED
Architecture: all
OE: my-thing-python
Homepage: unknown
Depends: python python-distutils python-pyserial python-curses python-mmap python-ctypes
Source: N/A
Here is my Makefile which sits in the same directory as all my python scripts.
all: my-thing-python.ipk
my-thing-python.ipk:
rm -rf ipk
mkdir -p ipk/opt/my-thing-python
cp *.py ipk/opt/my-thing-python
tar czvf control.tar.gz control
cd ipk; tar czvf ../data.tar.gz .; cd ..
echo 2.0 > debian-binary
ar r my-thing-python.ipk control.tar.gz data.tar.gz debian-binary
clean: FORCE
rm -rf ipk
rm -f control.tar.gz
rm -f data.tar.gz
rm -f my-thing-python.ipk
FORCE:
Extracting with these commands:
Extract the file by running the command:
ar -xv <.ipk file>
Extract the control.tar.gz file by running the command:
tar -zxvf control.tar.gz
data.tar.gz : untar by running the command:
tar –zxvf data.tar.gz
If you want a list of files in an ipk, you can do something like:
#!/bin/sh
for f
do
tar -x -z -f $f ./data.tar.gz -O | tar tvzf -
done
-O is extract to standard output.
ipk files used to be AR (like DPKG), but are now tgz.
I feel that some dpkg utility ought to cope with ipkg files, but I haven't found the right one.
For some reason one of my directories has started producing
executables. By this I mean that new files in that directory are
a+x (but not, for example in the parent directory):
$ ls -ld .
drwxrwsr-x 2 me me 45 Dec 5 10:22 ./
drwxrwsr-x 10 me me 13 Dec 5 10:22 ../
$ rm -f test
$ touch test
$ ls -l test
-rwxrwxr-x 1 me me 0 Dec 5 10:25 test*
$ cd ..
$ rm -f test
$ touch test
$ ls -l test
-rw-rw-r--+ 1 me me 0 Dec 5 10:26 test
Also, notice the + at the end of the second permissions line, is it significant?
I know it cannot be a umask thing...but it's set at 0002.
How can I turn off this behavior?
EDIT:
In response to an answer below I ran the following (in the parent dir):
$ touch test
$ getfacl test
# file: test
# owner: me
# group: me
user::rw-
group::rw-
mask::rwx
other::r--
Why do I have this mask? Is this the right value for it? How can I change it?
The + indicates the presence of one or more ACLs on the entry. getfacl test will show you more information. The oddity with the apparent executability of new files may be related to the ACLs in the parent directory, but we'd have to see what they are to know for sure...