How can I reduce the size of the package in Arduino15 for Arduino Uno only?

Updated:

I want to release this arduino-cli for offline users using Arduino Uno hardware.
So I was trying to make the arduino-cli be embedding the ardunio:avr platform in the core from the first.
By the help of issue([Question] How can I make the arduino-cli be embedding the ardunio:avr platform in the core from the first? · Issue #1190 · arduino/arduino-cli · GitHub), I achieved first step.

But, the size of the package in the Arduino15 directory which is created by the command arduino-cli core install arduino:avr is almost 270MB. Especially, Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 is the biggest size, almost 235MB. It's too big for the my custom release. It's too big! I am planning to release my custom program including this toolchain(CLI+core platform). How can I dramatically reduce it only for Uno and Nano?

Hi @comseong! Here is what you need to keep. You can delete everything else:

  • Arduino15/packages/arduino/hardware/avr/1.8.3/boards.txt
  • Arduino15/packages/arduino/hardware/avr/1.8.3/installed.json
  • Arduino15/packages/arduino/hardware/avr/1.8.3/platform.txt
  • Arduino15/packages/arduino/hardware/avr/1.8.3/programmers.txt
  • Arduino15/packages/arduino/hardware/avr/1.8.3/bootloaders/optiboot
  • Arduino15/packages/arduino/hardware/avr/1.8.3/cores
  • Arduino15/packages/arduino/hardware/avr/1.8.3/libraries
  • Arduino15/packages/arduino/hardware/avr/1.8.3/variants/standard
  • Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
  • Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7

Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 is the biggest by far. This contains support for every AVR microcontroller, but you only need the ATmega328P support for the Uno, so it's likely you could remove some files. I don't know exactly what though. I'm sure one of the other forum members will be able to provide assistance with that.

I created my 2nd continuous question to new topic(
Can the CLI reuse the core platform in Arduino IDE which is already installed?).