Difference between revisions of "Debian-10-sdcard-20200417"

From ESS-WIKI
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:How to create Debian 10 SD card image}} {| align="right" |- | __TOC__ |} <!-- --> = Host Prerequisites = == Debian 10 rootfs tarball == :Ref. IoTGateway/BS...")
 
 
(7 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
-->
 
-->
 
= Host Prerequisites =
 
= Host Prerequisites =
 
  
 
== Debian 10 rootfs tarball ==
 
== Debian 10 rootfs tarball ==
:Ref. [[IoTGateway/BSP/Linux/Debian/How_to_Create_Debian10_Rootfs_Base#keep_the_rootfs_for_future_use|keep the rootfs for future use]]
+
The environment variable ,ROOTFS, must be set properly. (Ref. [[IoTGateway/BSP/Linux/Debian/How_to_Create_Debian10_Rootfs_Base#keep_the_rootfs_for_future_use|keep the rootfs for future use]])
 
 
  
 
== Yocto Linux SD card image ==
 
== Yocto Linux SD card image ==
 
: e.g. 5720A1AIM20LIV90100_iMX8M_2020-04-03.img
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
SDIMAGE=5720A1AIM20LIV90100_iMX8M_2020-04-03.img
+
SDIMAGE=5720A1AIM20LIV90100_iMX8M_2020-04-03.img # i.MX8 ROM-5720
 +
SDIMAGE=3430A1LIV8940_DualQuad_2019-04-29.img # i.MX6 RSB-3430
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
=== backup modules and firmware ===
 
=== backup modules and firmware ===
  
Line 37: Line 33:
 
= Building Procedures =
 
= Building Procedures =
  
== duplicate from Yocto SDcard image ==
+
== create one working image ==
  
  
Line 46: Line 42:
  
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
== restore rootfs ==
== restore rootfs, modules & firmware ==
 
  
  
Line 53: Line 48:
 
sudo mount -o offset=$((PL*512)) $DEBIMAGE $MNT
 
sudo mount -o offset=$((PL*512)) $DEBIMAGE $MNT
 
sudo tar zxvf $ROOTFS.tgz -C $MNT/
 
sudo tar zxvf $ROOTFS.tgz -C $MNT/
 +
</syntaxhighlight>
 +
== set hostname ==
 +
 +
 +
<syntaxhighlight lang="bash">
 +
HOST=RSB-3430 # for RSB-3430
 +
HOST=ROM-5720 # for ROM-5720
 +
sudo su -c "echo $HOST > $MNT/etc/hostname"
 +
sudo su -c "echo -e \"127.0.0.1\tlocalhost\n127.0.1.1\t$HOST\n\" > $MNT/etc/hosts"
 +
</syntaxhighlight>
 +
 +
== restore modules & firmware ==
 +
 +
 +
<syntaxhighlight lang="bash">
 
sudo tar zxvf $BACKUPDIR/lib_modules.tgz -C $MNT
 
sudo tar zxvf $BACKUPDIR/lib_modules.tgz -C $MNT
 
sudo tar zxvf $BACKUPDIR/lib_firmware.tgz -C $MNT
 
sudo tar zxvf $BACKUPDIR/lib_firmware.tgz -C $MNT
 
sudo umount $MNT
 
sudo umount $MNT
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
= SDcard image is ready =
 
= SDcard image is ready =
  
 
== write to SD card ==
 
== write to SD card ==
  
 +
The environment variable ,SD_DEVICE, must be set properly.
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo dd if=$DEBIMAGE of=${SD_DEVICE} bs=1M conv=fsync status=progress
 
sudo dd if=$DEBIMAGE of=${SD_DEVICE} bs=1M conv=fsync status=progress
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 08:12, 17 April 2020


Host Prerequisites

Debian 10 rootfs tarball

The environment variable ,ROOTFS, must be set properly. (Ref. keep the rootfs for future use)

Yocto Linux SD card image

SDIMAGE=5720A1AIM20LIV90100_iMX8M_2020-04-03.img # i.MX8 ROM-5720
SDIMAGE=3430A1LIV8940_DualQuad_2019-04-29.img # i.MX6 RSB-3430

backup modules and firmware

BACKUPDIR=~/${SDIMAGE%%_*}
mkdir $BACKUPDIR
MNT=~/mnt
mkdir -p $MNT
PL=`fdisk -lu $SDIMAGE | grep "${SDIMAGE}2" | awk '{print $2}'`
sudo mount -o ro,offset=$((PL*512)) $SDIMAGE $MNT
sudo tar zcvf $BACKUPDIR/lib_modules.tgz -C $MNT lib/modules
sudo tar zcvf $BACKUPDIR/lib_firmware.tgz -C $MNT lib/firmware
sudo umount $MNT

Building Procedures

create one working image

DEBIMAGE=`sed "s/AIM20//; s/LIV/DIV/" <<< ${SDIMAGE%%_*}`_Debian10_base.img
cp $SDIMAGE $DEBIMAGE
mkfs.ext4 -F -E offset=$((PL*512)) $DEBIMAGE

restore rootfs

sudo mount -o offset=$((PL*512)) $DEBIMAGE $MNT
sudo tar zxvf $ROOTFS.tgz -C $MNT/

set hostname

HOST=RSB-3430 # for RSB-3430
HOST=ROM-5720 # for ROM-5720
sudo su -c "echo $HOST > $MNT/etc/hostname"
sudo su -c "echo -e \"127.0.0.1\tlocalhost\n127.0.1.1\t$HOST\n\" > $MNT/etc/hosts"

restore modules & firmware

sudo tar zxvf $BACKUPDIR/lib_modules.tgz -C $MNT
sudo tar zxvf $BACKUPDIR/lib_firmware.tgz -C $MNT
sudo umount $MNT

SDcard image is ready

write to SD card

The environment variable ,SD_DEVICE, must be set properly.

sudo dd if=$DEBIMAGE of=${SD_DEVICE} bs=1M conv=fsync status=progress