  We explore a scheme for entanglement generation and optimization in giant
atoms by coupling them to finite one-dimensional arrays of spins that behave as
cavities. We find that high values for the concurrence can be achieved in
small-sized cavities, being the generation time very short. When exciting the
system by external means, optimal concurrence is obtained for very weak
drivings. We also analyze the effect of disorder in these systems, showing that
although the average concurrence decreases with disorder, high concurrences can
still be obtained even in scenarios presenting strong disorder. This result
leads us to propose an optimization procedure in which by engineering the
on-site energies or hoppings in the cavity, concurrences close to 1 can be
reached within an extremely short period of time.
