* [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
@ 2014-12-10 14:34 Jacob Stiffler
2014-12-10 17:22 ` Cooper Jr., Franklin
2014-12-10 17:41 ` Denys Dmytriyenko
0 siblings, 2 replies; 6+ messages in thread
From: Jacob Stiffler @ 2014-12-10 14:34 UTC (permalink / raw)
To: meta-arago
Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
---
lib/oesdk/package-sdks | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks
index 31a44b6..dc3eb13 100644
--- a/lib/oesdk/package-sdks
+++ b/lib/oesdk/package-sdks
@@ -9,6 +9,84 @@ then
exit 1
fi
+create_sd_card_img() {
+ m="$1"
+
+ sd_card_img_file="${m}-${TISDK_VERSION}.img"
+
+ # Make the machine specific SD card directory
+ sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
+
+ if [ -d $sd_card_img_root ]
+ then
+ rm -rf $sd_card_img_root
+ fi
+ mkdir -p $sd_card_img_root
+
+ cd $sd_card_img_root
+
+ ## Create an image file full of zeros
+ dd if=/dev/zero of="${sd_card_img_file}" bs=1024 count=$[2000*1024]
+
+ ## Mount the file to the loopback device
+ sudo losetup /dev/loop0 "${sd_card_img_file}"
+
+ ## Partition the loopback into 2 partitions
+ sudo parted -s /dev/loop0 mklabel msdos
+ sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
+ sudo parted -s /dev/loop0 set 1 boot on
+ sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9 -2
+
+ ## Format the partitions with the necessary filesystems
+ sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
+ sudo mkfs.ext3 -L rootfs /dev/loop0p2
+
+ ## Use fdisk to get offsets (will need to multiply by blocksize (512))
+ sudo fdisk -l ${sd_card_img_file}
+
+ local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
+
+ local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{ print $9 }'`
+
+ local P1_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" | awk '{ print $3 }'`
+ local P1_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" | awk '{ print $4 }'`
+
+ local P2_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" | awk '{ print $2 }'`
+ local P2_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" | awk '{ print $3 }'`
+
+ ## Unmount the loopback device
+ sudo losetup -d /dev/loop0
+
+ ## Mount the individual partitions of the loopback device for file copying
+ ## The Start (after-o option) and sizelimit numbers come from multiplying the output
+ ## of fdisk above by blocksize (512 in this case) for the appropriate partition.
+ ## 1048576 = 2048 * 512
+ ## 74448384 = 145407 * 512
+ sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START * $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
+
+ mkdir ./temp_boot
+ sudo mount -t vfat /dev/loop0 ./temp_boot
+ sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C ./temp_boot/
+
+ ## Follow the above steps using numbers for the second partition.
+ sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START * $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
+ mkdir ./temp_rootfs
+ sudo mount -t ext3 /dev/loop1 ./temp_rootfs
+ sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C ./temp_rootfs/
+
+ ## Gzip the img file to save lot of space
+ zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
+
+ ## Clean up when done
+ sudo umount ./temp_boot
+ sudo umount ./temp_rootfs
+ sudo rm -rf ./temp_boot/
+ sudo rm -rf ./temp_rootfs/
+ sudo losetup -d /dev/loop0
+ sudo losetup -d /dev/loop1
+ sudo rm -rf ${sd_card_img_file}
+}
+
create_sd_card_content() {
# Set m for logging purposes
m="$1"
@@ -291,6 +369,8 @@ package_web_content() {
# Move the installer into the exports directory
mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
+ mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip $exports_root/
+
# Create the md5sum file
cd $exports_root
md5sum * > md5sum.txt
@@ -373,6 +453,8 @@ package_individual_sdk() {
# Create the SD card tarballs in the deploy directory
create_sd_card_content $m
+ create_sd_card_img $m
+
# Package the SD card and web page contents to get ready for
# generating the webgen page and publishing the SDK
package_web_content $m
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
2014-12-10 14:34 [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image Jacob Stiffler
@ 2014-12-10 17:22 ` Cooper Jr., Franklin
2014-12-10 17:41 ` Denys Dmytriyenko
1 sibling, 0 replies; 6+ messages in thread
From: Cooper Jr., Franklin @ 2014-12-10 17:22 UTC (permalink / raw)
To: Stiffler, Jacob, meta-arago@arago-project.org
Can you add some error checking to insure that the loop device is available (not currently being used) and if not switch to another loop device? Also in case of an error you free the loop device.
> -----Original Message-----
> From: meta-arago-bounces@arago-project.org [mailto:meta-arago-
> bounces@arago-project.org] On Behalf Of Stiffler, Jacob
> Sent: Wednesday, December 10, 2014 8:34 AM
> To: meta-arago@arago-project.org
> Subject: [meta-arago] [tisdk-build-scripts][PATCH] package-sdks: Generate
> the SD Card image.
>
> Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> ---
> lib/oesdk/package-sdks | 82
> ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
> diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks index
> 31a44b6..dc3eb13 100644
> --- a/lib/oesdk/package-sdks
> +++ b/lib/oesdk/package-sdks
> @@ -9,6 +9,84 @@ then
> exit 1
> fi
>
> +create_sd_card_img() {
> + m="$1"
> +
> + sd_card_img_file="${m}-${TISDK_VERSION}.img"
> +
> + # Make the machine specific SD card directory
> + sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
> +
> + if [ -d $sd_card_img_root ]
> + then
> + rm -rf $sd_card_img_root
> + fi
> + mkdir -p $sd_card_img_root
> +
> + cd $sd_card_img_root
> +
> + ## Create an image file full of zeros
> + dd if=/dev/zero of="${sd_card_img_file}" bs=1024 count=$[2000*1024]
> +
> + ## Mount the file to the loopback device
> + sudo losetup /dev/loop0 "${sd_card_img_file}"
> +
> + ## Partition the loopback into 2 partitions
> + sudo parted -s /dev/loop0 mklabel msdos
> + sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
> + sudo parted -s /dev/loop0 set 1 boot on
> + sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9 -2
> +
> + ## Format the partitions with the necessary filesystems
> + sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
> + sudo mkfs.ext3 -L rootfs /dev/loop0p2
> +
> + ## Use fdisk to get offsets (will need to multiply by blocksize (512))
> + sudo fdisk -l ${sd_card_img_file}
> +
> + local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
> +
> + local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{ print $9
> + }'`
> +
> + local P1_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> awk '{ print $3 }'`
> + local P1_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> + awk '{ print $4 }'`
> +
> + local P2_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> awk '{ print $2 }'`
> + local P2_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> + awk '{ print $3 }'`
> +
> + ## Unmount the loopback device
> + sudo losetup -d /dev/loop0
> +
> + ## Mount the individual partitions of the loopback device for file copying
> + ## The Start (after-o option) and sizelimit numbers come from multiplying
> the output
> + ## of fdisk above by blocksize (512 in this case) for the appropriate
> partition.
> + ## 1048576 = 2048 * 512
> + ## 74448384 = 145407 * 512
> + sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START *
> + $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
> +
> + mkdir ./temp_boot
> + sudo mount -t vfat /dev/loop0 ./temp_boot
> + sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C ./temp_boot/
> +
> + ## Follow the above steps using numbers for the second partition.
> + sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START *
> $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
> + mkdir ./temp_rootfs
> + sudo mount -t ext3 /dev/loop1 ./temp_rootfs
> + sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C
> + ./temp_rootfs/
> +
> + ## Gzip the img file to save lot of space
> + zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
> +
> + ## Clean up when done
> + sudo umount ./temp_boot
> + sudo umount ./temp_rootfs
> + sudo rm -rf ./temp_boot/
> + sudo rm -rf ./temp_rootfs/
> + sudo losetup -d /dev/loop0
> + sudo losetup -d /dev/loop1
> + sudo rm -rf ${sd_card_img_file}
> +}
> +
> create_sd_card_content() {
> # Set m for logging purposes
> m="$1"
> @@ -291,6 +369,8 @@ package_web_content() {
> # Move the installer into the exports directory
> mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
>
> + mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip $exports_root/
> +
> # Create the md5sum file
> cd $exports_root
> md5sum * > md5sum.txt
> @@ -373,6 +453,8 @@ package_individual_sdk() {
> # Create the SD card tarballs in the deploy directory
> create_sd_card_content $m
>
> + create_sd_card_img $m
> +
> # Package the SD card and web page contents to get ready for
> # generating the webgen page and publishing the SDK
> package_web_content $m
> --
> 1.7.9.5
>
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
2014-12-10 14:34 [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image Jacob Stiffler
2014-12-10 17:22 ` Cooper Jr., Franklin
@ 2014-12-10 17:41 ` Denys Dmytriyenko
2014-12-10 17:55 ` Cooper Jr., Franklin
1 sibling, 1 reply; 6+ messages in thread
From: Denys Dmytriyenko @ 2014-12-10 17:41 UTC (permalink / raw)
To: Jacob Stiffler; +Cc: meta-arago
Jake,
Why invent another method to create an SD card? We've had too many of those
already...
For example, here's an old but complete one, that Chase and Franklin had in
AMSDK and it is still being packaged in our SDKs from ti-tisdk-setup recipe:
http://arago-project.org/git/projects/?p=tisdk-setup-scripts.git;a=blob;f=create-sdcard.sh;hb=HEAD
Moreover, under the Yocto Project, there is an effort to provide a
standardized tool called "wic" that takes care of creating and partitioning
bootable disks and SD cards. The best feature of it is not requiring root or
sudo access! I was already looking at it, but it had some bugs in Daisy
release, that got fixed in the new release that we'll be migrating to in the
near future. And wic tool is planned to be adopted for our SDK products.
So, for now, I'd refrain from creating another custom script to create an SD
card...
--
Denys
On Wed, Dec 10, 2014 at 09:34:09AM -0500, Jacob Stiffler wrote:
> Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> ---
> lib/oesdk/package-sdks | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
> diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks
> index 31a44b6..dc3eb13 100644
> --- a/lib/oesdk/package-sdks
> +++ b/lib/oesdk/package-sdks
> @@ -9,6 +9,84 @@ then
> exit 1
> fi
>
> +create_sd_card_img() {
> + m="$1"
> +
> + sd_card_img_file="${m}-${TISDK_VERSION}.img"
> +
> + # Make the machine specific SD card directory
> + sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
> +
> + if [ -d $sd_card_img_root ]
> + then
> + rm -rf $sd_card_img_root
> + fi
> + mkdir -p $sd_card_img_root
> +
> + cd $sd_card_img_root
> +
> + ## Create an image file full of zeros
> + dd if=/dev/zero of="${sd_card_img_file}" bs=1024 count=$[2000*1024]
> +
> + ## Mount the file to the loopback device
> + sudo losetup /dev/loop0 "${sd_card_img_file}"
> +
> + ## Partition the loopback into 2 partitions
> + sudo parted -s /dev/loop0 mklabel msdos
> + sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
> + sudo parted -s /dev/loop0 set 1 boot on
> + sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9 -2
> +
> + ## Format the partitions with the necessary filesystems
> + sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
> + sudo mkfs.ext3 -L rootfs /dev/loop0p2
> +
> + ## Use fdisk to get offsets (will need to multiply by blocksize (512))
> + sudo fdisk -l ${sd_card_img_file}
> +
> + local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
> +
> + local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{ print $9 }'`
> +
> + local P1_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" | awk '{ print $3 }'`
> + local P1_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" | awk '{ print $4 }'`
> +
> + local P2_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" | awk '{ print $2 }'`
> + local P2_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" | awk '{ print $3 }'`
> +
> + ## Unmount the loopback device
> + sudo losetup -d /dev/loop0
> +
> + ## Mount the individual partitions of the loopback device for file copying
> + ## The Start (after-o option) and sizelimit numbers come from multiplying the output
> + ## of fdisk above by blocksize (512 in this case) for the appropriate partition.
> + ## 1048576 = 2048 * 512
> + ## 74448384 = 145407 * 512
> + sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START * $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
> +
> + mkdir ./temp_boot
> + sudo mount -t vfat /dev/loop0 ./temp_boot
> + sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C ./temp_boot/
> +
> + ## Follow the above steps using numbers for the second partition.
> + sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START * $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
> + mkdir ./temp_rootfs
> + sudo mount -t ext3 /dev/loop1 ./temp_rootfs
> + sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C ./temp_rootfs/
> +
> + ## Gzip the img file to save lot of space
> + zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
> +
> + ## Clean up when done
> + sudo umount ./temp_boot
> + sudo umount ./temp_rootfs
> + sudo rm -rf ./temp_boot/
> + sudo rm -rf ./temp_rootfs/
> + sudo losetup -d /dev/loop0
> + sudo losetup -d /dev/loop1
> + sudo rm -rf ${sd_card_img_file}
> +}
> +
> create_sd_card_content() {
> # Set m for logging purposes
> m="$1"
> @@ -291,6 +369,8 @@ package_web_content() {
> # Move the installer into the exports directory
> mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
>
> + mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip $exports_root/
> +
> # Create the md5sum file
> cd $exports_root
> md5sum * > md5sum.txt
> @@ -373,6 +453,8 @@ package_individual_sdk() {
> # Create the SD card tarballs in the deploy directory
> create_sd_card_content $m
>
> + create_sd_card_img $m
> +
> # Package the SD card and web page contents to get ready for
> # generating the webgen page and publishing the SDK
> package_web_content $m
> --
> 1.7.9.5
>
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
2014-12-10 17:41 ` Denys Dmytriyenko
@ 2014-12-10 17:55 ` Cooper Jr., Franklin
2014-12-10 18:22 ` Denys Dmytriyenko
0 siblings, 1 reply; 6+ messages in thread
From: Cooper Jr., Franklin @ 2014-12-10 17:55 UTC (permalink / raw)
To: Dmytriyenko, Denys, Stiffler, Jacob; +Cc: meta-arago@arago-project.org
> -----Original Message-----
> From: meta-arago-bounces@arago-project.org [mailto:meta-arago-
> bounces@arago-project.org] On Behalf Of Dmytriyenko, Denys
> Sent: Wednesday, December 10, 2014 11:41 AM
> To: Stiffler, Jacob
> Cc: meta-arago@arago-project.org
> Subject: Re: [meta-arago] [tisdk-build-scripts][PATCH] package-sdks:
> Generate the SD Card image.
>
> Jake,
>
> Why invent another method to create an SD card? We've had too many of
> those already...
> For example, here's an old but complete one, that Chase and Franklin had in
> AMSDK and it is still being packaged in our SDKs from ti-tisdk-setup recipe:
> http://arago-project.org/git/projects/?p=tisdk-setup-
> scripts.git;a=blob;f=create-sdcard.sh;hb=HEAD
>
> Moreover, under the Yocto Project, there is an effort to provide a
> standardized tool called "wic" that takes care of creating and partitioning
> bootable disks and SD cards. The best feature of it is not requiring root or
> sudo access! I was already looking at it, but it had some bugs in Daisy
> release, that got fixed in the new release that we'll be migrating to in the
> near future. And wic tool is planned to be adopted for our SDK products.
>
> So, for now, I'd refrain from creating another custom script to create an SD
> card...
[Franklin] So we created an image using the commands that Jake is using in his script due to people still complaining that they can't create an SD Card on Windows. We actually created a manual image as part of the SDK download page for SDK 7.0. However, I am all for using an alternative solution if wic would work. The reason why I never submitted similar patches was due to my dislike of consuming system resources (loop devices) and all the required sudo commands.
>
> --
> Denys
>
>
> On Wed, Dec 10, 2014 at 09:34:09AM -0500, Jacob Stiffler wrote:
> > Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> > ---
> > lib/oesdk/package-sdks | 82
> ++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 82 insertions(+)
> >
> > diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks
> > index 31a44b6..dc3eb13 100644
> > --- a/lib/oesdk/package-sdks
> > +++ b/lib/oesdk/package-sdks
> > @@ -9,6 +9,84 @@ then
> > exit 1
> > fi
> >
> > +create_sd_card_img() {
> > + m="$1"
> > +
> > + sd_card_img_file="${m}-${TISDK_VERSION}.img"
> > +
> > + # Make the machine specific SD card directory
> > + sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
> > +
> > + if [ -d $sd_card_img_root ]
> > + then
> > + rm -rf $sd_card_img_root
> > + fi
> > + mkdir -p $sd_card_img_root
> > +
> > + cd $sd_card_img_root
> > +
> > + ## Create an image file full of zeros
> > + dd if=/dev/zero of="${sd_card_img_file}" bs=1024 count=$[2000*1024]
> > +
> > + ## Mount the file to the loopback device
> > + sudo losetup /dev/loop0 "${sd_card_img_file}"
> > +
> > + ## Partition the loopback into 2 partitions
> > + sudo parted -s /dev/loop0 mklabel msdos
> > + sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
> > + sudo parted -s /dev/loop0 set 1 boot on
> > + sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9 -2
> > +
> > + ## Format the partitions with the necessary filesystems
> > + sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
> > + sudo mkfs.ext3 -L rootfs /dev/loop0p2
> > +
> > + ## Use fdisk to get offsets (will need to multiply by blocksize (512))
> > + sudo fdisk -l ${sd_card_img_file}
> > +
> > + local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
> > +
> > + local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{ print $9 }'`
> > +
> > + local P1_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> awk '{ print $3 }'`
> > + local P1_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> awk '{ print $4 }'`
> > +
> > + local P2_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> awk '{ print $2 }'`
> > + local P2_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> awk '{ print $3 }'`
> > +
> > + ## Unmount the loopback device
> > + sudo losetup -d /dev/loop0
> > +
> > + ## Mount the individual partitions of the loopback device for file
> copying
> > + ## The Start (after-o option) and sizelimit numbers come from
> multiplying the output
> > + ## of fdisk above by blocksize (512 in this case) for the appropriate
> partition.
> > + ## 1048576 = 2048 * 512
> > + ## 74448384 = 145407 * 512
> > + sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START *
> $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
> > +
> > + mkdir ./temp_boot
> > + sudo mount -t vfat /dev/loop0 ./temp_boot
> > + sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C ./temp_boot/
> > +
> > + ## Follow the above steps using numbers for the second partition.
> > + sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START *
> $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
> > + mkdir ./temp_rootfs
> > + sudo mount -t ext3 /dev/loop1 ./temp_rootfs
> > + sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C ./temp_rootfs/
> > +
> > + ## Gzip the img file to save lot of space
> > + zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
> > +
> > + ## Clean up when done
> > + sudo umount ./temp_boot
> > + sudo umount ./temp_rootfs
> > + sudo rm -rf ./temp_boot/
> > + sudo rm -rf ./temp_rootfs/
> > + sudo losetup -d /dev/loop0
> > + sudo losetup -d /dev/loop1
> > + sudo rm -rf ${sd_card_img_file}
> > +}
> > +
> > create_sd_card_content() {
> > # Set m for logging purposes
> > m="$1"
> > @@ -291,6 +369,8 @@ package_web_content() {
> > # Move the installer into the exports directory
> > mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
> >
> > + mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip
> $exports_root/
> > +
> > # Create the md5sum file
> > cd $exports_root
> > md5sum * > md5sum.txt
> > @@ -373,6 +453,8 @@ package_individual_sdk() {
> > # Create the SD card tarballs in the deploy directory
> > create_sd_card_content $m
> >
> > + create_sd_card_img $m
> > +
> > # Package the SD card and web page contents to get ready for
> > # generating the webgen page and publishing the SDK
> > package_web_content $m
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > meta-arago mailing list
> > meta-arago@arago-project.org
> > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
2014-12-10 17:55 ` Cooper Jr., Franklin
@ 2014-12-10 18:22 ` Denys Dmytriyenko
2014-12-10 20:03 ` Cooper Jr., Franklin
0 siblings, 1 reply; 6+ messages in thread
From: Denys Dmytriyenko @ 2014-12-10 18:22 UTC (permalink / raw)
To: Cooper Jr., Franklin; +Cc: meta-arago@arago-project.org
On Wed, Dec 10, 2014 at 12:55:28PM -0500, Cooper Jr., Franklin wrote:
>
>
> > -----Original Message-----
> > From: meta-arago-bounces@arago-project.org [mailto:meta-arago-
> > bounces@arago-project.org] On Behalf Of Dmytriyenko, Denys
> > Sent: Wednesday, December 10, 2014 11:41 AM
> > To: Stiffler, Jacob
> > Cc: meta-arago@arago-project.org
> > Subject: Re: [meta-arago] [tisdk-build-scripts][PATCH] package-sdks:
> > Generate the SD Card image.
> >
> > Jake,
> >
> > Why invent another method to create an SD card? We've had too many of
> > those already...
> > For example, here's an old but complete one, that Chase and Franklin had in
> > AMSDK and it is still being packaged in our SDKs from ti-tisdk-setup recipe:
> > http://arago-project.org/git/projects/?p=tisdk-setup-
> > scripts.git;a=blob;f=create-sdcard.sh;hb=HEAD
> >
> > Moreover, under the Yocto Project, there is an effort to provide a
> > standardized tool called "wic" that takes care of creating and partitioning
> > bootable disks and SD cards. The best feature of it is not requiring root or
> > sudo access! I was already looking at it, but it had some bugs in Daisy
> > release, that got fixed in the new release that we'll be migrating to in the
> > near future. And wic tool is planned to be adopted for our SDK products.
> >
> > So, for now, I'd refrain from creating another custom script to create an SD
> > card...
> [Franklin] So we created an image using the commands that Jake is using in
> his script due to people still complaining that they can't create an SD Card
> on Windows. We actually created a manual image as part of the SDK download
> page for SDK 7.0. However, I am all for using an alternative solution if wic
> would work. The reason why I never submitted similar patches was due to my
> dislike of consuming system resources (loop devices) and all the required
> sudo commands.
I understand those are the same commands, but I was suggesting to try to reuse
the existing script, especially since it's already part of the SDK. It can be
modified to accomodate any necessary fixes...
> > On Wed, Dec 10, 2014 at 09:34:09AM -0500, Jacob Stiffler wrote:
> > > Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> > > ---
> > > lib/oesdk/package-sdks | 82
> > ++++++++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 82 insertions(+)
> > >
> > > diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks
> > > index 31a44b6..dc3eb13 100644
> > > --- a/lib/oesdk/package-sdks
> > > +++ b/lib/oesdk/package-sdks
> > > @@ -9,6 +9,84 @@ then
> > > exit 1
> > > fi
> > >
> > > +create_sd_card_img() {
> > > + m="$1"
> > > +
> > > + sd_card_img_file="${m}-${TISDK_VERSION}.img"
> > > +
> > > + # Make the machine specific SD card directory
> > > + sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
> > > +
> > > + if [ -d $sd_card_img_root ]
> > > + then
> > > + rm -rf $sd_card_img_root
> > > + fi
> > > + mkdir -p $sd_card_img_root
> > > +
> > > + cd $sd_card_img_root
> > > +
> > > + ## Create an image file full of zeros
> > > + dd if=/dev/zero of="${sd_card_img_file}" bs=1024 count=$[2000*1024]
> > > +
> > > + ## Mount the file to the loopback device
> > > + sudo losetup /dev/loop0 "${sd_card_img_file}"
> > > +
> > > + ## Partition the loopback into 2 partitions
> > > + sudo parted -s /dev/loop0 mklabel msdos
> > > + sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
> > > + sudo parted -s /dev/loop0 set 1 boot on
> > > + sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9 -2
> > > +
> > > + ## Format the partitions with the necessary filesystems
> > > + sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
> > > + sudo mkfs.ext3 -L rootfs /dev/loop0p2
> > > +
> > > + ## Use fdisk to get offsets (will need to multiply by blocksize (512))
> > > + sudo fdisk -l ${sd_card_img_file}
> > > +
> > > + local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
> > > +
> > > + local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{ print $9 }'`
> > > +
> > > + local P1_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> > awk '{ print $3 }'`
> > > + local P1_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}1" |
> > awk '{ print $4 }'`
> > > +
> > > + local P2_START=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> > awk '{ print $2 }'`
> > > + local P2_END=`echo "$FDISK_INFO" | grep "${sd_card_img_file}2" |
> > awk '{ print $3 }'`
> > > +
> > > + ## Unmount the loopback device
> > > + sudo losetup -d /dev/loop0
> > > +
> > > + ## Mount the individual partitions of the loopback device for file
> > copying
> > > + ## The Start (after-o option) and sizelimit numbers come from
> > multiplying the output
> > > + ## of fdisk above by blocksize (512 in this case) for the appropriate
> > partition.
> > > + ## 1048576 = 2048 * 512
> > > + ## 74448384 = 145407 * 512
> > > + sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START *
> > $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
> > > +
> > > + mkdir ./temp_boot
> > > + sudo mount -t vfat /dev/loop0 ./temp_boot
> > > + sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C ./temp_boot/
> > > +
> > > + ## Follow the above steps using numbers for the second partition.
> > > + sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START *
> > $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
> > > + mkdir ./temp_rootfs
> > > + sudo mount -t ext3 /dev/loop1 ./temp_rootfs
> > > + sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C ./temp_rootfs/
> > > +
> > > + ## Gzip the img file to save lot of space
> > > + zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
> > > +
> > > + ## Clean up when done
> > > + sudo umount ./temp_boot
> > > + sudo umount ./temp_rootfs
> > > + sudo rm -rf ./temp_boot/
> > > + sudo rm -rf ./temp_rootfs/
> > > + sudo losetup -d /dev/loop0
> > > + sudo losetup -d /dev/loop1
> > > + sudo rm -rf ${sd_card_img_file}
> > > +}
> > > +
> > > create_sd_card_content() {
> > > # Set m for logging purposes
> > > m="$1"
> > > @@ -291,6 +369,8 @@ package_web_content() {
> > > # Move the installer into the exports directory
> > > mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
> > >
> > > + mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip
> > $exports_root/
> > > +
> > > # Create the md5sum file
> > > cd $exports_root
> > > md5sum * > md5sum.txt
> > > @@ -373,6 +453,8 @@ package_individual_sdk() {
> > > # Create the SD card tarballs in the deploy directory
> > > create_sd_card_content $m
> > >
> > > + create_sd_card_img $m
> > > +
> > > # Package the SD card and web page contents to get ready for
> > > # generating the webgen page and publishing the SDK
> > > package_web_content $m
> > > --
> > > 1.7.9.5
> > >
> > > _______________________________________________
> > > meta-arago mailing list
> > > meta-arago@arago-project.org
> > > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
> > _______________________________________________
> > meta-arago mailing list
> > meta-arago@arago-project.org
> > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image.
2014-12-10 18:22 ` Denys Dmytriyenko
@ 2014-12-10 20:03 ` Cooper Jr., Franklin
0 siblings, 0 replies; 6+ messages in thread
From: Cooper Jr., Franklin @ 2014-12-10 20:03 UTC (permalink / raw)
To: Dmytriyenko, Denys; +Cc: meta-arago@arago-project.org
> -----Original Message-----
> From: Dmytriyenko, Denys
> Sent: Wednesday, December 10, 2014 12:23 PM
> To: Cooper Jr., Franklin
> Cc: Stiffler, Jacob; meta-arago@arago-project.org
> Subject: Re: [meta-arago] [tisdk-build-scripts][PATCH] package-sdks:
> Generate the SD Card image.
>
> On Wed, Dec 10, 2014 at 12:55:28PM -0500, Cooper Jr., Franklin wrote:
> >
> >
> > > -----Original Message-----
> > > From: meta-arago-bounces@arago-project.org [mailto:meta-arago-
> > > bounces@arago-project.org] On Behalf Of Dmytriyenko, Denys
> > > Sent: Wednesday, December 10, 2014 11:41 AM
> > > To: Stiffler, Jacob
> > > Cc: meta-arago@arago-project.org
> > > Subject: Re: [meta-arago] [tisdk-build-scripts][PATCH] package-sdks:
> > > Generate the SD Card image.
> > >
> > > Jake,
> > >
> > > Why invent another method to create an SD card? We've had too many
> > > of those already...
> > > For example, here's an old but complete one, that Chase and Franklin
> > > had in AMSDK and it is still being packaged in our SDKs from ti-tisdk-setup
> recipe:
> > > http://arago-project.org/git/projects/?p=tisdk-setup-
> > > scripts.git;a=blob;f=create-sdcard.sh;hb=HEAD
> > >
> > > Moreover, under the Yocto Project, there is an effort to provide a
> > > standardized tool called "wic" that takes care of creating and
> > > partitioning bootable disks and SD cards. The best feature of it is
> > > not requiring root or sudo access! I was already looking at it, but
> > > it had some bugs in Daisy release, that got fixed in the new release
> > > that we'll be migrating to in the near future. And wic tool is planned to be
> adopted for our SDK products.
> > >
> > > So, for now, I'd refrain from creating another custom script to
> > > create an SD card...
>
> > [Franklin] So we created an image using the commands that Jake is
> > using in his script due to people still complaining that they can't
> > create an SD Card on Windows. We actually created a manual image as
> > part of the SDK download page for SDK 7.0. However, I am all for using
> > an alternative solution if wic would work. The reason why I never
> > submitted similar patches was due to my dislike of consuming system
> > resources (loop devices) and all the required sudo commands.
>
> I understand those are the same commands, but I was suggesting to try to
> reuse the existing script, especially since it's already part of the SDK. It can be
> modified to accomodate any necessary fixes...
[Franklin] Makes sense. If I remember correctly when I attempted to do that awhile ago you have to do some things differently at the beginning since some of the commands don't work on loop devices.
>
>
> > > On Wed, Dec 10, 2014 at 09:34:09AM -0500, Jacob Stiffler wrote:
> > > > Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> > > > ---
> > > > lib/oesdk/package-sdks | 82
> > > ++++++++++++++++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 82 insertions(+)
> > > >
> > > > diff --git a/lib/oesdk/package-sdks b/lib/oesdk/package-sdks index
> > > > 31a44b6..dc3eb13 100644
> > > > --- a/lib/oesdk/package-sdks
> > > > +++ b/lib/oesdk/package-sdks
> > > > @@ -9,6 +9,84 @@ then
> > > > exit 1
> > > > fi
> > > >
> > > > +create_sd_card_img() {
> > > > + m="$1"
> > > > +
> > > > + sd_card_img_file="${m}-${TISDK_VERSION}.img"
> > > > +
> > > > + # Make the machine specific SD card directory
> > > > + sd_card_img_root="$DEPLOY_ROOT/$m/$BUILD_ID/sd_card_img"
> > > > +
> > > > + if [ -d $sd_card_img_root ]
> > > > + then
> > > > + rm -rf $sd_card_img_root
> > > > + fi
> > > > + mkdir -p $sd_card_img_root
> > > > +
> > > > + cd $sd_card_img_root
> > > > +
> > > > + ## Create an image file full of zeros
> > > > + dd if=/dev/zero of="${sd_card_img_file}" bs=1024
> > > > + count=$[2000*1024]
> > > > +
> > > > + ## Mount the file to the loopback device
> > > > + sudo losetup /dev/loop0 "${sd_card_img_file}"
> > > > +
> > > > + ## Partition the loopback into 2 partitions
> > > > + sudo parted -s /dev/loop0 mklabel msdos
> > > > + sudo parted -s /dev/loop0 unit cyl mkpart primary fat32 -- 0 9
> > > > + sudo parted -s /dev/loop0 set 1 boot on
> > > > + sudo parted -s /dev/loop0 unit cyl mkpart primary ext2 -- 9
> > > > + -2
> > > > +
> > > > + ## Format the partitions with the necessary filesystems
> > > > + sudo mkfs.vfat -F 32 -I -n boot /dev/loop0p1
> > > > + sudo mkfs.ext3 -L rootfs /dev/loop0p2
> > > > +
> > > > + ## Use fdisk to get offsets (will need to multiply by blocksize (512))
> > > > + sudo fdisk -l ${sd_card_img_file}
> > > > +
> > > > + local FDISK_INFO=`sudo fdisk -l "${sd_card_img_file}"`
> > > > +
> > > > + local UNIT_SIZE=`echo "$FDISK_INFO" | grep Units | awk '{
> > > > + print $9 }'`
> > > > +
> > > > + local P1_START=`echo "$FDISK_INFO" | grep
> > > > + "${sd_card_img_file}1" |
> > > awk '{ print $3 }'`
> > > > + local P1_END=`echo "$FDISK_INFO" | grep
> > > > + "${sd_card_img_file}1" |
> > > awk '{ print $4 }'`
> > > > +
> > > > + local P2_START=`echo "$FDISK_INFO" | grep
> > > > + "${sd_card_img_file}2" |
> > > awk '{ print $2 }'`
> > > > + local P2_END=`echo "$FDISK_INFO" | grep
> > > > + "${sd_card_img_file}2" |
> > > awk '{ print $3 }'`
> > > > +
> > > > + ## Unmount the loopback device
> > > > + sudo losetup -d /dev/loop0
> > > > +
> > > > + ## Mount the individual partitions of the loopback device for
> > > > + file
> > > copying
> > > > + ## The Start (after-o option) and sizelimit numbers come from
> > > multiplying the output
> > > > + ## of fdisk above by blocksize (512 in this case) for the
> > > > + appropriate
> > > partition.
> > > > + ## 1048576 = 2048 * 512
> > > > + ## 74448384 = 145407 * 512
> > > > + sudo losetup /dev/loop0 "${sd_card_img_file}" -o $[$P1_START
> > > > + *
> > > $UNIT_SIZE] --sizelimit $[$P1_END * $UNIT_SIZE]
> > > > +
> > > > + mkdir ./temp_boot
> > > > + sudo mount -t vfat /dev/loop0 ./temp_boot
> > > > + sudo tar xzf ${sd_card_root}/boot_partition.tar.gz -C
> > > > + ./temp_boot/
> > > > +
> > > > + ## Follow the above steps using numbers for the second partition.
> > > > + sudo losetup /dev/loop1 "${sd_card_img_file}" -o $[$P2_START
> > > > + *
> > > $UNIT_SIZE] --sizelimit $[$P2_END * $UNIT_SIZE]
> > > > + mkdir ./temp_rootfs
> > > > + sudo mount -t ext3 /dev/loop1 ./temp_rootfs
> > > > + sudo tar xzf ${sd_card_root}/rootfs_partition.tar.gz -C
> > > > + ./temp_rootfs/
> > > > +
> > > > + ## Gzip the img file to save lot of space
> > > > + zip -r ${sd_card_img_file}.zip ${sd_card_img_file}
> > > > +
> > > > + ## Clean up when done
> > > > + sudo umount ./temp_boot
> > > > + sudo umount ./temp_rootfs
> > > > + sudo rm -rf ./temp_boot/
> > > > + sudo rm -rf ./temp_rootfs/
> > > > + sudo losetup -d /dev/loop0
> > > > + sudo losetup -d /dev/loop1
> > > > + sudo rm -rf ${sd_card_img_file} }
> > > > +
> > > > create_sd_card_content() {
> > > > # Set m for logging purposes
> > > > m="$1"
> > > > @@ -291,6 +369,8 @@ package_web_content() {
> > > > # Move the installer into the exports directory
> > > > mv $deploy_root/${INSTALLER_PREFIX}-$m* $exports_root/
> > > >
> > > > + mv $sd_card_img_root/${m}-${TISDK_VERSION}.img.zip
> > > $exports_root/
> > > > +
> > > > # Create the md5sum file
> > > > cd $exports_root
> > > > md5sum * > md5sum.txt
> > > > @@ -373,6 +453,8 @@ package_individual_sdk() {
> > > > # Create the SD card tarballs in the deploy directory
> > > > create_sd_card_content $m
> > > >
> > > > + create_sd_card_img $m
> > > > +
> > > > # Package the SD card and web page contents to get ready for
> > > > # generating the webgen page and publishing the SDK
> > > > package_web_content $m
> > > > --
> > > > 1.7.9.5
> > > >
> > > > _______________________________________________
> > > > meta-arago mailing list
> > > > meta-arago@arago-project.org
> > > > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
> > > _______________________________________________
> > > meta-arago mailing list
> > > meta-arago@arago-project.org
> > > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-10 20:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 14:34 [tisdk-build-scripts][PATCH] package-sdks: Generate the SD Card image Jacob Stiffler
2014-12-10 17:22 ` Cooper Jr., Franklin
2014-12-10 17:41 ` Denys Dmytriyenko
2014-12-10 17:55 ` Cooper Jr., Franklin
2014-12-10 18:22 ` Denys Dmytriyenko
2014-12-10 20:03 ` Cooper Jr., Franklin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.