diff options
-rwxr-xr-x | tam3517-build-everything.sh | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/tam3517-build-everything.sh b/tam3517-build-everything.sh index 2b04ac0..66ad72e 100755 --- a/tam3517-build-everything.sh +++ b/tam3517-build-everything.sh @@ -112,8 +112,8 @@ mkdir_once "$BASEPATH/crosscompil/xuk" # Preparing the generated SD image mkdir_once "$BASEPATH/system/technexion/mount-loop/p2" -mkdir_once "$BASEPATH/system/from-narcissius/mount-loop/p1" -mkdir_once "$BASEPATH/system/from-narcissius/mount-loop/p2" +mkdir_once "$BASEPATH/system/from-narcissus/mount-loop/p1" +mkdir_once "$BASEPATH/system/from-narcissus/mount-loop/p2" # Reuse of some part of the demo SD image from Technexion (boot partition with x-loader installed + technexion_tools folder) [ -f "$BASEPATH/system/technexion/tam3517-sd-angstrom.img" ] || bzip2 -d -c "$BASEPATH/dl/tam3517-sd-angstrom.img.bz2" > "$BASEPATH/system/technexion/tam3517-sd-angstrom.img" @@ -122,73 +122,73 @@ mkdir_once "$BASEPATH/system/from-narcissius/mount-loop/p2" tech_p1_offset=$(fdisk -ul "$BASEPATH/system/technexion/tam3517-sd-angstrom.img" 2>/dev/null | sed -n 's/.*img1[^0-9]*\([0-9]\+\).*/\1/p') tech_p2_offset=$(fdisk -ul "$BASEPATH/system/technexion/tam3517-sd-angstrom.img" 2>/dev/null | sed -n 's/.*img2[^0-9]*\([0-9]\+\).*/\1/p') -if [ ! -f "$BASEPATH/system/from-narcissius/tam3517-sd.img" ]; then +if [ ! -f "$BASEPATH/system/from-narcissus/tam3517-sd.img" ]; then # Boot partition sector-to-sector copy (includes a functionnal x-loader) - dd if="$BASEPATH/system/technexion/tam3517-sd-angstrom.img" of="$BASEPATH/system/from-narcissius/tam3517-sd.img" count=$tech_p2_offset + dd if="$BASEPATH/system/technexion/tam3517-sd-angstrom.img" of="$BASEPATH/system/from-narcissus/tam3517-sd.img" count=$tech_p2_offset # MBR alteration for keeping only the first partition (boot partition) - dd if=/dev/zero of="$BASEPATH/system/from-narcissius/tam3517-sd.img" bs=1 seek=464 count=32 conv=notrunc + dd if=/dev/zero of="$BASEPATH/system/from-narcissus/tam3517-sd.img" bs=1 seek=464 count=32 conv=notrunc # Creating room space for the second partition (rootfs) - dd if=/dev/zero of="$BASEPATH/system/from-narcissius/tam3517-sd.img" seek=$tech_p2_offset count=$((SD_SECTOR_COUNT-tech_p2_offset)) + dd if=/dev/zero of="$BASEPATH/system/from-narcissus/tam3517-sd.img" seek=$tech_p2_offset count=$((SD_SECTOR_COUNT-tech_p2_offset)) # Creating the second partition (rootfs) - echo -e "n\np\n2\n\n\np\nw\n" | fdisk -C $((SD_SECTOR_COUNT/255/63)) -H 255 -S 63 -b 512 "$BASEPATH/system/from-narcissius/tam3517-sd.img" + echo -e "n\np\n2\n\n\np\nw\n" | fdisk -C $((SD_SECTOR_COUNT/255/63)) -H 255 -S 63 -b 512 "$BASEPATH/system/from-narcissus/tam3517-sd.img" # Formatting the newly created partition - nar_p2_offset=$(fdisk -ul "$BASEPATH/system/from-narcissius/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img2[^0-9]*\([0-9]\+\).*/\1/p') + nar_p2_offset=$(fdisk -ul "$BASEPATH/system/from-narcissus/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img2[^0-9]*\([0-9]\+\).*/\1/p') - losetup -o $((nar_p2_offset*512)) -f "$BASEPATH/system/from-narcissius/tam3517-sd.img" - nar_p2_loop_dev=$(losetup -j "$BASEPATH/system/from-narcissius/tam3517-sd.img" | cut -d ':' -f 1) + losetup -o $((nar_p2_offset*512)) -f "$BASEPATH/system/from-narcissus/tam3517-sd.img" + nar_p2_loop_dev=$(losetup -j "$BASEPATH/system/from-narcissus/tam3517-sd.img" | cut -d ':' -f 1) mkfs.ext3 $nar_p2_loop_dev losetup -d $nar_p2_loop_dev fi # Some offset computation and mount loop to work with demo and generated sd image -nar_p1_offset=$(fdisk -ul "$BASEPATH/system/from-narcissius/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img1[^0-9]*\([0-9]\+\).*/\1/p') -nar_p2_offset=$(fdisk -ul "$BASEPATH/system/from-narcissius/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img2[^0-9]*\([0-9]\+\).*/\1/p') +nar_p1_offset=$(fdisk -ul "$BASEPATH/system/from-narcissus/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img1[^0-9]*\([0-9]\+\).*/\1/p') +nar_p2_offset=$(fdisk -ul "$BASEPATH/system/from-narcissus/tam3517-sd.img" 2>/dev/null | sed -n 's/.*img2[^0-9]*\([0-9]\+\).*/\1/p') umount "$BASEPATH/system/technexion/mount-loop/p2" 2>/dev/null || true mount -o loop,ro,offset=$((tech_p2_offset*512)) "$BASEPATH/system/technexion/tam3517-sd-angstrom.img" "$BASEPATH/system/technexion/mount-loop/p2" -umount "$BASEPATH/system/from-narcissius/mount-loop/p2" 2>/dev/null || true -mount -o loop,rw,offset=$((nar_p2_offset*512)) "$BASEPATH/system/from-narcissius/tam3517-sd.img" "$BASEPATH/system/from-narcissius/mount-loop/p2" +umount "$BASEPATH/system/from-narcissus/mount-loop/p2" 2>/dev/null || true +mount -o loop,rw,offset=$((nar_p2_offset*512)) "$BASEPATH/system/from-narcissus/tam3517-sd.img" "$BASEPATH/system/from-narcissus/mount-loop/p2" # rootfs construction -if [ ! -d "$BASEPATH/system/from-narcissius/mount-loop/p2/var" ]; then +if [ ! -d "$BASEPATH/system/from-narcissus/mount-loop/p2/var" ]; then # Use narcissus generated rootfs as a base - tar -xvf "$BASEPATH/dl/tam3517-rootfs-image-am3517-evm.tar.gz" -C "$BASEPATH/system/from-narcissius/mount-loop/p2/" + tar -xvf "$BASEPATH/dl/tam3517-rootfs-image-am3517-evm.tar.gz" -C "$BASEPATH/system/from-narcissus/mount-loop/p2/" # Add the technexion_tools folder from the demo image for flash-to-NAND stuff (without Android) - rsync -ai --exclude 'technexion_tools/binary/android' --exclude 'technexion_tools/binary/angstrom/angstrom.tar.bz2' --exclude 'technexion_tools/binary/angstrom/modules.tar.bz2' "$BASEPATH/system/technexion/mount-loop/p2/technexion_tools" "$BASEPATH/system/from-narcissius/mount-loop/p2/" + rsync -ai --exclude 'technexion_tools/binary/android' --exclude 'technexion_tools/binary/angstrom/angstrom.tar.bz2' --exclude 'technexion_tools/binary/angstrom/modules.tar.bz2' "$BASEPATH/system/technexion/mount-loop/p2/technexion_tools" "$BASEPATH/system/from-narcissus/mount-loop/p2/" # Apply Technexion extra work above Angstrom (mainly for tuning hardware details) - tar -xvf "$BASEPATH/system/technexion/mount-loop/p2/technexion_tools/binary/angstrom/extra.tar.bz2" -C "$BASEPATH/system/from-narcissius/mount-loop/p2/" + tar -xvf "$BASEPATH/system/technexion/mount-loop/p2/technexion_tools/binary/angstrom/extra.tar.bz2" -C "$BASEPATH/system/from-narcissus/mount-loop/p2/" # Replace their demo kernel for flash-to-nand - cp -v "$BASEPATH/crosscompil/xuk/tam3517/kernel/arch/arm/boot/uImage" "$BASEPATH/system/from-narcissius/mount-loop/p2/technexion_tools/binary/angstrom/uImage" + cp -v "$BASEPATH/crosscompil/xuk/tam3517/kernel/arch/arm/boot/uImage" "$BASEPATH/system/from-narcissus/mount-loop/p2/technexion_tools/binary/angstrom/uImage" # Install our freshly built kernel modules ( cd "$BASEPATH/crosscompil/xuk/tam3517/kernel" - make INSTALL_MOD_PATH="$BASEPATH/system/from-narcissius/mount-loop/p2/" modules_install + make INSTALL_MOD_PATH="$BASEPATH/system/from-narcissus/mount-loop/p2/" modules_install ) # Build angstrom.tar.bz2 for flash-to-NAND - tar -cj --exclude './technexion_tools' -f "$BASEPATH/system/from-narcissius/mount-loop/p2/technexion_tools/binary/angstrom/angstrom.tar.bz2" -C "$BASEPATH/system/from-narcissius/mount-loop/p2" . + tar -cj --exclude './technexion_tools' -f "$BASEPATH/system/from-narcissus/mount-loop/p2/technexion_tools/binary/angstrom/angstrom.tar.bz2" -C "$BASEPATH/system/from-narcissus/mount-loop/p2" . # TODO : modules.tar.bz2 ? fi umount "$BASEPATH/system/technexion/mount-loop/p2" 2>/dev/null || true -umount "$BASEPATH/system/from-narcissius/mount-loop/p2" 2>/dev/null || true +umount "$BASEPATH/system/from-narcissus/mount-loop/p2" 2>/dev/null || true # Boot partition customization -umount "$BASEPATH/system/from-narcissius/mount-loop/p1" 2>/dev/null || true -mount -o loop,rw,offset=$((nar_p1_offset*512)) "$BASEPATH/system/from-narcissius/tam3517-sd.img" "$BASEPATH/system/from-narcissius/mount-loop/p1" +umount "$BASEPATH/system/from-narcissus/mount-loop/p1" 2>/dev/null || true +mount -o loop,rw,offset=$((nar_p1_offset*512)) "$BASEPATH/system/from-narcissus/tam3517-sd.img" "$BASEPATH/system/from-narcissus/mount-loop/p1" # Replace their demo kernel for SD card boot -cp -v "$BASEPATH/crosscompil/xuk/tam3517/kernel/arch/arm/boot/uImage" "$BASEPATH/system/from-narcissius/mount-loop/p1/boot/0/" -umount "$BASEPATH/system/from-narcissius/mount-loop/p1" 2>/dev/null || true +cp -v "$BASEPATH/crosscompil/xuk/tam3517/kernel/arch/arm/boot/uImage" "$BASEPATH/system/from-narcissus/mount-loop/p1/boot/0/" +umount "$BASEPATH/system/from-narcissus/mount-loop/p1" 2>/dev/null || true -echo "Finished !!! If you can read this message, you have probably a correctly-generated SD card image at '$BASEPATH/system/from-narcissius/tam3517-sd.img'" +echo "Finished !!! If you can read this message, you have probably a correctly-generated SD card image at '$BASEPATH/system/from-narcissus/tam3517-sd.img'" |