|
|
@ -22,7 +22,7 @@ while [ $# -gt 0 ] |
|
|
|
do |
|
|
|
case "$1" in |
|
|
|
-i) |
|
|
|
INPUT_IMAGE=$2 |
|
|
|
INPUT_IMAGE_PATH=$2 |
|
|
|
have_input_image=1 |
|
|
|
shift |
|
|
|
;; |
|
|
@ -42,21 +42,22 @@ do |
|
|
|
shift |
|
|
|
done |
|
|
|
|
|
|
|
OUTPUT_IMAGE=${INPUT_IMAGE%%.*}_prepared_12mb.rom |
|
|
|
|
|
|
|
if [ "$have_input_image" -gt 0 ] ; then |
|
|
|
echo "creating" |
|
|
|
echo "output/${OUTPUT_IMAGE}" |
|
|
|
echo "from" |
|
|
|
echo "${INPUT_IMAGE}" |
|
|
|
echo "---------------------------------------------------------" |
|
|
|
else |
|
|
|
if [ ! "$have_input_image" -gt 0 ] ; then |
|
|
|
echo "no input image provided" |
|
|
|
usage |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
input_filesize=$(wc -c <"$INPUT_IMAGE") |
|
|
|
OUTPUT_PATH=output |
|
|
|
INPUT_IMAGE_NAME=$(basename ${INPUT_IMAGE_PATH}) |
|
|
|
OUTPUT_IMAGE_NAME=${INPUT_IMAGE_NAME%%.*}_prepared_12mb.rom |
|
|
|
OUTPUT_IMAGE_PATH=${OUTPUT_PATH}/${OUTPUT_IMAGE_NAME} |
|
|
|
|
|
|
|
echo -e "creating ${GREEN}${OUTPUT_IMAGE_PATH}${NC} from ${INPUT_IMAGE_NAME}" |
|
|
|
|
|
|
|
|
|
|
|
input_filesize=$(wc -c <"$INPUT_IMAGE_PATH") |
|
|
|
reference_filesize=4194304 |
|
|
|
if [ ! "$input_filesize" -eq "$reference_filesize" ] ; then |
|
|
|
echo "Error: input file must be 4MB of size" |
|
|
@ -64,16 +65,13 @@ if [ ! "$input_filesize" -eq "$reference_filesize" ] ; then |
|
|
|
fi |
|
|
|
|
|
|
|
rm -rf output |
|
|
|
mkdir output && cd output |
|
|
|
dd if=/dev/zero of=${OUTPUT_IMAGE} bs=4M count=2 |
|
|
|
|
|
|
|
cp ../${INPUT_IMAGE} . |
|
|
|
dd if=${INPUT_IMAGE} oflag=append conv=notrunc of=${OUTPUT_IMAGE} bs=4M |
|
|
|
mkdir output |
|
|
|
|
|
|
|
echo "0x00000000:0x007fffff ifdmegbe" > x230-layout.txt |
|
|
|
echo "0x00800000:0x00bfffff bios" >> x230-layout.txt |
|
|
|
dd if=/dev/zero of=${OUTPUT_IMAGE_PATH} bs=4M count=2 |
|
|
|
dd if=${INPUT_IMAGE_PATH} oflag=append conv=notrunc of=${OUTPUT_IMAGE_PATH} bs=4M |
|
|
|
|
|
|
|
rm ${INPUT_IMAGE} |
|
|
|
echo "0x00000000:0x007fffff ifdmegbe" > ${OUTPUT_PATH}/x230-layout.txt |
|
|
|
echo "0x00800000:0x00bfffff bios" >> ${OUTPUT_PATH}/x230-layout.txt |
|
|
|
|
|
|
|
echo "---------------------------------------------------------" |
|
|
|
echo -e "${RED}CAUTION: internal flashing is NOT encouraged${NC}" |
|
|
@ -82,4 +80,4 @@ echo "prepared files for internal flashing in output directory." |
|
|
|
echo "template flashrom command (please adapt the chip name) :" |
|
|
|
echo "" |
|
|
|
echo "cd output" |
|
|
|
echo -e "${GREEN}flashrom -p internal:laptop=force_I_want_a_brick,spispeed=128 --layout x230-layout.txt --image bios -c "MX25L3206E" -w ${OUTPUT_IMAGE}${NC}" |
|
|
|
echo -e "${GREEN}flashrom -p internal:laptop=force_I_want_a_brick,spispeed=128 --layout x230-layout.txt --image bios -c "MX25L3206E" -w ${OUTPUT_IMAGE_PATH}${NC}" |