#
# Copyright (c) 2010 Samsung Electronics Co., Ltd.
# Http://www.samsung.com/
#
# This program is free software; you can redistribute it and/or modify
# It under the terms of the GNU General Public License version 2
# Published by the Free Software Foundation.
#
####################################
Reader_type1 = "/dev/SDB"
Reader_type2 = "/dev/mmcblk0"
// The-Z string is "null". The length is 0.
If [-Z $1] // determines whether the input parameter is null. If it is null, the function of the sd_fusing.sh script file is displayed.
Then
Echo "Usage:./sd_fusing.sh <SD reader's Device File>"
Exit 0
Fi
If [$1 = $ reader_type1] // If the input parameter = reader_type1 is equal to = "/dev/SDB"
Then
Partition1 = "$11"
Partition2 = "$12"
Partition3 = "$13"
Partition4 = "$14"
Elif [$1 = $ reader_type2] // same as above
Then
Partition1 = "$1p1"
Partition2 = "$1p2"
Partition3 = "$1p3"
Partition4 = "$1p4"
Else // if it is not the above two parameter names, an unsupported SD card is prompted
Echo "unsupported SD reader"
Exit 0
Fi
// [-B file] If the file exists and is a block-the special file is true
If [-B $1] // if the device/dev/SDB exists, the SD card is displayed for identification. Otherwise...
Then
Echo "$1 reader is identified ."
Else
Echo "$1 is not identified ."
Exit 0
Fi
####################################
# Make Partition
Echo "make SD card partition"
Echo "./sd_fdisk $1"
./Sd_fdisk $1 // I found that this sd_fdisk.c only creates a 10 m fat for the SD card.
// Partition. when IMG is running, we need to execute the fdisk-C 0 command in uboot // and perform a partition again. But I don't know why I want to do this. Isn't that a single move? Isn't it OK to split the zone on the PC end at one time?
Dd iflag = dsync Oflag = dsync if = sd_mbr.dat of = $1
Rm sd_mbr.dat
# Delete sd_mbr.dat after executing sd_mbr.dat on the/dev/SDB Device
####################################
# Format
Umount $ partition1 2>/dev/null
Umount $ partition2 2>/dev/null
Umount $ partition3 2>/dev/null
Umount $ partition4 2>/dev/null
Echo "mkfs. vfat-F 32 $ partition1"
Mkfs. vfat-F 32 $ partition1 // create a FAT32 Partition
# Echo "mkfs. ext2 $ partition2"
# Mkfs. ext2 $ partition2
# Echo "mkfs. ext2 $ partition3"
# Mkfs. ext2 $ partition3
# Echo "mkfs. ext2 $ partition4"
# Mkfs. ext2 $ partition4
####################################
# Mount
# Umount/Media/SD 2>/dev/null
# Mkdir-P/Media/SD
# Echo "Mount-T vfat $ partition1/Media/sd"
# Mount-T vfat $ partition1/Media/SD
####################################
#<BL1 fusing>
Bl1_position = 1
Uboot_position = 49
Echo "BL1 fusing"
/Mkbl1 ../u-boot.bin SD-bl1-8k.bin 8192 # the size of 8 K SD-bl1-8k.bin is separated.
Dd iflag = dsync Oflag = dsync if = SD-bl1-8k.bin of = $1 seek = $ bl1_position
Rm SD-bl1-8k.bin
# Write the SD-bl1-8k.bin to the SD card bl1_position position, and then delete the bl1_position
####################################
# <U-boot fusing>
Echo "U-boot fusing"
Dd iflag = dsync Oflag = dsync if = ../u-boot.bin of = $1 seek = $ uboot_position
# Write the u-boot.bin to the uboot_position position
####################################
# <Message display>
Echo "U-boot image is fused successfully ."
Echo "eject SD card and insert it again ."
Summary: The purpose of this sd_fusing.sh is to create a FAT32 partition and then use dd (You must create a FAT32 partition before executing it !) The command writes the SD-bl1-8k.bin and u-boot.bin files to/dev/sdb. But what is the relationship between the kernel? Why?